comp-hub 0.29.7 → 0.29.8

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 (154) hide show
  1. package/README.md +132 -132
  2. package/bin/cli.js +53 -53
  3. package/bin/lib/commands.js +173 -173
  4. package/bin/lib/constants.js +22 -22
  5. package/bin/lib/http.js +62 -62
  6. package/bin/lib/startup.js +183 -183
  7. package/bin/lib/utils.js +112 -112
  8. package/dist/index.js +1 -1
  9. package/dist/website/container/assets/{index-CfBoiGrX.css → index-BlSriQ8o.css} +1 -1
  10. package/dist/website/container/assets/{index-BeeqGiFl.js → index-rRWp31us.js} +1 -1
  11. package/dist/website/container/index.html +32 -32
  12. package/dist/website/container/js/vue2-sfc-loader.js +260 -260
  13. package/dist/website/container/js/vue3-sfc-loader.js +289 -289
  14. package/dist/website/item/assets/index-CDQboxOq.css +1 -0
  15. package/dist/website/item/assets/{index-D3VEpySe.js → index-DIJTHUc5.js} +3 -3
  16. package/dist/website/item/index.html +30 -30
  17. package/dist/website/main/assets/AuthCodeSendBtn.vue_vue_type_script_setup_true_lang-CSa_pS0b.js +1 -0
  18. package/dist/website/main/assets/BaseDialog.vue_vue_type_script_setup_true_lang-BCEeHWp0.js +1 -0
  19. package/dist/website/main/assets/BaseSegmented.vue_vue_type_script_setup_true_lang-B9sbaztP.js +1 -0
  20. package/dist/website/main/assets/CanvasAnimation.vue_vue_type_script_setup_true_lang-I_B9sBtb.js +1 -0
  21. package/dist/website/main/assets/EmptyStatusContainer.vue_vue_type_script_setup_true_lang-vaWJXLBi.js +1 -0
  22. package/dist/website/main/assets/LoadingWrapper.vue_vue_type_script_setup_true_lang-Brp0esZx.js +1 -0
  23. package/dist/website/main/assets/PanelBackground.vue_vue_type_script_setup_true_lang-Dp5z6Iw1.js +1 -0
  24. package/dist/website/main/assets/cloud-upload-DRSmr6Qo.js +1 -0
  25. package/dist/website/main/assets/core-YKf42450.js +3 -0
  26. package/dist/website/main/assets/{el-table-column-BaabKDRF.js → el-table-column-B36K2Har.js} +1 -1
  27. package/dist/website/main/assets/home-rounded--9AAXiZb.js +1 -0
  28. package/dist/website/main/assets/index-BHVQkNA2.js +1 -0
  29. package/dist/website/main/assets/index-BV4gqPW9.js +1 -0
  30. package/dist/website/main/assets/{index-9ejOpPXc.js → index-BW8vDkye.js} +3 -3
  31. package/dist/website/main/assets/index-BXjslBXB.js +1 -0
  32. package/dist/website/main/assets/index-BmnVYsjU.js +1 -0
  33. package/dist/website/main/assets/index-C-RbFIGY.js +1 -0
  34. package/dist/website/main/assets/index-C-elMysi.js +1 -0
  35. package/dist/website/main/assets/index-CCE8UKEc.js +1 -0
  36. package/dist/website/main/assets/index-CJu9086M.js +2 -0
  37. package/dist/website/main/assets/index-CN4epH6N.js +1 -0
  38. package/dist/website/main/assets/{index-CyPExloz.css → index-CRFJskzu.css} +1 -1
  39. package/dist/website/main/assets/index-CTk2LB3W.js +1 -0
  40. package/dist/website/main/assets/index-CWZwdzIK.js +1 -0
  41. package/dist/website/main/assets/index-CYRE55Ch.js +1 -0
  42. package/dist/website/main/assets/index-CYvMpsAk.js +1 -0
  43. package/dist/website/main/assets/index-CdGhZYup.js +1 -0
  44. package/dist/website/main/assets/index-CfYP0TVV.js +1 -0
  45. package/dist/website/main/assets/index-D-zBzPPy.css +1 -0
  46. package/dist/website/main/assets/index-D2HIFwH2.js +1 -0
  47. package/dist/website/main/assets/index-D8FvfjtO.js +1 -0
  48. package/dist/website/main/assets/index-DGeSXL3t.js +1 -0
  49. package/dist/website/main/assets/index-DW1TR3IW.js +1 -0
  50. package/dist/website/main/assets/index-DhAkucE9.js +1 -0
  51. package/dist/website/main/assets/index-Dl_h7vrN.js +2 -0
  52. package/dist/website/main/assets/index-DpHwEP_B.js +1 -0
  53. package/dist/website/main/assets/{index-CpXbVBP2.js → index-Ds4AosT0.js} +5 -5
  54. package/dist/website/main/assets/index-DwBDz4RR.js +1 -0
  55. package/dist/website/main/assets/{index-Cl0SK7oa.css → index-DxyEzkir.css} +1 -1
  56. package/dist/website/main/assets/index-EHIrsqSu.js +1 -0
  57. package/dist/website/main/assets/index-FFTkVbVX.css +1 -0
  58. package/dist/website/main/assets/index-M80Ed-Pb.js +1 -0
  59. package/dist/website/main/assets/index-Mryq8zw5.js +5 -0
  60. package/dist/website/main/assets/index-PeLBbpUx.js +1 -0
  61. package/dist/website/main/assets/index-QX7WDOzk.js +1 -0
  62. package/dist/website/main/assets/{index-C8unIZll.css → index-WO9Mrc8w.css} +1 -1
  63. package/dist/website/main/assets/index-qAhDQceU.js +1 -0
  64. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-BfK34NCv.js +1 -0
  65. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-DjS3Q9-g.js +1 -0
  66. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-DtekInbn.js +1 -0
  67. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-RkEocesH.js +1 -0
  68. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-XpLtazGO.js +2 -0
  69. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-m8-lu9dQ.js +1 -0
  70. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-t5Qr3Cck.js +1 -0
  71. package/dist/website/main/assets/{index.vue_vue_type_style_index_0_lang-D39LYnj3.js → index.vue_vue_type_style_index_0_lang-B-Okzh4k.js} +1 -1
  72. package/dist/website/main/assets/index.vue_vue_type_style_index_0_lang-BCmjNfvt.js +6 -0
  73. package/dist/website/main/assets/index.vue_vue_type_style_index_0_lang-CTWQlkPh.js +1 -0
  74. package/dist/website/main/assets/kid-star-DWSbAoDk.js +1 -0
  75. package/dist/website/main/assets/md5-BVscxO09.js +1 -0
  76. package/dist/website/main/assets/settings-DyQPsIIk.js +1 -0
  77. package/dist/website/main/assets/supervised-user-circle-BzCVjgAw.js +1 -0
  78. package/dist/website/main/assets/sync-saved-locally-rounded-Dm232VG8.js +1 -0
  79. package/dist/website/main/assets/terminal-Cpm-3gfc.js +1 -0
  80. package/dist/website/main/assets/useCacheOssStore-BUYcRp33.js +1 -0
  81. package/dist/website/main/assets/{useCompEditStore-DCFM66C4.js → useCompEditStore-CCV6awON.js} +2 -2
  82. package/dist/website/main/assets/{useCompEditStore-DfjsDbzX.css → useCompEditStore-CxnuC31d.css} +1 -1
  83. package/dist/website/main/assets/useCompMetaLocalStore-ke8aERqo.js +1 -0
  84. package/dist/website/main/assets/useKeyword-BWlKaVGC.js +1 -0
  85. package/dist/website/main/assets/useMessage-DGNISOif.js +1 -0
  86. package/dist/website/main/assets/{useTeamHeaders-kxuE8Q8s.js → useTeamHeaders-CXV6avPM.js} +1 -1
  87. package/dist/website/main/assets/useVscodeOpen-W9IOZ_u_.js +1 -0
  88. package/dist/website/main/assets/{vendor-core-B1hRUZR_.js → vendor-core-BHu_Iam8.js} +1 -1
  89. package/dist/website/main/assets/{vendor-ui-CMQTpMsc.js → vendor-ui-Lm7VJSSH.js} +2 -2
  90. package/dist/website/main/assets/{vendor-xterm-mNFjEaKn.js → vendor-xterm-DbWxaMay.js} +1 -1
  91. package/dist/website/main/index.html +4 -4
  92. package/package.json +45 -45
  93. package/dist/website/item/assets/index-BZnlGnqP.css +0 -1
  94. package/dist/website/main/assets/AuthCodeSendBtn.vue_vue_type_script_setup_true_lang-sJqw3hBL.js +0 -1
  95. package/dist/website/main/assets/BaseDialog.vue_vue_type_script_setup_true_lang-C89AreA-.js +0 -1
  96. package/dist/website/main/assets/BaseSegmented.vue_vue_type_script_setup_true_lang-DLPiWvzo.js +0 -1
  97. package/dist/website/main/assets/CanvasAnimation.vue_vue_type_script_setup_true_lang-CPSb3doF.js +0 -1
  98. package/dist/website/main/assets/EmptyStatusContainer.vue_vue_type_script_setup_true_lang-1uLX4usT.js +0 -1
  99. package/dist/website/main/assets/LoadingWrapper.vue_vue_type_script_setup_true_lang-D2kQQ7qs.js +0 -1
  100. package/dist/website/main/assets/PanelBackground.vue_vue_type_script_setup_true_lang-BbH9Ke8c.js +0 -1
  101. package/dist/website/main/assets/cloud-upload-BZUdgCdI.js +0 -1
  102. package/dist/website/main/assets/core-CduF1cve.js +0 -3
  103. package/dist/website/main/assets/home-rounded-CAKszmlU.js +0 -1
  104. package/dist/website/main/assets/index-B2G95uaY.js +0 -1
  105. package/dist/website/main/assets/index-BI1iHj1p.js +0 -2
  106. package/dist/website/main/assets/index-BerOWbR5.js +0 -1
  107. package/dist/website/main/assets/index-Bg2Ll1MS.js +0 -1
  108. package/dist/website/main/assets/index-Bk2GHNDj.js +0 -1
  109. package/dist/website/main/assets/index-Bn9djJ1D.js +0 -1
  110. package/dist/website/main/assets/index-BoBZsqw_.js +0 -1
  111. package/dist/website/main/assets/index-Bth_SWAt.css +0 -1
  112. package/dist/website/main/assets/index-BvkOcMzw.js +0 -1
  113. package/dist/website/main/assets/index-BzJsbiup.js +0 -1
  114. package/dist/website/main/assets/index-C-ssDsWy.js +0 -1
  115. package/dist/website/main/assets/index-C4QJD9AO.js +0 -1
  116. package/dist/website/main/assets/index-CSqRH-KQ.js +0 -1
  117. package/dist/website/main/assets/index-CUiK2qn1.js +0 -1
  118. package/dist/website/main/assets/index-CZwZuk3-.js +0 -1
  119. package/dist/website/main/assets/index-ChEH9AoP.js +0 -1
  120. package/dist/website/main/assets/index-D4G87Mom.js +0 -1
  121. package/dist/website/main/assets/index-D6J3GPPV.js +0 -1
  122. package/dist/website/main/assets/index-DDnVu2nK.js +0 -1
  123. package/dist/website/main/assets/index-DJ4AvgpT.css +0 -1
  124. package/dist/website/main/assets/index-DL5xk_C7.js +0 -1
  125. package/dist/website/main/assets/index-DLWhyZSM.js +0 -2
  126. package/dist/website/main/assets/index-DO0i9je3.js +0 -5
  127. package/dist/website/main/assets/index-DYjUv_9s.js +0 -1
  128. package/dist/website/main/assets/index-De1XOjmk.js +0 -1
  129. package/dist/website/main/assets/index-DmCMPHi-.js +0 -1
  130. package/dist/website/main/assets/index-Dmk2WbAD.js +0 -1
  131. package/dist/website/main/assets/index-DryBDQGT.js +0 -1
  132. package/dist/website/main/assets/index-Dy_awGYi.js +0 -1
  133. package/dist/website/main/assets/index-QDcOlnTv.js +0 -1
  134. package/dist/website/main/assets/index-evWJEs_J.js +0 -1
  135. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-BCWiMLjz.js +0 -1
  136. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-BHRL6G5S.js +0 -1
  137. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-CKf4glow.js +0 -1
  138. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-CVAkHJvA.js +0 -1
  139. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-Cnaq7WZP.js +0 -1
  140. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-IxBKq7Py.js +0 -2
  141. package/dist/website/main/assets/index.vue_vue_type_script_setup_true_lang-qqOG6j-E.js +0 -1
  142. package/dist/website/main/assets/index.vue_vue_type_style_index_0_lang-Cm4wH59u.js +0 -6
  143. package/dist/website/main/assets/index.vue_vue_type_style_index_0_lang-D2h7hdt0.js +0 -1
  144. package/dist/website/main/assets/kid-star-FcmIH9T1.js +0 -1
  145. package/dist/website/main/assets/md5-DEHaPvGx.js +0 -1
  146. package/dist/website/main/assets/settings-DST6rYZI.js +0 -1
  147. package/dist/website/main/assets/supervised-user-circle-5toxzbuX.js +0 -1
  148. package/dist/website/main/assets/sync-saved-locally-rounded-ekj1nT7F.js +0 -1
  149. package/dist/website/main/assets/terminal-CiPichiX.js +0 -1
  150. package/dist/website/main/assets/useCacheOssStore-D1ihuvZi.js +0 -1
  151. package/dist/website/main/assets/useCompMetaLocalStore-CnMRn13T.js +0 -1
  152. package/dist/website/main/assets/useKeyword-2O8Qbig-.js +0 -1
  153. package/dist/website/main/assets/useMessage-C_SU5QaN.js +0 -1
  154. package/dist/website/main/assets/useVscodeOpen-CA_im4Vj.js +0 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (()=>{var __webpack_modules__={53196:ct=>{function webpackEmptyAsyncContext(ct){return Promise.resolve().then((()=>{var ut=new Error("Cannot find module '"+ct+"'");ut.code="MODULE_NOT_FOUND";throw ut}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=53196;ct.exports=webpackEmptyAsyncContext},38818:(ct,ut,pt)=>{const{Bootstrap:dt}=pt(84575);dt.configure({imports:pt(15545),moduleDetector:false}).run()},14071:function(ct,ut,pt){"use strict";var dt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});const ft=dt(pt(22078));const _t=pt(28234);const{logLevel:mt=""}=(0,ft.default)(process.argv.slice(2));ut["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:mt||"warn"},coreLogger:{level:mt||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},i18n:{defaultLocale:"zh",localeTable:{en:{default:_t.backendMessages.en},zh:{default:_t.backendMessages.zh}},writeCookie:false}}},91921:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut["default"]={}},12799:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var yt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.MainConfiguration=void 0;const vt=pt(46123);const St=mt(pt(47453));const bt=mt(pt(99375));const xt=mt(pt(65295));const $t=mt(pt(2865));const Et=mt(pt(49179));const Ct=mt(pt(62487));const Tt=mt(pt(96955));const wt=mt(pt(87735));const At=mt(pt(16928));const kt=mt(pt(79896));const It=yt(pt(76982));const Nt=pt(79896);const Pt=pt(24434);const Ot=yt(pt(99819));const Dt=yt(pt(44400));const Ft=yt(pt(77036));const Mt=pt(76289);const Rt=pt(60449);const Lt=pt(54633);const Bt=pt(59416);const Vt=pt(61142);const jt=pt(64754);const Ut=pt(10778);const Jt=pt(49969);const zt=pt(67872);const Wt=pt(4145);const qt=mt(pt(14071));const Ht=mt(pt(91921));const Kt=pt(39538);const Gt=pt(21739);const Xt=mt(pt(68255));const Qt={DEFAULT_PORT:Number(Kt.uri.getUrlPort(Rt.KEYS.LOCAL_SERVICE_URL_DEV)),MAX_SUB_PORT_RETRIES:20};let Yt=class MainConfiguration{constructor(){this.appConfig=null;this.subServer=null;this._websitePath=null}get websitePath(){if(!this._websitePath){const ct=this.app.getEnv();this._websitePath=At.resolve(__dirname,ct===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL?"../../../website":"./website")}return this._websitePath}get apiUrl(){const ct=this.app.getEnv();return ct===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL?Rt.KEYS.REMOTE_SERVICE_URL_DEV:Rt.KEYS.REMOTE_SERVICE_URL_PROD}getVersion(){const ct=this.app.getEnv();if(ct===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const ct=At.join(__dirname,"../../cli/package.json");const ut=JSON.parse((0,Nt.readFileSync)(ct,"utf8"));return ut.version}return process.env.COMP_HUB_VERSION||"unknown"}createProxyConfig(ct){const ut=new Pt.EventEmitter;const pt={...ct,on:{...ct.on,error:ct=>{this.logger.error("Proxy Error:",ct.message);ut.emit("error",ct)},proxyRes:()=>ut.emit("proxyRes"),proxyReq:ct=>{const pt=`${ct.protocol}//${ct.host}${ct.path}`;this.logger.debug("[Proxy] →",pt);ut.emit("proxyReq",ct)},proxyReqWs:(...ct)=>ut.emit("proxyReqWs",...ct)}};const dt=ct.pathRewrite;const ft=Object.keys(dt??{});if(ft.length>0){const[ct]=ft;pt.pathRewrite=ut=>{let pt=ut.replace(Rt.KEYS.PROXY_PATH_PREFIX,"");pt=pt.replace(new RegExp(ct),dt[ct]);return pt}}else{pt.pathRewrite=ct=>ct.replace(Rt.KEYS.PROXY_PATH_PREFIX,"")}return{proxy:(0,Mt.createProxyMiddleware)(pt),opt:pt,event:ut}}createProxyMap(ct){const ut={};for(const[pt,dt]of Object.entries(ct)){ut[pt]=this.createProxyConfig(dt)}return ut}setupProxy(){const ct=this.app.getAttr(Rt.KEYS.COMPHUB_CONFIG_KEY);if(jt.ProxyController.proxys){for(const ct of Object.values(jt.ProxyController.proxys)){ct.event.removeAllListeners()}}jt.ProxyController.proxys={};if(!ct.proxy)return;jt.ProxyController.proxys=this.createProxyMap(ct.proxy)}async buildConfig(ct){const ut=this.app.getEnv();const pt=ct.cwd||process.cwd();this.logger.info("cwd:",pt);this.logger.info("env:",ut);const dt={port:ct.port||Qt.DEFAULT_PORT,allowDebug:ct.allowDebug??false,api:ct.api||this.apiUrl,dir:ct.dir||"",cwd:pt,proxy:ct.proxy};const ft=At.join(this.websitePath,Rt.KEYS.WEBSITE_PATH_MAIN);const _t=At.join(pt,dt.dir||"").replace(/[\\/]$/,"");const mt=At.join(pt,Rt.KEYS.PREBUILD_MODULE_DIR);const ht=At.join(pt,"node_modules");await kt.promises.mkdir(mt,{recursive:true});const yt={websitePath:ft,prebuildModulePath:mt,cwd:pt,port:dt.port,srcPath:_t,remoteServer:dt.api,version:this.getVersion(),allowDebug:dt.allowDebug,proxy:dt.proxy,projectHash:It.default.createHash("sha256").update(pt).digest("hex").slice(0,8)};Ut.remoteInstance.defaults.baseURL=yt.remoteServer;if(ut===Rt.KEYS.LOCAL_MIDWAY_ENV_PROD){yt.port=await(0,Ft.default)({port:Ft.default.makeRange(yt.port,yt.port+100)})}this.appConfig=yt;const vt={dirs:{default:{prefix:`/${Rt.KEYS.WEBSITE_PATH_MAIN}`,dir:ft},[Rt.KEYS.MODULE_LOAD_PREFIX]:{prefix:Rt.KEYS.MODULE_LOAD_PREFIX,dir:mt,maxAge:0},[Rt.KEYS.NODE_MODULES_LOAD_PREFIX]:{prefix:Rt.KEYS.NODE_MODULES_LOAD_PREFIX,dir:ht,maxAge:0},[Rt.KEYS.COMP_PREVIEW_PREFIX_LOCAL]:{prefix:Rt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,dir:yt.srcPath,maxAge:0}}};try{await kt.promises.access(ft,kt.constants.F_OK)}catch(ct){this.logger.warn("websitePathMain 不存在:请先构建前端项目",(0,Jt.getErrorMessage)(ct));await kt.promises.mkdir(ft,{recursive:true})}if(ut===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await kt.promises.writeFile(At.join(__dirname,".comphubConfig.json"),JSON.stringify(yt,null,2))}return{koa:{port:yt.port},staticFile:vt,httpProxy:{strategy:{[Rt.KEYS.REMOTE_SERVICE_PREFIX]:{match:new RegExp(`^/${Rt.KEYS.REMOTE_SERVICE_PREFIX}/(.*)$`),target:`${yt.remoteServer}/$1`}}}}}async startSubPort(){const ct=this.app.getEnv();const ut=this.app.getAttr(Rt.KEYS.COMPHUB_CONFIG_KEY);const{port:pt,remoteServer:dt}=ut;let ft=await(0,Ft.default)({port:Ft.default.makeRange(pt,pt+100)});const _t=new Ot.default;_t.use((async(ct,ft)=>{if(ct.path.startsWith(Rt.KEYS.COMP_PREVIEW_PREFIX_LOCAL)){const{srcPath:pt}=ut;const dt=ct.path[0];const ft=ct.path.replace(Rt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,"");const _t=await Kt.locate.resolveBuildPath(ft,{baseDir:pt});if(_t){const ut=_t.replace(pt,"");const mt=Gt.textKit.replaceSlashWithSpecifiedSeparator(ut,dt);if(ft!==mt){const ut=mt.replace(ft,"");ct.redirect(ct.path+ut);return}}}const _t=[{prefix:`/${Rt.KEYS.REMOTE_SERVICE_PREFIX}`,target:dt,rewrite:{[`^/${Rt.KEYS.REMOTE_SERVICE_PREFIX}`]:""}},{prefix:`/${Rt.KEYS.LOCAL_SERVICE_PREFIX}`,target:`${Rt.KEYS.IFRAME_HOST}:${pt}`,rewrite:{[`^/${Rt.KEYS.LOCAL_SERVICE_PREFIX}`]:""}},{prefix:Rt.KEYS.MODULE_LOAD_PREFIX,target:`${Rt.KEYS.IFRAME_HOST}:${pt}`,rewrite:{}},{prefix:Rt.KEYS.NODE_MODULES_LOAD_PREFIX,target:`${Rt.KEYS.IFRAME_HOST}:${pt}`,rewrite:{}},{prefix:Rt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,target:`${Rt.KEYS.IFRAME_HOST}:${pt}`,rewrite:{}}];for(const ut of _t){if(ct.path.startsWith(ut.prefix)){await(0,zt.createKoaProxy)(ct,ut.target,ut.rewrite);return}}await ft()}));_t.use((0,Dt.default)(this.websitePath,{index:false}));_t.use((async ct=>{try{const ut=(()=>{if(ct.path.startsWith(`${Rt.KEYS.IFRAME_ITEM_WEBSITE_PATH}/`)){return Rt.KEYS.IFRAME_ITEM_WEBSITE_PATH}if(ct.path.startsWith(`${Rt.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}/`)){return Rt.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}return""})();const pt=At.join(this.websitePath,ut,"index.html");const dt=await kt.promises.readFile(pt,"utf-8");const _t=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify({subPort:ft})};<\/script>`;const mt=dt.replace("\x3c!--GLOBAL_CONFIG--\x3e",_t);ct.type="text/html; charset=utf-8";ct.status=200;ct.body=mt}catch(ut){this.logger.error("读取 index.html 失败:",ut);ct.status=500;ct.body="服务器内部错误"}}));await new Promise(((pt,dt)=>{let mt=0;const ht=_t.listen(ft,(()=>{this.subServer=ht;this.app.setAttr(Rt.KEYS.COMPHUB_CONFIG_KEY,{...ut,subPort:ft});if(process.send){process.send({type:"subPort",subPort:ft})}if(ct===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info(`子端口 ${ft} 已启动`)}pt()}));ht.on("error",(ct=>{if(ct.code==="EADDRINUSE"&&mt<Qt.MAX_SUB_PORT_RETRIES){mt++;this.logger.error(`子端口 ${ft} 被占用,正在尝试端口 ${++ft}`);ht.close();ht.listen(ft)}else{dt(ct)}}))}))}async printAccessInfo(ct){const ut=await ct.getAsync(St.Framework);const pt=ut.getServer();const dt=pt.address();const ft=this.app.getEnv();const _t=this.app.getAttr(Rt.KEYS.COMPHUB_CONFIG_KEY);this.logger.info("cwd:",_t.cwd);this.logger.info("env:",ft);this.logger.info("port:",_t.port);if(_t.subPort)this.logger.info("subPort:",_t.subPort);if(dt&&typeof dt!=="string"){const ct=dt.port;this.logger.info("Local Address:",`http://localhost:${ct}`);if(ft===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const ut=Kt.network.getLocalIPv4();if(ut)this.logger.info("Network Address:",`http://${ut}:${ct}`);this.logger.info("Swagger UI:",`http://localhost:${ct}/swagger-ui/index.html`)}}}async onConfigLoad(){const ct=await(0,Wt.waitForIpcConfig)();const ut=await this.buildConfig(ct);const pt=this.app.getEnv();if(pt===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await kt.promises.writeFile(At.join(__dirname,".start.json"),JSON.stringify(ut,null,2))}return ut}async onReady(){this.app.setAttr(Rt.KEYS.COMPHUB_CONFIG_KEY,this.appConfig);this.app.useMiddleware([Vt.ReportMiddleware]);this.app.useFilter([Bt.BadRequestErrorFilter,Lt.DefaultErrorFilter]);process.on("disconnect",(()=>{this.logger.info("Master process exited, shutting down...");if(this.subServer){this.subServer.close()}process.exit(0)}))}async onServerReady(ct){this.setupProxy();await this.startSubPort();await this.printAccessInfo(ct)}async onStop(){if(this.subServer){await new Promise((ct=>{this.subServer.close((()=>ct()))}));this.logger.info("子服务已关闭")}}};ut.MainConfiguration=Yt;_t([(0,vt.Logger)("coreLogger"),ht("design:type",Object)],Yt.prototype,"logger",void 0);_t([(0,vt.App)(),ht("design:type",Object)],Yt.prototype,"app",void 0);ut.MainConfiguration=Yt=_t([(0,vt.Configuration)({imports:[St,bt,$t,Ct,Tt,wt,Xt,{component:xt,enabledEnvironment:[Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL]},{component:Et,enabledEnvironment:[Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL]}],importConfigs:[{default:qt,local:Ht}]})],Yt)},64754:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t;Object.defineProperty(ut,"__esModule",{value:true});ut.ProxyController=void 0;const mt=pt(46123);const ht=pt(60449);const yt=ht.KEYS.PROXY_PATH_PREFIX;let vt=_t=class ProxyController{async proxy(){const ct=this.ctx.path.replace(yt,"");let ut=null;for(const[pt,dt]of Object.entries(_t.proxys)){const ft=new RegExp(pt);if(ft.test(ct)||ct.startsWith(pt)){ut=dt;break}}if(!ut){this.ctx.status=404;this.ctx.body={message:"Proxy not found"};return}const{proxy:pt,event:dt}=ut;await new Promise(((ct,ut)=>{pt(this.ctx.req,this.ctx.res);dt.on("error",ut);dt.on("proxyRes",ct)}))}};ut.ProxyController=vt;dt([(0,mt.Inject)(),ft("design:type",Object)],vt.prototype,"ctx",void 0);dt([(0,mt.All)("/*"),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],vt.prototype,"proxy",null);ut.ProxyController=vt=_t=dt([(0,mt.Controller)(yt,{ignoreGlobalPrefix:true})],vt)},17076:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SpaController=void 0;const yt=pt(46123);const vt=mt(pt(79896));const St=pt(16928);const bt=pt(49179);const xt=pt(63366);const $t=pt(60449);let Et=class SpaController{async index(){this.ctx.redirect(`/${$t.KEYS.WEBSITE_PATH_MAIN}/`)}async spa(){const ct=this.configService.comphubConfig();const{websitePath:ut}=ct;const pt=(0,St.resolve)(ut,"index.html");let dt=await vt.promises.readFile(pt,"utf-8");const ft=this.configService.getGlobalConfig();const{projectHash:_t}=ft;if(_t){dt=dt.replace(/<base[^>]*>/gi,"");dt=dt.replace("\x3c!--BASE_HREF--\x3e",`<base href="/${_t}/main/">`)}const mt=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify(ft)};<\/script>`;dt=dt.replace("\x3c!--GLOBAL_CONFIG--\x3e",mt);return dt}async getGlobalConfig(){return this.configService.getGlobalConfig()}};ut.SpaController=Et;_t([(0,yt.Inject)(),ht("design:type",Object)],Et.prototype,"ctx",void 0);_t([(0,yt.App)(),ht("design:type",Object)],Et.prototype,"app",void 0);_t([(0,yt.Inject)(),ht("design:type",xt.ConfigService)],Et.prototype,"configService",void 0);_t([(0,yt.Get)("/"),ht("design:type",Function),ht("design:paramtypes",[]),ht("design:returntype",Promise)],Et.prototype,"index",null);_t([(0,yt.Get)(`/${$t.KEYS.WEBSITE_PATH_MAIN}/*`),ht("design:type",Function),ht("design:paramtypes",[]),ht("design:returntype",Promise)],Et.prototype,"spa",null);_t([(0,yt.Get)($t.KEYS.GLOBAL_CONFIG_PATH),ht("design:type",Function),ht("design:paramtypes",[]),ht("design:returntype",Promise)],Et.prototype,"getGlobalConfig",null);ut.SpaController=Et=_t([(0,bt.ApiExcludeController)(),(0,yt.Controller)("/",{ignoreGlobalPrefix:true})],Et)},78805:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__param||function(ct,ut){return function(pt,dt){ut(pt,dt,ct)}};Object.defineProperty(ut,"__esModule",{value:true});ut.CompController=void 0;const mt=pt(46123);const ht=pt(48795);const yt=pt(63366);const vt=pt(49179);const St=pt(8131);const bt=pt(101);const xt=pt(19465);const $t=pt(93597);const Et=pt(6586);const Ct=(0,$t.createNoData)(vt.ApiProperty);let Tt=class CompController{async dir(ct){const ut=await this.compService.getCompDir(ct.compPath);return $t.resUtil.success(ut)}async file(ct){const{filePath:ut}=ct;const pt=await this.compService.getCompFile(ut);return $t.resUtil.success({content:pt})}async check(ct){const ut=await this.compService.checkCompConfig(ct.compPath);return $t.resUtil.success(ut)}async updateVersion(ct){const{compPath:ut,version:pt}=ct;await this.compService.updateCompVersion(ut,pt);return $t.resUtil.noData()}async generateCompJson(ct){const{compPath:ut}=ct;await this.compService.generateCompJson(ut);return $t.resUtil.noData()}async dep(ct){const{compPath:ut}=ct;const pt=await this.compService.getCompDep(ut);return $t.resUtil.success({thirdParty:pt})}async checkCompRepeat(ct){await Et.remoteApi.v1Token.tokencontrollerApproachexpire();const ut=await this.compService.checkCompRepeat(ct);return $t.resUtil.success(ut)}async submit(ct){await Et.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.submitComp(ct);return $t.resUtil.noData()}async update(ct){await Et.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.updateComp(ct);return $t.resUtil.noData()}async download(ct){const ut=await this.compService.downloadComp(ct);if(ut?.isRepeat){return $t.resUtil.success({isRepeat:true})}return $t.resUtil.success({isRepeat:false})}async localCompsByIds(ct){const{compIds:ut}=ct;const pt=await this.compService.getLocalCompsByIds(ut);return $t.resUtil.success({compInfos:pt})}async compFilesOssSignedUrl(ct){const ut=await this.compService.getCompFilesOssSignedUrl(ct);return $t.resUtil.success(ut)}async packageJson(){const ct=await this.compService.getPackageJsonContent();return $t.resUtil.success({packageJson:ct})}async compFileHash(ct){const ut=await this.compService.getCompFileHash(ct);return $t.resUtil.success(ut)}async localComps(ct){const ut=await this.compService.getLocalComps(ct);return $t.resUtil.success(ut)}async openCompPathInVscode(ct){await this.compService.openCompPathInVscode(ct);return $t.resUtil.noData()}async localCompDetailByPathHash(ct){const ut=await this.compService.getLocalCompDetailByPathHash(ct);return $t.resUtil.success(ut)}async writeFile(ct){await this.compService.writeCompFile(ct);return $t.resUtil.noData()}};ut.CompController=Tt;dt([(0,mt.App)(),ft("design:type",Object)],Tt.prototype,"app",void 0);dt([(0,mt.Inject)(),ft("design:type",ht.CompService)],Tt.prototype,"compService",void 0);dt([(0,mt.Inject)(),ft("design:type",yt.ConfigService)],Tt.prototype,"configService",void 0);dt([(0,vt.ApiOperation)({summary:"获取组件目录"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompFileVO)}),(0,mt.Post)("/dir"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompDirDTO]),ft("design:returntype",Promise)],Tt.prototype,"dir",null);dt([(0,vt.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompFileContentVO)}),(0,mt.Post)("/file"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompFileDTO]),ft("design:returntype",Promise)],Tt.prototype,"file",null);dt([(0,vt.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompCheckVO)}),(0,mt.Post)("/check"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompCheckDTO]),ft("design:returntype",Promise)],Tt.prototype,"check",null);dt([(0,vt.ApiOperation)({summary:"更新组件版本号"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/updateVersion"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.UpdateVersionDTO]),ft("design:returntype",Promise)],Tt.prototype,"updateVersion",null);dt([(0,vt.ApiOperation)({summary:"生成组件指纹文件"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/generateCompJson"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.GenerateCompJsonDTO]),ft("design:returntype",Promise)],Tt.prototype,"generateCompJson",null);dt([(0,vt.ApiOperation)({summary:"获取组件依赖关系"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.ImportScanResultVO)}),(0,mt.Post)("/dep"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.DepDTO]),ft("design:returntype",Promise)],Tt.prototype,"dep",null);dt([(0,vt.ApiOperation)({summary:"检查组件是否重复"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompSimilarListVO)}),(0,mt.Post)("/checkCompRepeat",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CheckCompRepeatDTO]),ft("design:returntype",Promise)],Tt.prototype,"checkCompRepeat",null);dt([(0,vt.ApiOperation)({summary:"提交组件"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/submit",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.SubmitCompDTO]),ft("design:returntype",Promise)],Tt.prototype,"submit",null);dt([(0,vt.ApiOperation)({summary:"更新组件"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/update",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.UpdateCompDTO]),ft("design:returntype",Promise)],Tt.prototype,"update",null);dt([(0,vt.ApiOperation)({summary:"下载组件"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.DownloadCompVO)}),(0,mt.Post)("/download",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.DownloadCompDTO]),ft("design:returntype",Promise)],Tt.prototype,"download",null);dt([(0,vt.ApiOperation)({summary:"通过ids在本地查询组件"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.LocalCompsByIdsVO)}),(0,mt.Post)("/localCompsByIds"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.LocalCompsByIdsDTO]),ft("design:returntype",Promise)],Tt.prototype,"localCompsByIds",null);dt([(0,vt.ApiOperation)({summary:"获取组件文件夹下所有文件的oss签名访问地址"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompFilesOssSignedUrlVO)}),(0,mt.Post)("/compFilesOssSignedUrl",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompFilesOssSignedUrlDTO]),ft("design:returntype",Promise)],Tt.prototype,"compFilesOssSignedUrl",null);dt([(0,vt.ApiOperation)({summary:"获取package.json"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.PackageJsonVO)}),(0,mt.Post)("/packageJson"),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],Tt.prototype,"packageJson",null);dt([(0,vt.ApiOperation)({summary:"获取组件文件hash"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompFileHashVO)}),(0,mt.Post)("/compFileHash"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompFileHashDTO]),ft("design:returntype",Promise)],Tt.prototype,"compFileHash",null);dt([(0,vt.ApiOperation)({summary:"获取本地组件列表,分页查询"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,(0,$t.createListWrapper)(vt.ApiProperty,bt.LocalCompsVO))}),(0,mt.Post)("/localComps",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.LocalCompsDTO]),ft("design:returntype",Promise)],Tt.prototype,"localComps",null);dt([(0,vt.ApiOperation)({summary:"通过组件路径打开在vscode中打开所在文件夹"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/openCompPathInVscode"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.OpenCompPathInVscodeDTO]),ft("design:returntype",Promise)],Tt.prototype,"openCompPathInVscode",null);dt([(0,vt.ApiOperation)({summary:"通过组件完整文件路径hash获取组件信息"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.LocalCompDetailVO)}),(0,mt.Post)("/localCompDetailByPathHash"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.LocalCompDetailByPathHashDTO]),ft("design:returntype",Promise)],Tt.prototype,"localCompDetailByPathHash",null);dt([(0,vt.ApiOperation)({summary:"写入文件到组件目录"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/writeFile"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompWriteFileDTO]),ft("design:returntype",Promise)],Tt.prototype,"writeFile",null);ut.CompController=Tt=dt([(0,vt.ApiTags)(["v1-comp"]),(0,mt.Controller)("/v1/comp")],Tt)},91308:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__param||function(ct,ut){return function(pt,dt){ut(pt,dt,ct)}};Object.defineProperty(ut,"__esModule",{value:true});ut.ModuleController=void 0;const mt=pt(46123);const ht=pt(49179);const yt=pt(85984);const vt=pt(19428);const St=pt(71692);const bt=pt(61275);const xt=pt(93597);const $t=(0,xt.createNoData)(ht.ApiProperty);let Et=class ModuleController{async preBuild(ct){const{deps:ut}=ct;let pt=null;await this.queueService.enqueue((async()=>{pt=await this.moduleService.preBuild(ut)}));return xt.resUtil.success(pt)}async preBuildSize(){const ct=await this.moduleService.preBuildSize();return xt.resUtil.success({size:ct})}async clearPreBuild(){await this.moduleService.clearPreBuild();return xt.resUtil.noData()}};ut.ModuleController=Et;dt([(0,mt.Inject)(),ft("design:type",yt.ModuleService)],Et.prototype,"moduleService",void 0);dt([(0,mt.Inject)(),ft("design:type",bt.QueueService)],Et.prototype,"queueService",void 0);dt([(0,ht.ApiOperation)({summary:"模块预构建"}),(0,ht.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(ht.ApiProperty,St.PreBuildVO)}),(0,mt.Post)("/preBuild"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[vt.PreBuildDTO]),ft("design:returntype",Promise)],Et.prototype,"preBuild",null);dt([(0,ht.ApiOperation)({summary:"获取预构建模块文件总大小"}),(0,ht.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(ht.ApiProperty,St.PreBuildSizeVO)}),(0,mt.Post)("/preBuildSize"),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],Et.prototype,"preBuildSize",null);dt([(0,ht.ApiOperation)({summary:"清除预构建模块文件"}),(0,ht.ApiResponse)({status:200,description:"返回结果",type:$t}),(0,mt.Post)("/clearPreBuild"),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],Et.prototype,"clearPreBuild",null);ut.ModuleController=Et=dt([(0,ht.ApiTags)(["v1-module"]),(0,mt.Controller)("/v1/module")],Et)},5387:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__param||function(ct,ut){return function(pt,dt){ut(pt,dt,ct)}};Object.defineProperty(ut,"__esModule",{value:true});ut.OssController=void 0;const mt=pt(46123);const ht=pt(49179);const yt=pt(93597);const vt=pt(56415);const St=pt(75049);const bt=pt(80799);const xt=pt(19465);let $t=class OssController{async fileSignUrl(ct){const{objectId:ut}=ct;const pt=await this.ossService.getDownloadSts();const dt=await this.ossService.getFilePreviewUrl(pt,ut);return yt.resUtil.success({signUrl:dt})}};ut.OssController=$t;dt([(0,mt.App)(),ft("design:type",Object)],$t.prototype,"app",void 0);dt([(0,mt.Inject)(),ft("design:type",bt.OssService)],$t.prototype,"ossService",void 0);dt([(0,ht.ApiOperation)({summary:"获取文件访问地址",description:"获取文件访问地址"}),(0,ht.ApiResponse)({status:200,description:"返回结果",type:(0,yt.createSuccessWrapper)(ht.ApiProperty,St.SignedUrlVO)}),(0,mt.Post)("/fileSignUrl",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[vt.SignedUrlDTO]),ft("design:returntype",Promise)],$t.prototype,"fileSignUrl",null);ut.OssController=$t=dt([(0,ht.ApiTags)(["v1-oss"]),(0,mt.Controller)("/v1/oss")],$t)},6444:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__param||function(ct,ut){return function(pt,dt){ut(pt,dt,ct)}};Object.defineProperty(ut,"__esModule",{value:true});ut.PreprocessingController=void 0;const mt=pt(49179);const ht=pt(46123);const yt=pt(90218);const vt=pt(18922);const St=pt(5578);const bt=pt(93597);let xt=class PreprocessingController{async preprocess(ct){const ut=await this.preprocessingService.preprocessCode(ct);return bt.resUtil.success({preprocessedCode:ut})}};ut.PreprocessingController=xt;dt([(0,ht.Inject)(),ft("design:type",St.PreprocessingService)],xt.prototype,"preprocessingService",void 0);dt([(0,mt.ApiOperation)({summary:"css预处理",description:"预处理css代码"}),(0,mt.ApiResponse)({status:200,description:"返回结果",type:(0,bt.createSuccessWrapper)(mt.ApiProperty,vt.PreprocessedCodeVO)}),(0,ht.Post)("/preprocess"),_t(0,(0,ht.Body)()),ft("design:type",Function),ft("design:paramtypes",[yt.PreprocessingDTO]),ft("design:returntype",Promise)],xt.prototype,"preprocess",null);ut.PreprocessingController=xt=dt([(0,mt.ApiTags)(["v1-preprocessing"]),(0,ht.Controller)("/v1/preprocessing")],xt)},20346:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__param||function(ct,ut){return function(pt,dt){ut(pt,dt,ct)}};Object.defineProperty(ut,"__esModule",{value:true});ut.VuefinderController=void 0;const mt=pt(46123);const ht=pt(5808);const yt=pt(49179);const vt=pt(23444);let St=class VuefinderController{async list(ct){const ut=await this.vuefinderService.list(ct);return ut}};ut.VuefinderController=St;dt([(0,mt.App)(),ft("design:type",Object)],St.prototype,"app",void 0);dt([(0,mt.Inject)(),ft("design:type",ht.VuefinderService)],St.prototype,"vuefinderService",void 0);dt([(0,yt.ApiOperation)({summary:"list"}),(0,mt.Get)("/list"),_t(0,(0,mt.Query)()),ft("design:type",Function),ft("design:paramtypes",[vt.VueFinderIndexDTO]),ft("design:returntype",Promise)],St.prototype,"list",null);ut.VuefinderController=St=dt([(0,yt.ApiTags)(["v1-vuefinder"]),(0,mt.Controller)("/v1/vuefinder")],St)},60149:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.BasePageDTO=void 0;const _t=pt(49179);const mt=pt(99375);class BasePageDTO{}ut.BasePageDTO=BasePageDTO;dt([(0,_t.ApiProperty)({example:1,description:"当前页码",required:false}),(0,mt.Rule)(mt.RuleType.number().min(1)),ft("design:type",Number)],BasePageDTO.prototype,"page",void 0);dt([(0,_t.ApiProperty)({example:10,description:"每页数量",required:false}),(0,mt.Rule)(mt.RuleType.number().min(1).max(50)),ft("design:type",Number)],BasePageDTO.prototype,"pageSize",void 0);dt([(0,mt.Rule)(mt.RuleType.string().allow("").max(50).pattern(/\{\s*\$\w+:/i,{invert:true}).trim()),(0,_t.ApiProperty)({example:"小明",description:"关键词",required:false}),ft("design:type",String)],BasePageDTO.prototype,"keyword",void 0)},8131:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.CompWriteFileDTO=ut.LocalCompDetailByPathHashDTO=ut.OpenCompPathInVscodeDTO=ut.LocalCompsDTO=ut.CompFilesOssSignedUrlDTO=ut.DownloadCompDTO=ut.UpdateCompDTO=ut.SubmitCompDTO=ut.CompFileDTO=ut.UpdateVersionDTO=ut.CompFileHashDTO=ut.CheckCompRepeatDTO=ut.LocalCompsByIdsDTO=ut.DepDTO=ut.GenerateCompJsonDTO=ut.CompCheckDTO=ut.CompDirDTO=void 0;const _t=pt(49179);const mt=pt(99375);const ht=pt(60449);const yt=pt(60149);class CompPathDTO{}dt([(0,_t.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompPathDTO.prototype,"compPath",void 0);class CompIdDTO{}dt([(0,_t.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompIdDTO.prototype,"compId",void 0);class CompDirDTO extends CompPathDTO{}ut.CompDirDTO=CompDirDTO;class CompCheckDTO extends CompPathDTO{}ut.CompCheckDTO=CompCheckDTO;class GenerateCompJsonDTO extends CompPathDTO{}ut.GenerateCompJsonDTO=GenerateCompJsonDTO;class DepDTO extends CompPathDTO{}ut.DepDTO=DepDTO;class LocalCompsByIdsDTO{}ut.LocalCompsByIdsDTO=LocalCompsByIdsDTO;dt([(0,_t.ApiProperty)({type:[String],required:true,description:"组件id列表",example:["123","456"]}),(0,mt.Rule)(mt.RuleType.array().required().items(mt.RuleType.string())),ft("design:type",Array)],LocalCompsByIdsDTO.prototype,"compIds",void 0);class CheckCompRepeatDTO extends CompPathDTO{}ut.CheckCompRepeatDTO=CheckCompRepeatDTO;dt([(0,_t.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,mt.Rule)(mt.RuleType.string()),ft("design:type",String)],CheckCompRepeatDTO.prototype,"teamId",void 0);class CompFileHashDTO extends CompPathDTO{}ut.CompFileHashDTO=CompFileHashDTO;class UpdateVersionDTO extends CompPathDTO{}ut.UpdateVersionDTO=UpdateVersionDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],UpdateVersionDTO.prototype,"version",void 0);class CompFileDTO{}ut.CompFileDTO=CompFileDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompFileDTO.prototype,"filePath",void 0);class PreviewItemDTO{}dt([(0,_t.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),(0,mt.Rule)(mt.RuleType.array().required().items(mt.RuleType.string())),ft("design:type",Array)],PreviewItemDTO.prototype,"miniPath",void 0);dt([(0,_t.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),(0,mt.Rule)(mt.RuleType.array().optional().items(mt.RuleType.string())),ft("design:type",Array)],PreviewItemDTO.prototype,"fullPath",void 0);dt([(0,_t.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),(0,mt.Rule)(mt.RuleType.string()),ft("design:type",String)],PreviewItemDTO.prototype,"desc",void 0);class ParentDTO{}dt([(0,_t.ApiProperty)({description:"父库名称",required:true,example:"vue"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],ParentDTO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],ParentDTO.prototype,"version",void 0);class DepItemDTO{}dt([(0,_t.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],DepItemDTO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],DepItemDTO.prototype,"version",void 0);dt([(0,_t.ApiProperty)({type:ParentDTO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),(0,mt.Rule)(mt.RuleType.object().optional()),ft("design:type",ParentDTO)],DepItemDTO.prototype,"parent",void 0);class SubmitCompDTO{}ut.SubmitCompDTO=SubmitCompDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],SubmitCompDTO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],SubmitCompDTO.prototype,"compPath",void 0);dt([(0,_t.ApiProperty)({type:[DepItemDTO],required:true,description:"组件依赖"}),(0,mt.Rule)(mt.RuleType.array().required()),ft("design:type",Array)],SubmitCompDTO.prototype,"dep",void 0);dt([(0,_t.ApiProperty)({type:[PreviewItemDTO],required:true,description:"组件预览数据"}),(0,mt.Rule)(mt.RuleType.array().required()),ft("design:type",Array)],SubmitCompDTO.prototype,"previewConfigs",void 0);dt([(0,_t.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],SubmitCompDTO.prototype,"desc",void 0);dt([(0,_t.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),(0,mt.Rule)(mt.RuleType.string().empty("").default("")),ft("design:type",String)],SubmitCompDTO.prototype,"bgColor",void 0);dt([(0,_t.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,mt.Rule)(mt.RuleType.string()),ft("design:type",String)],SubmitCompDTO.prototype,"teamId",void 0);dt([(0,_t.ApiProperty)({required:false,description:"组件标签",example:["hooks","图表"],type:[String]}),(0,mt.Rule)(mt.RuleType.array().items(mt.RuleType.string())),ft("design:type",Array)],SubmitCompDTO.prototype,"tags",void 0);class UpdateCompDTO extends SubmitCompDTO{}ut.UpdateCompDTO=UpdateCompDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],UpdateCompDTO.prototype,"compId",void 0);dt([(0,_t.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,mt.Rule)(mt.RuleType.string()),ft("design:type",String)],UpdateCompDTO.prototype,"teamId",void 0);dt([(0,_t.ApiProperty)({required:false,description:"组件升级描述",example:"升级组件描述"}),(0,mt.Rule)(mt.RuleType.string().allow("").max(200)),ft("design:type",String)],UpdateCompDTO.prototype,"upgradeDesc",void 0);class DownloadCompDTO extends CompIdDTO{}ut.DownloadCompDTO=DownloadCompDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],DownloadCompDTO.prototype,"savePath",void 0);dt([(0,_t.ApiProperty)({required:false,description:"是否覆盖",example:true}),(0,mt.Rule)(mt.RuleType.boolean().default(false)),ft("design:type",Boolean)],DownloadCompDTO.prototype,"isCover",void 0);dt([(0,_t.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],DownloadCompDTO.prototype,"compName",void 0);dt([(0,_t.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],DownloadCompDTO.prototype,"version",void 0);class CompFilesOssSignedUrlDTO{}ut.CompFilesOssSignedUrlDTO=CompFilesOssSignedUrlDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"version",void 0);dt([(0,_t.ApiProperty)({required:true,description:"对象存储id",example:"123"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"objectId",void 0);dt([(0,_t.ApiProperty)({type:[String],required:true,description:"组件文件路径",example:"MyComp/index.vue"}),(0,mt.Rule)(mt.RuleType.array().required().items(mt.RuleType.string())),ft("design:type",Array)],CompFilesOssSignedUrlDTO.prototype,"files",void 0);class LocalCompsDTO extends yt.BasePageDTO{}ut.LocalCompsDTO=LocalCompsDTO;class OpenCompPathInVscodeDTO{}ut.OpenCompPathInVscodeDTO=OpenCompPathInVscodeDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],OpenCompPathInVscodeDTO.prototype,"folderPath",void 0);dt([(0,_t.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],OpenCompPathInVscodeDTO.prototype,"relativeFilePath",void 0);class LocalCompDetailByPathHashDTO{}ut.LocalCompDetailByPathHashDTO=LocalCompDetailByPathHashDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件完整文件路径hash",example:"1234567890"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],LocalCompDetailByPathHashDTO.prototype,"fullPathHash",void 0);class CompWriteFileDTO{}ut.CompWriteFileDTO=CompWriteFileDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompWriteFileDTO.prototype,"compPath",void 0);dt([(0,_t.ApiProperty)({required:true,description:"文件名",example:ht.KEYS.COMP_SCREENSHOT_MINI_FILENAME}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompWriteFileDTO.prototype,"filename",void 0);dt([(0,_t.ApiProperty)({required:true,description:"文件内容(base64,不含前缀)",example:"iVBORw0KGgo..."}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompWriteFileDTO.prototype,"content",void 0)},19428:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.PreBuildDTO=void 0;const _t=pt(49179);const mt=pt(99375);class PreBuildDTO{}ut.PreBuildDTO=PreBuildDTO;dt([(0,_t.ApiProperty)({type:[String],required:true,description:"组件依赖",example:["axios","md5"]}),(0,mt.Rule)(mt.RuleType.array().required().items(mt.RuleType.string())),ft("design:type",Array)],PreBuildDTO.prototype,"deps",void 0)},56415:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SignedUrlDTO=void 0;const _t=pt(49179);const mt=pt(99375);class SignedUrlDTO{}ut.SignedUrlDTO=SignedUrlDTO;dt([(0,mt.Rule)(mt.RuleType.string().required().error(new Error("对象id不能为空"))),(0,_t.ApiProperty)({example:"",description:"对象id",required:true}),ft("design:type",String)],SignedUrlDTO.prototype,"objectId",void 0)},90218:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.PreprocessingDTO=void 0;const _t=pt(49179);const mt=pt(99375);const ht=pt(34985);class PreprocessingDTO{}ut.PreprocessingDTO=PreprocessingDTO;dt([(0,_t.ApiProperty)({description:"css代码",required:true,example:"body { color: red; }"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],PreprocessingDTO.prototype,"cssCode",void 0);dt([(0,_t.ApiProperty)({enum:ht.PrecompilerEnum,example:ht.PrecompilerEnum.SASS,description:"预编译器类型",required:false}),(0,mt.Rule)(mt.RuleType.string().valid(...Object.values(ht.PrecompilerEnum))),ft("design:type",String)],PreprocessingDTO.prototype,"precompilerType",void 0)},23444:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.VueFinderIndexDTO=void 0;const _t=pt(49179);const mt=pt(99375);class VueFinderIndexDTO{}ut.VueFinderIndexDTO=VueFinderIndexDTO;dt([(0,_t.ApiProperty)({required:false,description:"文件路径"}),(0,mt.Rule)(mt.RuleType.string()),ft("design:type",String)],VueFinderIndexDTO.prototype,"path",void 0)},59416:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.BadRequestErrorFilter=void 0;const ft=pt(46123);const _t=pt(93597);const mt=pt(60449);let ht=class BadRequestErrorFilter{async catch(ct,ut){const pt=ut.app.getEnv();if(pt===mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ut.logger.error("BadRequestErrorFilter==>",ct)}return _t.resUtil.error(ct.message,ct.status)}};ut.BadRequestErrorFilter=ht;ut.BadRequestErrorFilter=ht=dt([(0,ft.Catch)(ft.httpError.BadRequestError)],ht)},54633:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.DefaultErrorFilter=void 0;const ft=pt(46123);const _t=pt(60449);let mt=class DefaultErrorFilter{async catch(ct,ut){const pt=ut.app.getEnv();try{const ut=JSON.parse(ct.message);return{...ut}}catch(ct){if(pt===_t.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ut.logger.error("解析错误信息失败==>",ct.message,"\n")}}finally{if(pt===_t.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ut.logger.error("原始错误==>",ct)}}ut.status=ct.status??500;return{code:ct.status??500,message:ct.message??"未知错误"}}};ut.DefaultErrorFilter=mt;ut.DefaultErrorFilter=mt=dt([(0,ft.Catch)()],mt)},15545:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=void 0;var _t=pt(12799);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.MainConfiguration}});ft(pt(14071),ut);ft(pt(91921),ut);ft(pt(64754),ut);ft(pt(17076),ut);ft(pt(78805),ut);ft(pt(91308),ut);ft(pt(5387),ut);ft(pt(6444),ut);ft(pt(20346),ut);ft(pt(60149),ut);ft(pt(8131),ut);ft(pt(19428),ut);ft(pt(56415),ut);ft(pt(34985),ut);ft(pt(90218),ut);ft(pt(23444),ut);ft(pt(59416),ut);ft(pt(54633),ut);ft(pt(9711),ut);ft(pt(53951),ut);ft(pt(77523),ut);ft(pt(61142),ut);ft(pt(19465),ut);ft(pt(95637),ut);ft(pt(48795),ut);ft(pt(63366),ut);ft(pt(23086),ut);ft(pt(85984),ut);ft(pt(80799),ut);ft(pt(5578),ut);ft(pt(61275),ut);ft(pt(19452),ut);ft(pt(5808),ut);ft(pt(66593),ut);ft(pt(58953),ut);ft(pt(10778),ut);ft(pt(101),ut);ft(pt(71692),ut);ft(pt(75049),ut);ft(pt(18922),ut)},9711:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},53951:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},34985:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.PrecompilerEnum=void 0;var pt;(function(ct){ct["LESS"]="less";ct["SASS"]="sass";ct["SCSS"]="scss"})(pt||(ut.PrecompilerEnum=pt={}))},77523:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},61142:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.ReportMiddleware=void 0;const ft=pt(46123);let _t=class ReportMiddleware{resolve(){return async(ct,ut)=>{const pt=Date.now();const dt=await ut();const ft=ct.url;ct.logger.debug(`请求 ${ft} 耗时 = ${Date.now()-pt}ms`);return dt}}static getName(){return"report"}};ut.ReportMiddleware=_t;ut.ReportMiddleware=_t=dt([(0,ft.Middleware)()],_t)},19465:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.TokenMiddleware=void 0;const ft=pt(46123);const _t=pt(10778);let mt=class TokenMiddleware{resolve(){return async(ct,ut)=>{(0,_t.setHeader)(ct.header);await ut()}}static getName(){return"token"}};ut.TokenMiddleware=mt;ut.TokenMiddleware=mt=dt([(0,ft.Middleware)()],mt)},95637:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.CommandService=void 0;const mt=pt(46123);const ht=_t(pt(79896));const yt=pt(63366);const vt=pt(94798);const St=_t(pt(16928));const bt=pt(68255);let xt=class CommandService{async revealInVSCode(ct,ut,pt=1,dt=1){const{cwd:ft}=this.configService.comphubConfig();if(!ct||!ht.default.existsSync(ct)||!ht.default.statSync(ct).isDirectory()){throw new mt.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist"))}const _t=St.default.resolve(ct,ut);if(!ht.default.existsSync(_t)||ht.default.statSync(_t).isDirectory()){throw new mt.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist"))}(0,vt.launchIDE)({file:ft});(0,vt.launchIDE)({file:_t,line:pt,column:dt})}};ut.CommandService=xt;dt([(0,mt.Inject)(),ft("design:type",yt.ConfigService)],xt.prototype,"configService",void 0);dt([(0,mt.Inject)(),ft("design:type",Object)],xt.prototype,"ctx",void 0);dt([(0,mt.Inject)(),ft("design:type",bt.MidwayI18nService)],xt.prototype,"i18nService",void 0);ut.CommandService=xt=dt([(0,mt.Provide)()],xt)},48795:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.CompService=void 0;const yt=pt(46123);const vt=mt(pt(16928));const St=mt(pt(79896));const bt=pt(63366);const xt=pt(23086);const $t=pt(80799);const Et=mt(pt(70857));const Ct=mt(pt(83929));const Tt=pt(39538);const wt=pt(84464);const At=pt(95637);const kt=pt(60449);const It=pt(21739);const Nt=pt(6586);const Pt=pt(68255);let Ot=class CompService{getCompFullPath(ct){const{srcPath:ut}=this.configService.comphubConfig();ct=ct.replace(kt.KEYS.FILE_MANAGER_DIRNAME,"");const pt=vt.join(ut,ct);return pt}checkCompEntryIndex(ct){const ut=vt.join(ct,kt.KEYS.COMP_USE_ENTRY_FILE);if(!St.existsSync(ut)){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[kt.KEYS.COMP_USE_ENTRY_FILE]}))}}checkCompJson(ct){const ut=this.getCompFullPath(ct);const pt=vt.join(ut,kt.KEYS.COMP_CONFIG_FILENAME);if(!St.existsSync(pt)){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.configFileNotExist"))}}checkCompJsonFormat(ct){const ut=Object.keys(ct);const pt=kt.ARRAY.COMP_DEFAULT_FIELD.every((ct=>!ct.required||ut.includes(ct.name)));if(!pt)return false;return It.versionKit.validateVersion(ct.version)}async updateCompJson(ct,ut){const pt=this.getCompFullPath(ct);const dt=vt.join(pt,kt.KEYS.COMP_CONFIG_FILENAME);const ft=await this.getCompFile(dt);const _t=ut(JSON.parse(ft));await St.promises.writeFile(dt,JSON.stringify(_t,null,4))}async readCompVersion(ct){const ut=vt.join(ct,kt.KEYS.COMP_CONFIG_FILENAME);const pt=await this.getCompFile(ut);const dt=JSON.parse(pt);return dt.version}initCompJson(){return kt.ARRAY.COMP_DEFAULT_FIELD.reduce(((ct,ut)=>{const pt={};if(ut.required){pt[ut.name]=ut.default}return{...ct,...pt}}),{})}async uploadCompFolderToOss({compFullPath:ct,version:ut,ossData:pt}){const{files:dt}=await Tt.fileTree.generateTree(ct);const ft=dt.map((({absolutePath:ut,size:pt})=>{const dt=ut.replace(ct,"");return{filePath:dt,fileFullPath:ut,size:pt??0}}));ft.sort(((ct,ut)=>ut.size-ct.size));for(let ct=0;ct<ft.length;ct++){const{filePath:dt,fileFullPath:_t}=ft[ct];const mt=vt.join(pt.key,ut,dt);const ht={...pt,key:mt.replace(new RegExp(It.textKit.escapeRegExp(vt.sep),"g"),"/")};const yt=St.createReadStream(_t);await this.ossService.uploadFileToOss(ht,yt)}}async getCompHash(ct){const ut=await Tt.digest.getFileHashList(ct);const pt=ut.map((ct=>`${ct.relativePath}-${ct.hash}`)).join(";");return Tt.digest.getStringHash(pt)}async getCompFeatures(ct){const ut=await Tt.digest.getFileHashAndSsdeepList(ct);const pt=ut.map((ct=>{const ut=(0,wt.omit)(ct,["relativePath"]);return{...ut,path:ct.relativePath}}));const dt=await Tt.digest.getRelativeDirList(ct);const ft=JSON.stringify(dt);const _t=Tt.digest.getStringFuzzyHash(ft);const mt=await this.getCompHash(ct);return{fileHashList:pt,compHash:mt,dirHash:Tt.digest.getStringHash(ft),dirSsdeep:Tt.digest.getSsdeepStruct(_t)}}async getCompFileList(ct){const{files:ut}=await Tt.fileTree.generateTree(ct,{withStats:true,calculateSize:true});const pt=ut.map((({name:ut,size:pt,absolutePath:dt})=>({name:ut,size:pt??0,path:dt.replace(ct,"").replace(new RegExp(It.textKit.escapeRegExp(vt.sep),"g"),"/")})));return pt}checkCompFileSize(ct){if(ct>kt.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSizeExceeded",{args:[Math.floor(kt.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE/1024/1024).toString()]}))}}checkCompFileNum(ct){if(ct>kt.KEYS.COMP_SUBMIT_MAX_FILE_COUNT){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitFileCountExceeded",{args:[kt.KEYS.COMP_SUBMIT_MAX_FILE_COUNT.toString()]}))}}checkCompSingleFileSize(ct){const ut=kt.KEYS.COMP_SUBMIT_MAX_SINGLE_FILE_SIZE;const pt=Math.floor(ut/1024/1024);for(const dt of ct){if(dt.size>ut){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSingleFileSizeExceeded",{args:[dt.path,pt.toString()]}))}}}async findCompJsonPath(ct){const{files:ut}=await Tt.fileTree.generateTree(ct,{ignore:["node_modules"]});this.ctx.logger.debug("项目文件数量:",ut.length);const pt=ut.filter((({absolutePath:ct})=>ct.endsWith(kt.KEYS.COMP_CONFIG_FILENAME)));return pt}async getAllLocalCompIds(){const{srcPath:ct}=this.configService.comphubConfig();const ut=await this.findCompJsonPath(ct);this.ctx.logger.debug("组件文件数量:",ut.length);const pt=ut.map((async({absolutePath:ct})=>{const ut=await St.promises.readFile(ct,"utf8");const pt=JSON.parse(ut);const dt=this.checkCompJsonFormat(pt);const ft=vt.dirname(ct);return{compjson:pt,isCompHub:dt,compPath:ft,pathHash:Tt.digest.getStringHash(ft)}}));const dt=await Promise.all(pt);return dt.filter((ct=>ct.isCompHub&&ct.compjson.__id__))}async getCompDir(ct){const{srcPath:ut}=this.configService.comphubConfig();const pt=vt.join(ct.replace(kt.KEYS.FILE_MANAGER_DIRNAME,`${ut}${vt.sep}`));const{tree:dt,files:ft}=await Tt.fileTree.generateTree(pt,{sortBy:"type"});const _handleTree=ct=>{const ut={name:ct.name,path:ct.absolutePath,type:ct.type};if(ct.children&&ct.children.length>0){ut.children=ct.children.map((ct=>_handleTree(ct)))}return ut};return{tree:_handleTree(dt),files:ft.map((ct=>ct.absolutePath))}}async getCompFile(ct){const ut=await St.promises.readFile(ct,"utf-8");return ut}async checkCompConfig(ct){const ut=vt.basename(ct);const pt=this.getCompFullPath(ct);try{this.checkCompEntryIndex(pt)}catch(ct){this.ctx.logger.error("检查组件入口文件index.vue失败",ct);return{errorMsg:"组件入口文件index.vue不存在"}}const dt=vt.join(ut,kt.KEYS.COMP_USE_ENTRY_FILE);try{this.checkCompJson(ct)}catch(ct){this.ctx.logger.error("检查组件配置文件comp.json失败",ct);return{entryIndexPath:dt,errorMsg:"组件配置文件comp.json不存在"}}const ft=vt.join(ut,kt.KEYS.COMP_CONFIG_FILENAME);try{const ut=vt.join(this.getCompFullPath(ct),kt.KEYS.COMP_CONFIG_FILENAME);const pt=await this.getCompFile(ut);const _t=this.checkCompJsonFormat(JSON.parse(pt));if(!_t){return{entryIndexPath:dt,compJsonPath:ft,errorMsg:"comp.json文件格式错误"}}}catch(ct){this.ctx.logger.error("读取组件配置文件comp.json失败",ct);return{entryIndexPath:dt,compJsonPath:ft,errorMsg:"读取comp.json文件失败"}}return{entryIndexPath:dt,compJsonPath:ft,errorMsg:""}}async updateCompVersion(ct,ut){const pt=It.versionKit.validateVersion(ut);if(!pt){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidVersionFormat"))}const dt=this.getCompFullPath(ct);const ft=vt.join(dt,kt.KEYS.COMP_CONFIG_FILENAME);const _t=await this.getCompFile(ft);const mt=JSON.parse(_t);mt.version=ut;const ht=JSON.stringify(mt,null,2);await St.promises.writeFile(ft,ht)}async generateCompJson(ct){const ut=this.getCompFullPath(ct);const pt=vt.basename(ut);const dt=this.initCompJson();dt.name=pt;await St.promises.writeFile(vt.join(ut,kt.KEYS.COMP_CONFIG_FILENAME),JSON.stringify(dt,null,4))}async getCompDep(ct){const{cwd:ut}=this.configService.comphubConfig();const pt=this.getCompFullPath(ct);const dt=await this.depsService.getModuleEntry(pt,ut);return dt}async getCompFileHash(ct){const{compPath:ut}=ct;const pt=this.getCompFullPath(ut);const dt=await this.getCompFeatures(pt);return{compHash:dt.compHash}}async checkCompRepeat(ct){const{compPath:ut,teamId:pt}=ct;const dt=this.getCompFullPath(ut);const ft=await this.getCompFeatures(dt);const _t=await Nt.remoteApi.v1Comp.compcontrollerCheckcompexistbyhash(ft,{headers:{"team-id":pt}});return _t.data}async submitComp(ct){let ut="";let pt={};try{const{compPath:dt,dep:ft,previewConfigs:_t,desc:mt,bgColor:ht,name:yt,teamId:vt,tags:St}=ct;pt={"team-id":vt};this.checkCompJson(dt);const bt=this.getCompFullPath(dt);const xt=await this.getCompFeatures(bt);this.checkCompEntryIndex(bt);const $t=await this.readCompVersion(bt);const Et=await this.getCompFileList(bt);const Ct=Et.reduce(((ct,ut)=>ct+ut.size),0);this.checkCompFileNum(Et.length);this.checkCompFileSize(Ct);this.checkCompSingleFileSize(Et);const Tt={name:yt,dep:ft,previewConfigs:_t,desc:mt,version:$t,size:Ct,files:Et,bgColor:ht,compFeatures:xt,tags:St};const wt=await Nt.remoteApi.v1Comp.compcontrollerUpload(Tt,{headers:pt});const At=wt.data._id;ut=At;await this.updateCompJson(dt,(ct=>({...ct,name:yt,__id__:At})));const{data:{componentDir:kt}}=await Nt.remoteApi.v1Oss.osscontrollerCompossdir();const It=await Nt.remoteApi.v1Oss.osscontrollerPutpolicy({type:kt});const Pt={compFullPath:bt,version:$t,ossData:It.data};await this.uploadCompFolderToOss(Pt);const{key:Ot}=It.data;const Dt={compId:At,objectId:`${kt}${Ot}`};await Nt.remoteApi.v1Comp.compcontrollerUpdateobjectid(Dt)}catch(ct){if(ut){await Nt.remoteApi.v1Comp.compcontrollerDeletefailedcomp({compId:ut},{headers:pt})}if(ct instanceof yt.httpError.BadRequestError){throw new yt.httpError.BadRequestError(ct)}throw new Error(ct.message)}}async updateComp(ct){const{compId:ut,compPath:pt,dep:dt,previewConfigs:ft,desc:_t,bgColor:mt,name:ht,upgradeDesc:yt,teamId:bt,tags:xt}=ct;const $t=this.getCompFullPath(pt);const Et=await this.getCompFeatures($t);this.checkCompEntryIndex($t);const Ct=await Nt.remoteApi.v1Comp.compcontrollerCompdetail({compId:ut});const{objectId:Tt,version:wt}=Ct.data;const At=await this.readCompVersion($t);const It=await this.getCompFileList($t);const Pt=It.reduce(((ct,ut)=>ct+ut.size),0);this.checkCompFileNum(It.length);this.checkCompFileSize(Pt);this.checkCompSingleFileSize(It);const Ot={compId:ut,name:ht,dep:dt,previewConfigs:ft,desc:_t,version:At,size:Pt,files:It,bgColor:mt,compFeatures:Et,upgradeDesc:yt,tags:xt};const Dt=await Nt.remoteApi.v1Comp.compcontrollerUpdate(Ot,{headers:{"team-id":bt}});const{isFileChange:Ft}=Dt.data;if(!Ft&&wt===At){const ct=vt.join($t,kt.KEYS.COMP_SCREENSHOT_MINI_FILENAME);if(St.existsSync(ct)){const ut=await Nt.remoteApi.v1Oss.osscontrollerCompossdir();const pt=await Nt.remoteApi.v1Oss.osscontrollerPutpolicy({type:ut.data.componentDir});const dt=Tt.replace(pt.data.dir,"");const ft=vt.join(dt,At,kt.KEYS.COMP_SCREENSHOT_MINI_FILENAME).replace(/\\/g,"/");const _t=St.createReadStream(ct);const mt={...pt.data,key:ft};await this.ossService.uploadFileToOss(mt,_t,true)}return}const Mt=await Nt.remoteApi.v1Oss.osscontrollerCompossdir();const{componentDir:Rt}=Mt.data;const Lt=await Nt.remoteApi.v1Oss.osscontrollerPutpolicy({type:Rt});const Bt=Tt.replace(Lt.data.dir,"");const Vt={...Lt.data,key:Bt};const jt={compFullPath:$t,version:At,ossData:Vt};await this.uploadCompFolderToOss(jt);await this.updateCompJson(pt,(ct=>({...ct,name:ht,__id__:ut})))}async downloadComp(ct){const{compId:ut,savePath:pt,isCover:dt,compName:ft,version:_t}=ct;const{srcPath:mt}=this.configService.comphubConfig();const ht=kt.KEYS.FILE_MANAGER_DIRNAME;const bt=pt.replace(ht,"").replace(/[/\\]/g,vt.sep);const xt=vt.join(mt,bt,ft);if(!dt&&St.existsSync(xt)){return{isRepeat:true}}const $t=Et.tmpdir();const wt=vt.join($t,kt.KEYS.COMP_TEMP_DIR);this.ctx.logger.debug("组件下载到临时目录",wt);const At=await Nt.remoteApi.v1Comp.compcontrollerCompdetail({compId:ut,version:_t});if(!At?.data){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compNotExist"))}const{files:It,objectId:Pt,name:Ot}=At.data;let Dt=[];const Ft=vt.join(wt,Pt,_t);if(St.existsSync(Ft)){const{files:ct}=await Tt.fileTree.generateTree(Ft);Dt=ct}await Nt.remoteApi.v1Comp.compcontrollerUpdatecompdownloadcount({compId:ut,version:_t});if(It.length===Dt.length){const ct=Dt.find((({absolutePath:ct})=>ct.replace(Ft,"").startsWith(`${vt.sep}${kt.KEYS.COMP_CONFIG_FILENAME}`)));if(ct){const ut=await St.promises.readFile(ct.absolutePath,"utf8");const pt=JSON.parse(ut);const{name:dt}=pt;if(Ot===dt){await Ct.copy(Ft,xt);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接使用缓存文件");return}}}const Mt=It.map((ct=>{const ut=vt.join(Pt,_t,ct.path);return{path:ut.replace(/[/\\]/g,"/")}}));const Rt=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath(Rt,Mt,wt);const Lt=vt.join(wt,Pt,_t);await Ct.copy(Lt,xt)}async getLocalCompsByIds(ct){const{srcPath:ut}=this.configService.comphubConfig();const pt=await this.findCompJsonPath(ut);this.ctx.logger.debug("组件文件数量:",pt.length);const dt=pt.map((async({absolutePath:ct})=>{const ut=await St.promises.readFile(ct,"utf8");const pt=JSON.parse(ut);return{...pt,path:vt.dirname(ct)}}));const ft=await Promise.all(dt);const _t=ft.filter((ut=>ct.includes(ut.__id__)));if(!_t){return[]}const mt=kt.KEYS.FILE_MANAGER_DIRNAME;const ht=new RegExp(It.textKit.escapeRegExp(vt.sep),"g");const yt=_t.map((ct=>{const pt=ct.path.replace(ut,"").replace(ht,"/").slice(1);return{id:ct.__id__,path:mt+pt,fullPath:ct.path,fullPathHash:Tt.digest.getStringHash(ct.path),basename:vt.basename(ct.path)}}));return yt}async getCompFilesOssSignedUrl(ct){const{version:ut,objectId:pt,files:dt}=ct;const ft=await this.ossService.getDownloadSts();const _t=dt.map((async ct=>{const dt=vt.join(pt,ut,ct);const _t=await this.ossService.getFilePreviewUrl(ft,dt.replace(/[/\\]/g,"/"));return{path:ct,signedUrl:_t}}));const mt=await Promise.all(_t);return{signedUrls:mt}}async getPackageJsonContent(){const ct=this.configService.comphubConfig();const ut=vt.join(ct.cwd,"package.json");return await Tt.fileSys.readJsonFile(ut)}async getLocalComps(ct){const{page:ut=1,pageSize:pt=10}=ct;const{srcPath:dt}=this.configService.comphubConfig();const ft=await this.getAllLocalCompIds();const _t=ft.map((ct=>({id:ct.compjson.__id__,pathHash:ct.pathHash})));_t.sort(((ct,ut)=>ct.id.localeCompare(ut.id)));const mt=[...new Set(_t.map((ct=>ct.id)))];const ht=await Nt.remoteApi.v1Comp.compcontrollerExistcompsbyids({compIds:mt});const{ids:St=[]}=ht.data;const bt=_t.filter((ct=>St.includes(ct.id)));const xt=bt.length;const $t=bt.slice((ut-1)*pt,ut*pt);const Et=new Map(ft.map((ct=>[`${ct.compjson.__id__}_${ct.pathHash}`,ct])));const Ct=await Nt.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:$t.map((ct=>ct.id))});const{rows:wt=[]}=Ct.data;const At=new Map(wt.map((ct=>[ct._id,ct])));const Pt=new RegExp(It.textKit.escapeRegExp(vt.sep),"g");const Ot=kt.KEYS.FILE_MANAGER_DIRNAME;const Dt=$t.map((async({id:ct,pathHash:ut})=>{const pt=Et.get(`${ct}_${ut}`);const ft=At.get(ct);if(!ft||!pt){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithIdNotExist",{args:[ct]}))}const _t=pt.compPath.replace(dt,"").replace(Pt,"/").slice(1);return{_id:Tt.digest.getStringHash(pt.compPath),name:ft.name,compId:ct,version:pt.compjson.version,path:Ot+_t,previewConfigs:ft.previewConfigs,bgColor:ft.bgColor,fullPath:pt.compPath}}));const Ft=await Promise.all(Dt);return{total:xt,page:ut,pageSize:pt,rows:Ft}}async getLocalCompDetailByPathHash(ct){const{fullPathHash:ut}=ct;const pt=await this.getAllLocalCompIds();const dt=pt.find((ct=>ct.pathHash===ut));if(!dt){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithPathNotExist",{args:[ut]}))}const{srcPath:ft}=this.configService.comphubConfig();const{__id__:_t,version:mt}=dt.compjson;const ht=await Nt.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:[_t]});const{rows:St=[]}=ht.data;const bt=St[0];const xt=new RegExp(It.textKit.escapeRegExp(vt.sep),"g");const $t=kt.KEYS.FILE_MANAGER_DIRNAME;const Et=dt.compPath.replace(ft,"").replace(xt,"/").slice(1);return{_id:ut,name:bt.name,compId:_t,version:mt,path:$t+Et,previewConfigs:bt.previewConfigs,bgColor:bt.bgColor,fullPath:dt.compPath}}async openCompPathInVscode(ct){const{folderPath:ut,relativeFilePath:pt}=ct;await this.commandService.revealInVSCode(ut,pt)}async writeCompFile(ct){const{compPath:ut,filename:pt,content:dt}=ct;const ft=this.getCompFullPath(ut);const _t=vt.join(ft,pt);St.writeFileSync(_t,Buffer.from(dt,"base64"))}};ut.CompService=Ot;_t([(0,yt.App)(),ht("design:type",Object)],Ot.prototype,"app",void 0);_t([(0,yt.Inject)(),ht("design:type",bt.ConfigService)],Ot.prototype,"configService",void 0);_t([(0,yt.Inject)(),ht("design:type",$t.OssService)],Ot.prototype,"ossService",void 0);_t([(0,yt.Inject)(),ht("design:type",At.CommandService)],Ot.prototype,"commandService",void 0);_t([(0,yt.Inject)(),ht("design:type",xt.DepsService)],Ot.prototype,"depsService",void 0);_t([(0,yt.Inject)(),ht("design:type",Object)],Ot.prototype,"ctx",void 0);_t([(0,yt.Inject)(),ht("design:type",Pt.MidwayI18nService)],Ot.prototype,"i18nService",void 0);ut.CompService=Ot=_t([(0,yt.Provide)()],Ot)},63366:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.ConfigService=void 0;const yt=pt(46123);const vt=pt(60449);const St=mt(pt(16928));let bt=class ConfigService{comphubConfig(){const ct=this.app.getAttr(vt.KEYS.COMPHUB_CONFIG_KEY);return ct}getGlobalConfig(){const ct=this.comphubConfig();const{cwd:ut,srcPath:pt,version:dt,allowDebug:ft,subPort:_t,projectHash:mt}=ct;return{cwd:ut,srcPath:pt,sep:St.sep,version:dt,allowDebug:ft,subPort:_t,projectHash:mt}}};ut.ConfigService=bt;_t([(0,yt.App)(),ht("design:type",Object)],bt.prototype,"app",void 0);ut.ConfigService=bt=_t([(0,yt.Provide)()],bt)},23086:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.DepsService=void 0;const yt=pt(46123);const vt=mt(pt(16928));const St=mt(pt(79896));const bt=pt(64713);const xt=pt(39538);const $t=pt(60449);const Et=pt(63366);const Ct=pt(58953);let Tt=class DepsService{async getModuleEntry(ct,ut){const pt=await xt.fileSys.readJsonFile(vt.join(ut,"package.json"));if(!pt){console.error("未找到 package.json 文件");return[]}const dt=xt.resolver.findDependencyVersion(pt,"vue");const ft=await xt.depGraph.detectImports(ct,{pathAliases:["@"]});ft.vue={version:dt};const _t={};for(const[ct]of Object.entries(ft)){const dt=xt.resolver.findDependencyVersion(pt,ct);const ft={version:dt};const mt=await xt.resolver.findOwningPackage(ct,ut);if(mt){ft.version=mt.version;if(!dt){ft.parent={name:mt.name,version:mt.version}}}_t[ct]=ft}return Object.entries(_t).map((([ct,ut])=>({name:ct,version:ut.version,...ut.parent&&{parent:ut.parent}})))}async precompileModule(ct,ut,pt){const dt=await xt.fileSys.readJsonFile(vt.join(pt,"package.json"));if(!dt){console.error("未找到 package.json 文件");return{entryNameToFile:{}}}const{entryPoints:ft,skippedModules:_t}=(0,Ct.buildEntryPoints)(ut,dt,pt);await St.promises.mkdir(ct,{recursive:true});const mt={};for(const[ct,ut]of Object.entries(ft)){if(xt.resolver.isModuleInstalled(ct,pt)){mt[ct]=ut}}const ht={};for(const ct of _t){ht[ct]=ct}const yt=vt.join(ct,$t.KEYS.META_FILE_NAME);const Et=await xt.fileSys.readJsonFile(yt);const{filteredEntryPoints:Tt,cachedMappings:wt}=(0,Ct.filterCachedModules)(mt,Et);Object.assign(ht,wt);if(Object.keys(Tt).length===0){return{entryNameToFile:ht}}const At={entryPoints:Tt,bundle:true,format:"esm",splitting:true,outdir:ct,entryNames:"[name]-[hash]",chunkNames:"chunk-[hash]",outExtension:{".js":".js"},metafile:true,write:true,target:"esnext",sourcemap:false,external:["vue"],absWorkingDir:pt,nodePaths:[vt.join(pt,"node_modules")]};const kt=await(0,bt.build)(At);const{optimized:It,entryNameToFile:Nt}=(0,Ct.analyzeBuildOutputs)(kt,Tt,ct);const Pt={...Et,...It};await(0,Ct.saveBuildMetadata)(yt,Pt);return{entryNameToFile:{...ht,...Nt}}}};ut.DepsService=Tt;_t([(0,yt.App)(),ht("design:type",Object)],Tt.prototype,"app",void 0);_t([(0,yt.Inject)(),ht("design:type",Et.ConfigService)],Tt.prototype,"configService",void 0);ut.DepsService=Tt=_t([(0,yt.Provide)()],Tt)},85984:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.ModuleService=void 0;const yt=pt(46123);const vt=pt(63366);const St=pt(23086);const bt=mt(pt(16928));const xt=pt(39538);const $t=mt(pt(79896));const Et=pt(60449);let Ct=class ModuleService{async getPreBuildModuleDir(){const{cwd:ct}=this.configService.comphubConfig();const ut=bt.join(ct,Et.KEYS.PREBUILD_MODULE_DIR);await $t.promises.mkdir(ut,{recursive:true});return ut}async preBuild(ct){const ut=await this.getPreBuildModuleDir();const{cwd:pt}=this.configService.comphubConfig();return await this.depsService.precompileModule(ut,ct,pt)}async preBuildSize(){const ct=await this.getPreBuildModuleDir();return await xt.fileSys.dirSize(ct)}async clearPreBuild(){const ct=await this.getPreBuildModuleDir();await $t.promises.rm(ct,{recursive:true,force:true})}};ut.ModuleService=Ct;_t([(0,yt.Inject)(),ht("design:type",vt.ConfigService)],Ct.prototype,"configService",void 0);_t([(0,yt.Inject)(),ht("design:type",St.DepsService)],Ct.prototype,"depsService",void 0);_t([(0,yt.App)(),ht("design:type",Object)],Ct.prototype,"app",void 0);ut.ModuleService=Ct=_t([(0,yt.Provide)()],Ct)},80799:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var yt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.OssService=void 0;const vt=pt(46123);const St=yt(pt(51515));const bt=yt(pt(12593));const xt=yt(pt(18451));const $t=mt(pt(16928));const Et=mt(pt(79896));const Ct=pt(96955);const Tt=pt(6586);const wt=yt(pt(26506));const At=yt(pt(23046));const kt=pt(45853);const It=pt(60449);const Nt=pt(68255);let Pt=class OssService{createOssClient(ct){const ut={endpoint:It.KEYS.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...ct};return new xt.default(ut)}getContentTypeWithCharset(ct){const ut=$t.extname(ct).toLowerCase();const pt={".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/html; 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 pt[ut]}createOssFormData(ct,ut,pt=false){const dt=new St.default;const ft=ct.dir+ct.key;dt.append("success_action_status","200");dt.append("policy",ct.policy);dt.append("x-oss-signature",ct.signature);dt.append("x-oss-signature-version",ct.x_oss_signature_version);dt.append("x-oss-credential",ct.x_oss_credential);dt.append("x-oss-date",ct.x_oss_date);dt.append("key",ft);dt.append("x-oss-security-token",ct.security_token);dt.append("x-oss-forbid-overwrite",pt?"false":"true");dt.append("Cache-Control","public, max-age=31536000");const _t={};const mt=ut.path?.toString();if(mt){const ct=this.getContentTypeWithCharset(mt);if(ct){_t.contentType=ct}}dt.append("file",ut,_t);return{host:ct.host,filePath:ft,formData:dt}}async getDownloadSts(){const ct=await this.cache.get(It.KEYS.CACHE_KEY_STS_TOKEN);if(ct){return ct}const ut=await Tt.remoteApi.v1Oss.osscontrollerGetsts();const pt=new Date(ut.data.Expiration).getTime()-1*60*1e3;await this.cache.set(It.KEYS.CACHE_KEY_STS_EXPIRE_TIME,pt);const dt=pt-Date.now();this.ctx.logger.debug("STS过期时间",(0,At.default)(pt).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(It.KEYS.CACHE_KEY_STS_TOKEN,ut.data,dt);return ut.data}async uploadFileToOss(ct,ut,pt=false){const{host:dt,formData:ft}=this.createOssFormData(ct,ut,pt);const _t=await bt.default.post(dt,ft,{headers:{...ft.getHeaders()}}).catch((async ct=>{const ut=ct.response.data;const pt=await(0,kt.parseStringPromise)(ut);if(pt?.Error){throw new vt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[pt.Error.Message]}))}throw new vt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[ct.message||ct]}))}));if(_t.status!==200){throw new vt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[_t.data]}))}}async downloadFileToPath(ct,ut,pt){const dt=this.createOssClient({region:ct.region,accessKeyId:ct.AccessKeyId,accessKeySecret:ct.AccessKeySecret,stsToken:ct.SecurityToken,bucket:ct.bucket,refreshSTSToken:async()=>{const ct=await this.getDownloadSts();return{accessKeyId:ct.AccessKeyId,accessKeySecret:ct.AccessKeySecret,stsToken:ct.SecurityToken}}});const ft=ut.map((async ct=>{const{path:ut}=ct;const ft=$t.join(pt,ut);const _t=$t.dirname(ft);if(!Et.existsSync(_t)){Et.mkdirSync(_t,{recursive:true})}return await dt.get(ut,ft)}));return await Promise.all(ft)}async getFilePreviewUrl(ct,ut){const pt=(0,wt.default)(ut);const dt=await this.cache.get(It.KEYS.CACHE_KEY_STS_EXPIRE_TIME);const ft=await this.cache.get(pt);const _t=Math.floor((Number(dt)-Date.now())/1e3);this.ctx.logger.debug("文件地址过期时间:",_t,"秒",Math.floor(_t/60),"分钟");if(ft&&_t>0){return ft}const mt=this.createOssClient({region:ct.region,accessKeyId:ct.AccessKeyId,accessKeySecret:ct.AccessKeySecret,stsToken:ct.SecurityToken,bucket:ct.bucket,refreshSTSToken:async()=>{const ct=await this.getDownloadSts();return{accessKeyId:ct.AccessKeyId,accessKeySecret:ct.AccessKeySecret,stsToken:ct.SecurityToken}}});this.ctx.logger.debug("文件地址过期时间:",_t,"秒",Math.floor(_t/60),"分钟");const ht=mt.signatureUrl(ut,{expires:_t});await this.cache.set(pt,ht,_t*1e3);this.ctx.logger.debug("缓存预览URL",ut);return ht}};ut.OssService=Pt;_t([(0,vt.Inject)(),ht("design:type",Object)],Pt.prototype,"ctx",void 0);_t([(0,vt.InjectClient)(Ct.CachingFactory,"default"),ht("design:type",Object)],Pt.prototype,"cache",void 0);_t([(0,vt.Inject)(),ht("design:type",Nt.MidwayI18nService)],Pt.prototype,"i18nService",void 0);ut.OssService=Pt=_t([(0,vt.Provide)()],Pt)},5578:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.PreprocessingService=void 0;const _t=pt(46123);const mt=pt(34985);const ht=pt(71015);const yt=ft(pt(60505));let vt=class PreprocessingService{async preprocessCode(ct){const{cssCode:ut,precompilerType:pt}=ct;if(pt===mt.PrecompilerEnum.SASS||pt===mt.PrecompilerEnum.SCSS){const ct=(0,ht.compileString)(ut);return ct.css}else if(pt===mt.PrecompilerEnum.LESS){const ct=await yt.default.render(ut);return ct.css}return ut}};ut.PreprocessingService=vt;ut.PreprocessingService=vt=dt([(0,_t.Provide)()],vt)},61275:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.QueueService=void 0;const ft=pt(46123);let _t=class QueueService{constructor(){this.queue=[];this.isProcessing=false}async processQueue(){if(this.isProcessing||this.queue.length===0){return}this.isProcessing=true;const ct=this.queue.shift();if(ct){await ct()}this.isProcessing=false;this.processQueue()}async enqueue(ct){return new Promise((ut=>{this.queue.push((async()=>{try{await ct()}finally{ut()}}));this.processQueue()}))}};ut.QueueService=_t;ut.QueueService=_t=dt([(0,ft.Provide)(),(0,ft.Scope)(ft.ScopeEnum.Singleton)],_t)},19452:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var yt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.TerminalService=void 0;const vt=pt(46123);const St=pt(35317);const bt=pt(63366);const xt=mt(pt(95892));const $t=pt(73024);const Et=pt(51455);const Ct=pt(39538);const Tt=yt(pt(44644));let wt=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(ct){if(!ct||ct.length===0)return"";try{new TextDecoder("utf-8",{fatal:true}).decode(ct);return xt.decode(ct,"utf-8")}catch{return xt.decode(ct,"gbk")}}async folderExists(ct){try{await(0,Et.access)(ct,$t.constants.F_OK|$t.constants.R_OK);return true}catch{return false}}async shutdown(ct=5e3){const ut=this.subprocess;if(!ut||ut.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((pt=>{let dt=false;const done=()=>{if(!dt){dt=true;pt(0)}};ut.once("exit",done);(0,Tt.default)(ut.pid,"SIGTERM",(ct=>{if(ct){this.ctx.emit("output",{err:ct.message})}}));const ft=setTimeout((()=>{(0,Tt.default)(ut.pid,"SIGKILL",(ct=>{if(ct){this.ctx.emit("output",{err:ct.message})}done()}))}),ct);ut.once("exit",(()=>clearTimeout(ft)))}))}async execCmd({cwd:ct,oldCwd:ut,command:pt}){if(!await this.folderExists(ct)){this.ctx.emit("output",{err:`${ct} 路径不存在`});this.ctx.emit("output",{cwd:ut});return}this.cwd=ct;if(!pt.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(pt==="^C"){await this.shutdown();return}this.subprocess=(0,St.spawn)(pt,{shell:true,cwd:ct,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",(ct=>{this.ctx.emit("output",{stdout:this.smartDecode(ct)})}));this.subprocess.stderr?.on("data",(ct=>{this.ctx.emit("output",{stderr:this.smartDecode(ct)})}));this.subprocess.on("close",(()=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:pt})}));this.subprocess.on("error",(ct=>{this.ctx.emit("output",{err:ct.message})}))}async cmdTab({cwd:ct,lastWord:ut}){let pt=await Ct.fileSys.readDirFiles(ct);if(ut){pt=pt.filter((ct=>ct.name.startsWith(ut)))}if(pt.length===0){return}this.tabIndex=(this.tabIndex+1)%pt.length;const dt=pt[this.tabIndex];this.ctx.emit("output",{tab:dt.name})}};ut.TerminalService=wt;_t([(0,vt.Inject)(),ht("design:type",bt.ConfigService)],wt.prototype,"configService",void 0);_t([(0,vt.Inject)(),ht("design:type",Object)],wt.prototype,"ctx",void 0);ut.TerminalService=wt=_t([(0,vt.Provide)()],wt)},5808:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.VuefinderService=void 0;const yt=pt(46123);const vt=mt(pt(16928));const St=mt(pt(79896));const bt=pt(63366);const xt=mt(pt(93900));const $t=pt(60449);let Et=class VuefinderService{async list({path:ct}){const ut=this.configService.comphubConfig();const{srcPath:pt}=ut;const dt=ct?.replace($t.KEYS.FILE_MANAGER_DIRNAME,"")||"";let ft=vt.join(pt,dt);const _t=await St.promises.access(ft).then((()=>true)).catch((()=>false));if(!_t){ft=pt;ct=$t.KEYS.FILE_MANAGER_DIRNAME}const mt=await St.promises.readdir(ft);const ht=mt.map((async ut=>{const pt=vt.join(ft,ut);const dt=await St.promises.stat(pt);const _t=dt.isDirectory();const mt=ct===$t.KEYS.FILE_MANAGER_DIRNAME?`${ct}${ut}`:`${ct}/${ut}`;return{type:_t?"dir":"file",path:mt,file_size:dt.size,visibility:"public",last_modified:Math.floor(dt.mtimeMs/1e3),basename:ut,extension:_t?"":vt.extname(ut).slice(1),mime_type:xt.lookup(ut)||""}}));const yt=await Promise.all(ht);yt.sort(((ct,ut)=>{if(ct.type==="dir"&&ut.type==="file"){return-1}else if(ct.type==="file"&&ut.type==="dir"){return 1}else{return 0}}));return{storages:mt,dirname:ct,files:yt}}};ut.VuefinderService=Et;_t([(0,yt.App)(),ht("design:type",Object)],Et.prototype,"app",void 0);_t([(0,yt.Inject)(),ht("design:type",bt.ConfigService)],Et.prototype,"configService",void 0);ut.VuefinderService=Et=_t([(0,yt.Provide)()],Et)},66593:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.TerminalSocketController=void 0;const _t=pt(46123);const mt=pt(19452);let ht=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(ct){this.terminalService.execCmd(ct)}async onTab(ct){this.terminalService.cmdTab(ct)}};ut.TerminalSocketController=ht;dt([(0,_t.Inject)(),ft("design:type",Object)],ht.prototype,"ctx",void 0);dt([(0,_t.Inject)(),ft("design:type",mt.TerminalService)],ht.prototype,"terminalService",void 0);dt([(0,_t.OnWSConnection)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],ht.prototype,"onConnection",null);dt([(0,_t.OnWSDisConnection)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],ht.prototype,"onDisConnection",null);dt([(0,_t.OnWSMessage)("command"),ft("design:type",Function),ft("design:paramtypes",[Object]),ft("design:returntype",Promise)],ht.prototype,"onCommand",null);dt([(0,_t.OnWSMessage)("tab"),ft("design:type",Function),ft("design:paramtypes",[Object]),ft("design:returntype",Promise)],ht.prototype,"onTab",null);ut.TerminalSocketController=ht=dt([(0,_t.WSController)("/terminal")],ht)},58953:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();Object.defineProperty(ut,"__esModule",{value:true});ut.analyzeBuildOutputs=analyzeBuildOutputs;ut.saveBuildMetadata=saveBuildMetadata;ut.filterCachedModules=filterCachedModules;ut.buildEntryPoints=buildEntryPoints;const mt=_t(pt(16928));const ht=_t(pt(79896));const yt=pt(39538);const vt=pt(21739);const St=pt(60449);function resolveModuleEntry(ct,ut){if(ct!=="vue")return ct;const pt=vt.versionKit.getMajorVersion(ut);return pt==="3"?St.KEYS.VUE_ESM_BUNDLER:ct}function extractModuleName(ct){const ut=ct.slice(0,-12);return mt.basename(ut)}function matchEntryKey(ct,ut){return ct.find((ct=>{const pt=ct.split("/");const dt=pt.length===1?pt[0]:pt[pt.length-1];return ut===dt}))}function analyzeBuildOutputs(ct,ut,pt){const dt={};const ft={};const _t=Object.keys(ut);const vt=ct.metafile?.outputs??{};for(const[ct,ut]of Object.entries(vt)){if(!ut.entryPoint)continue;const vt=mt.basename(ct);const St=extractModuleName(ct);const bt=matchEntryKey(_t,St);if(!bt)continue;ft[bt]=vt;const xt=mt.join(pt,vt);const $t=ht.readFileSync(xt,"utf-8");const Et=yt.digest.getStringHash($t).slice(0,8);dt[bt]={src:ut.entryPoint,file:vt,fileHash:Et,needsInterop:false}}return{optimized:dt,entryNameToFile:ft}}async function saveBuildMetadata(ct,ut){await ht.promises.writeFile(ct,JSON.stringify(ut,null,2))}function filterCachedModules(ct,ut){if(!ut){return{filteredEntryPoints:ct,cachedMappings:{}}}const pt={};const dt={};for(const[ft,_t]of Object.entries(ct)){if(ut[ft]){dt[ft]=ut[ft].file}else{pt[ft]=_t}}return{filteredEntryPoints:pt,cachedMappings:dt}}function buildEntryPoints(ct,ut,pt){const dt={};const ft=[];for(const _t of ct){if(yt.resolver.shouldSkipByExtension(_t)){ft.push(_t);continue}const ct=yt.resolver.findDependencyVersion(ut,_t);if(!ct){const ct=yt.resolver.findOwningPackage(_t,pt);if(!ct)continue}dt[_t]=resolveModuleEntry(_t,ct)}return{entryPoints:dt,skippedModules:ft}}},49969:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.getErrorMessage=getErrorMessage;function getErrorMessage(ct){if(ct instanceof Error)return ct.message;if(typeof ct==="string")return ct;return String(ct)}},4145:function(ct,ut,pt){"use strict";var dt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.waitForIpcConfig=waitForIpcConfig;const ft=dt(pt(16928));const _t=pt(60449);function parseCwdArg(ct){for(let ut=0;ut<ct.length;ut++){if(ct[ut]==="--cwd"&&ut+1<ct.length){return ct[ut+1]}if(ct[ut].startsWith("--cwd=")){return ct[ut].replace("--cwd=","")}}return undefined}function waitForIpcConfig(){const ct=parseCwdArg(process.argv);if(ct){return Promise.resolve({type:"config",port:0,cwd:ft.default.resolve(ct),allowDebug:process.env.MIDWAY_SERVER_ENV===_t.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}if(process.send){return new Promise(((ct,ut)=>{const pt=setTimeout((()=>{ut(new Error("No IPC config received within 10s. MidwayJS must be started by master via fork."))}),1e4);process.once("message",(ut=>{if(ut?.type==="config"){clearTimeout(pt);ct(ut)}}))}))}return Promise.resolve({type:"config",port:0,cwd:process.cwd(),allowDebug:process.env.MIDWAY_SERVER_ENV===_t.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}},10778:function(ct,ut,pt){"use strict";var dt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.remoteInstance=ut.setHeader=void 0;const ft=pt(63536);const _t=pt(60449);const mt=dt(pt(65692));const ht=(0,ft.initInstance)(_t.KEYS.REMOTE_SERVICE_PREFIX,{timeout:1e4,httpsAgent:new mt.default.Agent({rejectUnauthorized:false})});ut.remoteInstance=ht;let yt=null;const setHeader=ct=>{yt=ct};ut.setHeader=setHeader;ht.interceptors.request.use((ct=>{ct.headers[_t.KEYS.AUTHORIZATION_HEADER_NAME]=yt[_t.KEYS.AUTHORIZATION_HEADER_NAME];ct.headers[_t.KEYS.CSRF_TOKEN_HEADER_NAME]=yt[_t.KEYS.CSRF_TOKEN_HEADER_NAME];ct.headers[_t.KEYS.ACCEPT_LANGUAGE_HEADER_NAME]=yt[_t.KEYS.ACCEPT_LANGUAGE_HEADER_NAME.toLowerCase()];ct.headers["cookie"]=yt.cookie;return ct}),(ct=>Promise.reject(ct)));ht.interceptors.response.use((async ct=>{if(ct.data.code!==0){throw new Error(JSON.stringify(ct.data))}return ct.data}),(ct=>Promise.reject(ct)))},67872:function(ct,ut,pt){"use strict";var dt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.createKoaProxy=createKoaProxy;const ft=dt(pt(58611));const _t=pt(76289);const mt=new ft.default.Agent({keepAlive:true,keepAliveMsecs:3e4,maxSockets:50,maxFreeSockets:10});const ht=new Map;function getOrCreateSubProxy(ct,ut){const pt=`${ct}|${JSON.stringify(ut)}`;if(!ht.has(pt)){ht.set(pt,(0,_t.createProxyMiddleware)({target:ct,changeOrigin:true,secure:false,agent:mt,pathRewrite:ut,on:{error:ct=>{}}}))}return ht.get(pt)}async function createKoaProxy(ct,ut,pt){const dt=getOrCreateSubProxy(ut,pt);return new Promise(((ut,pt)=>{ct.res.on("finish",ut);ct.res.on("close",ut);ct.res.on("error",pt);dt(ct.req,ct.res,(ct=>{if(ct)pt(ct);else ut()}))}))}},101:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.PackageJsonVO=ut.LocalCompDetailVO=ut.LocalCompsVO=ut.CompFileHashVO=ut.CompSimilarListVO=ut.CompFilesOssSignedUrlVO=ut.DownloadCompVO=ut.LocalCompsByIdsVO=ut.ImportScanResultVO=ut.CompCheckVO=ut.CompFileContentVO=ut.CompFileVO=ut.CompSimilarListItemVO=ut.FileNode=void 0;const _t=pt(49179);const mt=pt(60449);class FileNode{}ut.FileNode=FileNode;dt([(0,_t.ApiProperty)({description:"目录/文件名称",example:"index.vue",required:true}),ft("design:type",String)],FileNode.prototype,"name",void 0);dt([(0,_t.ApiProperty)({description:"目录/文件路径",example:"/src/components/MyComp/index.vue",required:true}),ft("design:type",String)],FileNode.prototype,"path",void 0);dt([(0,_t.ApiProperty)({description:"目录/文件类型",example:"file",required:true,enum:mt.ENUM.FileType}),ft("design:type",String)],FileNode.prototype,"type",void 0);dt([(0,_t.ApiProperty)({description:"子节点",type:[FileNode]}),ft("design:type",Array)],FileNode.prototype,"children",void 0);class CompSimilarListItemVO{}ut.CompSimilarListItemVO=CompSimilarListItemVO;dt([(0,_t.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),ft("design:type",String)],CompSimilarListItemVO.prototype,"_id",void 0);dt([(0,_t.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),ft("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);class CompFileVO{}ut.CompFileVO=CompFileVO;dt([(0,_t.ApiProperty)({type:FileNode,description:"组件文件树",required:true}),ft("design:type",FileNode)],CompFileVO.prototype,"tree",void 0);dt([(0,_t.ApiProperty)({type:[String],description:"组件文件列表",required:true}),ft("design:type",Array)],CompFileVO.prototype,"files",void 0);class CompFileContentVO{}ut.CompFileContentVO=CompFileContentVO;dt([(0,_t.ApiProperty)({description:"组件文件内容",example:"let a=123;",required:true}),ft("design:type",String)],CompFileContentVO.prototype,"content",void 0);class CompCheckVO{}ut.CompCheckVO=CompCheckVO;dt([(0,_t.ApiProperty)({description:"组件入口文件路径",required:false}),ft("design:type",String)],CompCheckVO.prototype,"entryIndexPath",void 0);dt([(0,_t.ApiProperty)({description:"组件配置文件路径",required:false}),ft("design:type",String)],CompCheckVO.prototype,"compJsonPath",void 0);dt([(0,_t.ApiProperty)({description:"异常结果内容",required:true}),ft("design:type",String)],CompCheckVO.prototype,"errorMsg",void 0);class ParentVO{}dt([(0,_t.ApiProperty)({description:"父库名称",required:true,example:"vue"}),ft("design:type",String)],ParentVO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),ft("design:type",String)],ParentVO.prototype,"version",void 0);class ImportDetailVO{}dt([(0,_t.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),ft("design:type",String)],ImportDetailVO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),ft("design:type",String)],ImportDetailVO.prototype,"version",void 0);dt([(0,_t.ApiProperty)({type:ParentVO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),ft("design:type",ParentVO)],ImportDetailVO.prototype,"parent",void 0);class ImportScanResultVO{}ut.ImportScanResultVO=ImportScanResultVO;dt([(0,_t.ApiProperty)({type:[ImportDetailVO],required:true,description:"第三方库导入详情"}),ft("design:type",Array)],ImportScanResultVO.prototype,"thirdParty",void 0);class CompInfoVO{}dt([(0,_t.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),ft("design:type",String)],CompInfoVO.prototype,"id",void 0);dt([(0,_t.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),ft("design:type",String)],CompInfoVO.prototype,"path",void 0);dt([(0,_t.ApiProperty)({description:"组件文件名称",example:"base-table",required:true}),ft("design:type",String)],CompInfoVO.prototype,"basename",void 0);dt([(0,_t.ApiProperty)({description:"组件文件完整路径",example:"/src/components/MyComp/index.vue",required:true}),ft("design:type",String)],CompInfoVO.prototype,"fullPath",void 0);dt([(0,_t.ApiProperty)({description:"组件文件完整路径哈希值",example:"123",required:true}),ft("design:type",String)],CompInfoVO.prototype,"fullPathHash",void 0);class LocalCompsByIdsVO{}ut.LocalCompsByIdsVO=LocalCompsByIdsVO;dt([(0,_t.ApiProperty)({type:[CompInfoVO],required:true}),ft("design:type",Array)],LocalCompsByIdsVO.prototype,"compInfos",void 0);class DownloadCompVO{}ut.DownloadCompVO=DownloadCompVO;dt([(0,_t.ApiProperty)({description:"组件是否重复",example:true,required:true}),ft("design:type",Boolean)],DownloadCompVO.prototype,"isRepeat",void 0);class SignedUrlItem{}dt([(0,_t.ApiProperty)({description:"文件路径",example:"/src/components/MyComp/index.vue",required:true}),ft("design:type",String)],SignedUrlItem.prototype,"path",void 0);dt([(0,_t.ApiProperty)({description:"文件oss签名访问地址",example:"https://comp-hub.oss-cn-beijing.aliyuncs.com/src/components/MyComp/index.vue?x-oss-security-token=...",required:true}),ft("design:type",String)],SignedUrlItem.prototype,"signedUrl",void 0);class CompFilesOssSignedUrlVO{}ut.CompFilesOssSignedUrlVO=CompFilesOssSignedUrlVO;dt([(0,_t.ApiProperty)({description:"文件oss签名访问地址列表",type:[SignedUrlItem],required:true}),ft("design:type",Array)],CompFilesOssSignedUrlVO.prototype,"signedUrls",void 0);class CompSimilarListVO{}ut.CompSimilarListVO=CompSimilarListVO;dt([(0,_t.ApiProperty)({type:[CompSimilarListItemVO],description:"相似组件列表",required:true}),ft("design:type",Array)],CompSimilarListVO.prototype,"similarList",void 0);class CompFileHashVO{}ut.CompFileHashVO=CompFileHashVO;dt([(0,_t.ApiProperty)({example:"123",description:"组件哈希值",required:true}),ft("design:type",String)],CompFileHashVO.prototype,"compHash",void 0);class PreviewItem{}dt([(0,_t.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"预览配置项主键ID(自动生成)",required:false}),ft("design:type",String)],PreviewItem.prototype,"_id",void 0);dt([(0,_t.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),ft("design:type",Array)],PreviewItem.prototype,"miniPath",void 0);dt([(0,_t.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),ft("design:type",Array)],PreviewItem.prototype,"fullPath",void 0);dt([(0,_t.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),ft("design:type",String)],PreviewItem.prototype,"desc",void 0);class LocalCompsVO{}ut.LocalCompsVO=LocalCompsVO;dt([(0,_t.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"内容id,这里用路径哈希值",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"_id",void 0);dt([(0,_t.ApiProperty)({type:String,example:"qin-table",description:"组件名称",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({type:String,example:"123456",description:"组件ID",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"compId",void 0);dt([(0,_t.ApiProperty)({type:String,example:"1.0.0",description:"组件版本",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"version",void 0);dt([(0,_t.ApiProperty)({type:[PreviewItem],required:true}),ft("design:type",Array)],LocalCompsVO.prototype,"previewConfigs",void 0);dt([(0,_t.ApiProperty)({type:String,example:"local://components/QinTable",description:"组件文件路径",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"path",void 0);dt([(0,_t.ApiProperty)({type:String,example:"D:/src/components/QinTable/index.vue",description:"组件文件完整路径",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"fullPath",void 0);dt([(0,_t.ApiProperty)({type:String,example:"#f0f0f0",description:"组件背景颜色",required:false}),ft("design:type",String)],LocalCompsVO.prototype,"bgColor",void 0);class LocalCompDetailVO extends LocalCompsVO{}ut.LocalCompDetailVO=LocalCompDetailVO;class PackageJsonVO{}ut.PackageJsonVO=PackageJsonVO;dt([(0,_t.ApiProperty)({type:Object,description:"组件package.json文件内容",required:true}),ft("design:type",Object)],PackageJsonVO.prototype,"packageJson",void 0)},71692:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.PreBuildSizeVO=ut.PreBuildVO=void 0;const _t=pt(49179);class PreBuildVO{}ut.PreBuildVO=PreBuildVO;dt([(0,_t.ApiProperty)({description:"预构建模块对应文件",required:true,example:{vue:"vue-hash.js"}}),ft("design:type",Object)],PreBuildVO.prototype,"entryNameToFile",void 0);class PreBuildSizeVO{}ut.PreBuildSizeVO=PreBuildSizeVO;dt([(0,_t.ApiProperty)({description:"预构建模块文件总大小",required:true,example:1024}),ft("design:type",Number)],PreBuildSizeVO.prototype,"size",void 0)},75049:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SignedUrlVO=void 0;const _t=pt(49179);class SignedUrlVO{}ut.SignedUrlVO=SignedUrlVO;dt([(0,_t.ApiProperty)({example:"xxxx",description:"带签名的访问地址",required:true}),ft("design:type",String)],SignedUrlVO.prototype,"signUrl",void 0)},18922:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.PreprocessedCodeVO=void 0;const _t=pt(49179);class PreprocessedCodeVO{}ut.PreprocessedCodeVO=PreprocessedCodeVO;dt([(0,_t.ApiProperty)({description:"预处理后的css代码",required:true}),ft("design:type",String)],PreprocessedCodeVO.prototype,"preprocessedCode",void 0)},15798:(ct,ut)=>{"use strict";const pt={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};ut.parse=function(ct,...dt){const ft=typeof dt[0]==="object"&&dt[0];const _t=dt.length>1||!ft?dt[0]:undefined;const mt=dt.length>1&&dt[1]||ft||{};const ht=JSON.parse(ct,_t);if(mt.protoAction==="ignore"){return ht}if(!ht||typeof ht!=="object"){return ht}if(!ct.match(pt.suspectRx)){return ht}ut.scan(ht,mt);return ht};ut.scan=function(ct,ut={}){let pt=[ct];while(pt.length){const ct=pt;pt=[];for(const dt of ct){if(Object.prototype.hasOwnProperty.call(dt,"__proto__")){if(ut.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete dt.__proto__}for(const ct in dt){const ut=dt[ct];if(ut&&typeof ut==="object"){pt.push(dt[ct])}}}}};ut.safeParse=function(ct,pt){try{return ut.parse(ct,pt)}catch(ct){return null}}},35522:(ct,ut,pt)=>{"use strict";const dt=pt(99583);const ft=pt(43700);const _t=pt(66621);const mt=pt(69322);const ht={};ct.exports=function(ct,ut,pt={}){dt(ct&&typeof ct==="object","Invalid defaults value: must be an object");dt(!ut||ut===true||typeof ut==="object","Invalid source value: must be true, falsy or an object");dt(typeof pt==="object","Invalid options: must be an object");if(!ut){return null}if(pt.shallow){return ht.applyToDefaultsWithShallow(ct,ut,pt)}const mt=ft(ct);if(ut===true){return mt}const yt=pt.nullOverride!==undefined?pt.nullOverride:false;return _t(mt,ut,{nullOverride:yt,mergeArrays:false})};ht.applyToDefaultsWithShallow=function(ct,ut,pt){const yt=pt.shallow;dt(Array.isArray(yt),"Invalid keys");const vt=new Map;const St=ut===true?null:new Set;for(let pt of yt){pt=Array.isArray(pt)?pt:pt.split(".");const dt=mt(ct,pt);if(dt&&typeof dt==="object"){vt.set(dt,St&&mt(ut,pt)||dt)}else if(St){St.add(pt)}}const bt=ft(ct,{},vt);if(!St){return bt}for(const ct of St){ht.reachCopy(bt,ut,ct)}const xt=pt.nullOverride!==undefined?pt.nullOverride:false;return _t(bt,ut,{nullOverride:xt,mergeArrays:false})};ht.reachCopy=function(ct,ut,pt){for(const ct of pt){if(!(ct in ut)){return}const pt=ut[ct];if(typeof pt!=="object"||pt===null){return}ut=pt}const dt=ut;let ft=ct;for(let ct=0;ct<pt.length-1;++ct){const ut=pt[ct];if(typeof ft[ut]!=="object"){ft[ut]={}}ft=ft[ut]}ft[pt[pt.length-1]]=dt}},99583:(ct,ut,pt)=>{"use strict";const dt=pt(16443);const ft={};ct.exports=function(ct,...ut){if(ct){return}if(ut.length===1&&ut[0]instanceof Error){throw ut[0]}throw new dt(ut)}},43700:(ct,ut,pt)=>{"use strict";const dt=pt(69322);const ft=pt(99704);const _t=pt(87492);const mt={needsProtoHack:new Set([ft.set,ft.map,ft.weakSet,ft.weakMap])};ct.exports=mt.clone=function(ct,ut={},pt=null){if(typeof ct!=="object"||ct===null){return ct}let dt=mt.clone;let ht=pt;if(ut.shallow){if(ut.shallow!==true){return mt.cloneWithShallow(ct,ut)}dt=ct=>ct}else if(ht){const ut=ht.get(ct);if(ut){return ut}}else{ht=new Map}const yt=ft.getInternalProto(ct);if(yt===ft.buffer){return Buffer&&Buffer.from(ct)}if(yt===ft.date){return new Date(ct.getTime())}if(yt===ft.regex){return new RegExp(ct)}const vt=mt.base(ct,yt,ut);if(vt===ct){return ct}if(ht){ht.set(ct,vt)}if(yt===ft.set){for(const pt of ct){vt.add(dt(pt,ut,ht))}}else if(yt===ft.map){for(const[pt,ft]of ct){vt.set(pt,dt(ft,ut,ht))}}const St=_t.keys(ct,ut);for(const pt of St){if(pt==="__proto__"){continue}if(yt===ft.array&&pt==="length"){vt.length=ct.length;continue}const _t=Object.getOwnPropertyDescriptor(ct,pt);if(_t){if(_t.get||_t.set){Object.defineProperty(vt,pt,_t)}else if(_t.enumerable){vt[pt]=dt(ct[pt],ut,ht)}else{Object.defineProperty(vt,pt,{enumerable:false,writable:true,configurable:true,value:dt(ct[pt],ut,ht)})}}else{Object.defineProperty(vt,pt,{enumerable:true,writable:true,configurable:true,value:dt(ct[pt],ut,ht)})}}return vt};mt.cloneWithShallow=function(ct,ut){const pt=ut.shallow;ut=Object.assign({},ut);ut.shallow=false;const ft=new Map;for(const ut of pt){const pt=dt(ct,ut);if(typeof pt==="object"||typeof pt==="function"){ft.set(pt,pt)}}return mt.clone(ct,ut,ft)};mt.base=function(ct,ut,pt){if(pt.prototype===false){if(mt.needsProtoHack.has(ut)){return new ut.constructor}return ut===ft.array?[]:{}}const dt=Object.getPrototypeOf(ct);if(dt&&dt.isImmutable){return ct}if(ut===ft.array){const ct=[];if(dt!==ut){Object.setPrototypeOf(ct,dt)}return ct}if(mt.needsProtoHack.has(ut)){const ct=new dt.constructor;if(dt!==ut){Object.setPrototypeOf(ct,dt)}return ct}return Object.create(dt)}},35879:(ct,ut,pt)=>{"use strict";const dt=pt(99704);const ft={mismatched:null};ct.exports=function(ct,ut,pt){pt=Object.assign({prototype:true},pt);return!!ft.isDeepEqual(ct,ut,pt,[])};ft.isDeepEqual=function(ct,ut,pt,_t){if(ct===ut){return ct!==0||1/ct===1/ut}const mt=typeof ct;if(mt!==typeof ut){return false}if(ct===null||ut===null){return false}if(mt==="function"){if(!pt.deepFunction||ct.toString()!==ut.toString()){return false}}else if(mt!=="object"){return ct!==ct&&ut!==ut}const ht=ft.getSharedType(ct,ut,!!pt.prototype);switch(ht){case dt.buffer:return Buffer&&Buffer.prototype.equals.call(ct,ut);case dt.promise:return ct===ut;case dt.regex:return ct.toString()===ut.toString();case ft.mismatched:return false}for(let pt=_t.length-1;pt>=0;--pt){if(_t[pt].isSame(ct,ut)){return true}}_t.push(new ft.SeenEntry(ct,ut));try{return!!ft.isDeepEqualObj(ht,ct,ut,pt,_t)}finally{_t.pop()}};ft.getSharedType=function(ct,ut,pt){if(pt){if(Object.getPrototypeOf(ct)!==Object.getPrototypeOf(ut)){return ft.mismatched}return dt.getInternalProto(ct)}const _t=dt.getInternalProto(ct);if(_t!==dt.getInternalProto(ut)){return ft.mismatched}return _t};ft.valueOf=function(ct){const ut=ct.valueOf;if(ut===undefined){return ct}try{return ut.call(ct)}catch(ct){return ct}};ft.hasOwnEnumerableProperty=function(ct,ut){return Object.prototype.propertyIsEnumerable.call(ct,ut)};ft.isSetSimpleEqual=function(ct,ut){for(const pt of Set.prototype.values.call(ct)){if(!Set.prototype.has.call(ut,pt)){return false}}return true};ft.isDeepEqualObj=function(ct,ut,pt,_t,mt){const{isDeepEqual:ht,valueOf:yt,hasOwnEnumerableProperty:vt}=ft;const{keys:St,getOwnPropertySymbols:bt}=Object;if(ct===dt.array){if(_t.part){for(const ct of ut){for(const ut of pt){if(ht(ct,ut,_t,mt)){return true}}}}else{if(ut.length!==pt.length){return false}for(let ct=0;ct<ut.length;++ct){if(!ht(ut[ct],pt[ct],_t,mt)){return false}}return true}}else if(ct===dt.set){if(ut.size!==pt.size){return false}if(!ft.isSetSimpleEqual(ut,pt)){const ct=new Set(Set.prototype.values.call(pt));for(const pt of Set.prototype.values.call(ut)){if(ct.delete(pt)){continue}let ut=false;for(const dt of ct){if(ht(pt,dt,_t,mt)){ct.delete(dt);ut=true;break}}if(!ut){return false}}}}else if(ct===dt.map){if(ut.size!==pt.size){return false}for(const[ct,dt]of Map.prototype.entries.call(ut)){if(dt===undefined&&!Map.prototype.has.call(pt,ct)){return false}if(!ht(dt,Map.prototype.get.call(pt,ct),_t,mt)){return false}}}else if(ct===dt.error){if(ut.name!==pt.name||ut.message!==pt.message){return false}}const xt=yt(ut);const $t=yt(pt);if((ut!==xt||pt!==$t)&&!ht(xt,$t,_t,mt)){return false}const Et=St(ut);if(!_t.part&&Et.length!==St(pt).length&&!_t.skip){return false}let Ct=0;for(const ct of Et){if(_t.skip&&_t.skip.includes(ct)){if(pt[ct]===undefined){++Ct}continue}if(!vt(pt,ct)){return false}if(!ht(ut[ct],pt[ct],_t,mt)){return false}}if(!_t.part&&Et.length-Ct!==St(pt).length){return false}if(_t.symbols!==false){const ct=bt(ut);const dt=new Set(bt(pt));for(const ft of ct){if(!_t.skip||!_t.skip.includes(ft)){if(vt(ut,ft)){if(!vt(pt,ft)){return false}if(!ht(ut[ft],pt[ft],_t,mt)){return false}}else if(vt(pt,ft)){return false}}dt.delete(ft)}for(const ct of dt){if(vt(pt,ct)){return false}}}return true};ft.SeenEntry=class{constructor(ct,ut){this.obj=ct;this.ref=ut}isSame(ct,ut){return this.obj===ct&&this.ref===ut}}},16443:(ct,ut,pt)=>{"use strict";const dt=pt(72912);const ft={};ct.exports=class extends Error{constructor(ct){const pt=ct.filter((ct=>ct!=="")).map((ct=>typeof ct==="string"?ct:ct instanceof Error?ct.message:dt(ct)));super(pt.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,ut.assert)}}}},57391:ct=>{"use strict";const ut={};ct.exports=function(ct){if(!ct){return""}let pt="";for(let dt=0;dt<ct.length;++dt){const ft=ct.charCodeAt(dt);if(ut.isSafe(ft)){pt+=ct[dt]}else{pt+=ut.escapeHtmlChar(ft)}}return pt};ut.escapeHtmlChar=function(ct){const pt=ut.namedHtml.get(ct);if(pt){return pt}if(ct>=256){return"&#"+ct+";"}const dt=ct.toString(16).padStart(2,"0");return`&#x${dt};`};ut.isSafe=function(ct){return ut.safeCharCodes.has(ct)};ut.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]);ut.safeCharCodes=function(){const ct=new Set;for(let ut=32;ut<123;++ut){if(ut>=97||ut>=65&&ut<=90||ut>=48&&ut<=57||ut===32||ut===46||ut===44||ut===45||ut===58||ut===95){ct.add(ut)}}return ct}()},43935:ct=>{"use strict";const ut={};ct.exports=function(ct){return ct.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},85363:ct=>{"use strict";const ut={};ct.exports=function(){}},66621:(ct,ut,pt)=>{"use strict";const dt=pt(99583);const ft=pt(43700);const _t=pt(87492);const mt={};ct.exports=mt.merge=function(ct,ut,pt){dt(ct&&typeof ct==="object","Invalid target value: must be an object");dt(ut===null||ut===undefined||typeof ut==="object","Invalid source value: must be null, undefined, or an object");if(!ut){return ct}pt=Object.assign({nullOverride:true,mergeArrays:true},pt);if(Array.isArray(ut)){dt(Array.isArray(ct),"Cannot merge array onto an object");if(!pt.mergeArrays){ct.length=0}for(let dt=0;dt<ut.length;++dt){ct.push(ft(ut[dt],{symbols:pt.symbols}))}return ct}const ht=_t.keys(ut,pt);for(let dt=0;dt<ht.length;++dt){const _t=ht[dt];if(_t==="__proto__"||!Object.prototype.propertyIsEnumerable.call(ut,_t)){continue}const yt=ut[_t];if(yt&&typeof yt==="object"){if(ct[_t]===yt){continue}if(!ct[_t]||typeof ct[_t]!=="object"||Array.isArray(ct[_t])!==Array.isArray(yt)||yt instanceof Date||Buffer&&Buffer.isBuffer(yt)||yt instanceof RegExp){ct[_t]=ft(yt,{symbols:pt.symbols})}else{mt.merge(ct[_t],yt,pt)}}else{if(yt!==null&&yt!==undefined){ct[_t]=yt}else if(pt.nullOverride){ct[_t]=yt}}}return ct}},69322:(ct,ut,pt)=>{"use strict";const dt=pt(99583);const ft={};ct.exports=function(ct,ut,pt){if(ut===false||ut===null||ut===undefined){return ct}pt=pt||{};if(typeof pt==="string"){pt={separator:pt}}const _t=Array.isArray(ut);dt(!_t||!pt.separator,"Separator option is not valid for array-based chain");const mt=_t?ut:ut.split(pt.separator||".");let ht=ct;for(let ct=0;ct<mt.length;++ct){let _t=mt[ct];const yt=pt.iterables&&ft.iterables(ht);if(Array.isArray(ht)||yt==="set"){const ct=Number(_t);if(Number.isInteger(ct)){_t=ct<0?ht.length+ct:ct}}if(!ht||typeof ht==="function"&&pt.functions===false||!yt&&ht[_t]===undefined){dt(!pt.strict||ct+1===mt.length,"Missing segment",_t,"in reach path ",ut);dt(typeof ht==="object"||pt.functions===true||typeof ht!=="function","Invalid segment",_t,"in reach path ",ut);ht=pt.default;break}if(!yt){ht=ht[_t]}else if(yt==="set"){ht=[...ht][_t]}else{ht=ht.get(_t)}}return ht};ft.iterables=function(ct){if(ct instanceof Set){return"set"}if(ct instanceof Map){return"map"}}},72912:ct=>{"use strict";const ut={};ct.exports=function(...ct){try{return JSON.stringify(...ct)}catch(ct){return"[Cannot display object: "+ct.message+"]"}}},99704:(ct,ut)=>{"use strict";const pt={};ut=ct.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};pt.typeMap=new Map([["[object Error]",ut.error],["[object Map]",ut.map],["[object Promise]",ut.promise],["[object Set]",ut.set],["[object WeakMap]",ut.weakMap],["[object WeakSet]",ut.weakSet]]);ut.getInternalProto=function(ct){if(Array.isArray(ct)){return ut.array}if(Buffer&&ct instanceof Buffer){return ut.buffer}if(ct instanceof Date){return ut.date}if(ct instanceof RegExp){return ut.regex}if(ct instanceof Error){return ut.error}const dt=Object.prototype.toString.call(ct);return pt.typeMap.get(dt)||ut.generic}},87492:(ct,ut)=>{"use strict";const pt={};ut.keys=function(ct,ut={}){return ut.symbols!==false?Reflect.ownKeys(ct):Object.getOwnPropertyNames(ct)}},75663:(ct,ut,pt)=>{"use strict";const dt=pt(99583);const ft={};ut.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(ct,ut){ut=ut||{};const pt=[].concat(ut.before||[]);const ft=[].concat(ut.after||[]);const _t=ut.group||"?";const mt=ut.sort||0;dt(!pt.includes(_t),`Item cannot come before itself: ${_t}`);dt(!pt.includes("?"),"Item cannot come before unassociated items");dt(!ft.includes(_t),`Item cannot come after itself: ${_t}`);dt(!ft.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(ct)){ct=[ct]}for(const ut of ct){const ct={seq:this._items.length,sort:mt,before:pt,after:ft,group:_t,node:ut};this._items.push(ct)}if(!ut.manual){const ct=this._sort();dt(ct,"item",_t!=="?"?`added into group ${_t}`:"","created a dependencies error")}return this.nodes}merge(ct){if(!Array.isArray(ct)){ct=[ct]}for(const ut of ct){if(ut){for(const ct of ut._items){this._items.push(Object.assign({},ct))}}}this._items.sort(ft.mergeSort);for(let ct=0;ct<this._items.length;++ct){this._items[ct].seq=ct}const ut=this._sort();dt(ut,"merge created a dependencies error");return this.nodes}sort(){const ct=this._sort();dt(ct,"sort created a dependencies error");return this.nodes}_sort(){const ct={};const ut=Object.create(null);const pt=Object.create(null);for(const dt of this._items){const ft=dt.seq;const _t=dt.group;pt[_t]=pt[_t]||[];pt[_t].push(ft);ct[ft]=dt.before;for(const ct of dt.after){ut[ct]=ut[ct]||[];ut[ct].push(ft)}}for(const ut in ct){const dt=[];for(const ft in ct[ut]){const _t=ct[ut][ft];pt[_t]=pt[_t]||[];dt.push(...pt[_t])}ct[ut]=dt}for(const dt in ut){if(pt[dt]){for(const ft of pt[dt]){ct[ft].push(...ut[dt])}}}const dt={};for(const ut in ct){const pt=ct[ut];for(const ct of pt){dt[ct]=dt[ct]||[];dt[ct].push(ut)}}const ft={};const _t=[];for(let ct=0;ct<this._items.length;++ct){let ut=ct;if(dt[ct]){ut=null;for(let ct=0;ct<this._items.length;++ct){if(ft[ct]===true){continue}if(!dt[ct]){dt[ct]=[]}const pt=dt[ct].length;let _t=0;for(let ut=0;ut<pt;++ut){if(ft[dt[ct][ut]]){++_t}}if(_t===pt){ut=ct;break}}}if(ut!==null){ft[ut]=true;_t.push(ut)}}if(_t.length!==this._items.length){return false}const mt={};for(const ct of this._items){mt[ct.seq]=ct}this._items=[];this.nodes=[];for(const ct of _t){const ut=mt[ct];this.nodes.push(ut.node);this._items.push(ut)}return true}};ft.mergeSort=(ct,ut)=>ct.sort===ut.sort?0:ct.sort<ut.sort?-1:1},46284:function(ct,ut,pt){ct=pt.nmd(ct);(function(ut,dt){if(true){dt(ct,pt(35073),pt(17239));ct.exports=def(ct)}else{}function def(ct){return"default"in ct.exports?ct.exports.default:ct.exports}})(this,(function(ct,ut,pt){"use strict";var dt=Object.create;var ft=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var ht=Object.getPrototypeOf;var yt=Object.prototype.hasOwnProperty;var __commonJS=(ct,ut)=>function __require(){return ut||(0,ct[mt(ct)[0]])((ut={exports:{}}).exports,ut),ut.exports};var __export=(ct,ut)=>{for(var pt in ut)ft(ct,pt,{get:ut[pt],enumerable:true})};var __copyProps=(ct,ut,pt,dt)=>{if(ut&&typeof ut==="object"||typeof ut==="function"){for(let ht of mt(ut))if(!yt.call(ct,ht)&&ht!==pt)ft(ct,ht,{get:()=>ut[ht],enumerable:!(dt=_t(ut,ht))||dt.enumerable})}return ct};var __toESM=(ct,ut,pt)=>(pt=ct!=null?dt(ht(ct)):{},__copyProps(ut||!ct||!ct.__esModule?ft(pt,"default",{value:ct,enumerable:true}):pt,ct));var __toCommonJS=ct=>__copyProps(ft({},"__esModule",{value:true}),ct);var vt=__commonJS({"umd:@jridgewell/sourcemap-codec"(ct,pt){pt.exports=ut}});var St=__commonJS({"umd:@jridgewell/trace-mapping"(ct,ut){ut.exports=pt}});var bt={};__export(bt,{GenMapping:()=>Nt,addMapping:()=>addMapping,addSegment:()=>addSegment,allMappings:()=>allMappings,fromMap:()=>fromMap,maybeAddMapping:()=>maybeAddMapping,maybeAddSegment:()=>maybeAddSegment,setIgnore:()=>setIgnore,setSourceContent:()=>setSourceContent,toDecodedMap:()=>toDecodedMap,toEncodedMap:()=>toEncodedMap});ct.exports=__toCommonJS(bt);var xt=class{constructor(){this._indexes={__proto__:null};this.array=[]}};function cast(ct){return ct}function get(ct,ut){return cast(ct)._indexes[ut]}function put(ct,ut){const pt=get(ct,ut);if(pt!==void 0)return pt;const{array:dt,_indexes:ft}=cast(ct);const _t=dt.push(ut);return ft[ut]=_t-1}function remove(ct,ut){const pt=get(ct,ut);if(pt===void 0)return;const{array:dt,_indexes:ft}=cast(ct);for(let ct=pt+1;ct<dt.length;ct++){const ut=dt[ct];dt[ct-1]=ut;ft[ut]--}ft[ut]=void 0;dt.pop()}var $t=__toESM(vt());var Et=__toESM(St());var Ct=0;var Tt=1;var wt=2;var At=3;var kt=4;var It=-1;var Nt=class{constructor({file:ct,sourceRoot:ut}={}){this._names=new xt;this._sources=new xt;this._sourcesContent=[];this._mappings=[];this.file=ct;this.sourceRoot=ut;this._ignoreList=new xt}};function cast2(ct){return ct}function addSegment(ct,ut,pt,dt,ft,_t,mt,ht){return addSegmentInternal(false,ct,ut,pt,dt,ft,_t,mt,ht)}function addMapping(ct,ut){return addMappingInternal(false,ct,ut)}var maybeAddSegment=(ct,ut,pt,dt,ft,_t,mt,ht)=>addSegmentInternal(true,ct,ut,pt,dt,ft,_t,mt,ht);var maybeAddMapping=(ct,ut)=>addMappingInternal(true,ct,ut);function setSourceContent(ct,ut,pt){const{_sources:dt,_sourcesContent:ft}=cast2(ct);const _t=put(dt,ut);ft[_t]=pt}function setIgnore(ct,ut,pt=true){const{_sources:dt,_sourcesContent:ft,_ignoreList:_t}=cast2(ct);const mt=put(dt,ut);if(mt===ft.length)ft[mt]=null;if(pt)put(_t,mt);else remove(_t,mt)}function toDecodedMap(ct){const{_mappings:ut,_sources:pt,_sourcesContent:dt,_names:ft,_ignoreList:_t}=cast2(ct);removeEmptyFinalLines(ut);return{version:3,file:ct.file||void 0,names:ft.array,sourceRoot:ct.sourceRoot||void 0,sources:pt.array,sourcesContent:dt,mappings:ut,ignoreList:_t.array}}function toEncodedMap(ct){const ut=toDecodedMap(ct);return Object.assign({},ut,{mappings:(0,$t.encode)(ut.mappings)})}function fromMap(ct){const ut=new Et.TraceMap(ct);const pt=new Nt({file:ut.file,sourceRoot:ut.sourceRoot});putAll(cast2(pt)._names,ut.names);putAll(cast2(pt)._sources,ut.sources);cast2(pt)._sourcesContent=ut.sourcesContent||ut.sources.map((()=>null));cast2(pt)._mappings=(0,Et.decodedMappings)(ut);if(ut.ignoreList)putAll(cast2(pt)._ignoreList,ut.ignoreList);return pt}function allMappings(ct){const ut=[];const{_mappings:pt,_sources:dt,_names:ft}=cast2(ct);for(let ct=0;ct<pt.length;ct++){const _t=pt[ct];for(let pt=0;pt<_t.length;pt++){const mt=_t[pt];const ht={line:ct+1,column:mt[Ct]};let yt=void 0;let vt=void 0;let St=void 0;if(mt.length!==1){yt=dt.array[mt[Tt]];vt={line:mt[wt]+1,column:mt[At]};if(mt.length===5)St=ft.array[mt[kt]]}ut.push({generated:ht,source:yt,original:vt,name:St})}}return ut}function addSegmentInternal(ct,ut,pt,dt,ft,_t,mt,ht,yt){const{_mappings:vt,_sources:St,_sourcesContent:bt,_names:xt}=cast2(ut);const $t=getIndex(vt,pt);const Et=getColumnIndex($t,dt);if(!ft){if(ct&&skipSourceless($t,Et))return;return insert($t,Et,[dt])}assert(_t);assert(mt);const Ct=put(St,ft);const Tt=ht?put(xt,ht):It;if(Ct===bt.length)bt[Ct]=yt!=null?yt:null;if(ct&&skipSource($t,Et,Ct,_t,mt,Tt)){return}return insert($t,Et,ht?[dt,Ct,_t,mt,Tt]:[dt,Ct,_t,mt])}function assert(ct){}function getIndex(ct,ut){for(let pt=ct.length;pt<=ut;pt++){ct[pt]=[]}return ct[ut]}function getColumnIndex(ct,ut){let pt=ct.length;for(let dt=pt-1;dt>=0;pt=dt--){const pt=ct[dt];if(ut>=pt[Ct])break}return pt}function insert(ct,ut,pt){for(let pt=ct.length;pt>ut;pt--){ct[pt]=ct[pt-1]}ct[ut]=pt}function removeEmptyFinalLines(ct){const{length:ut}=ct;let pt=ut;for(let ut=pt-1;ut>=0;pt=ut,ut--){if(ct[ut].length>0)break}if(pt<ut)ct.length=pt}function putAll(ct,ut){for(let pt=0;pt<ut.length;pt++)put(ct,ut[pt])}function skipSourceless(ct,ut){if(ut===0)return true;const pt=ct[ut-1];return pt.length===1}function skipSource(ct,ut,pt,dt,ft,_t){if(ut===0)return false;const mt=ct[ut-1];if(mt.length===1)return false;return pt===mt[Tt]&&dt===mt[wt]&&ft===mt[At]&&_t===(mt.length===5?mt[kt]:It)}function addMappingInternal(ct,ut,pt){const{generated:dt,source:ft,original:_t,name:mt,content:ht}=pt;if(!ft){return addSegmentInternal(ct,ut,dt.line-1,dt.column,null,null,null,null,null)}assert(_t);return addSegmentInternal(ct,ut,dt.line-1,dt.column,ft,_t.line-1,_t.column,mt,ht)}}))},6001:function(ct){(function(ut,pt){true?ct.exports=pt():0})(this,(function(){"use strict";const ct=/^[\w+.-]+:\/\//;const ut=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;const pt=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function isAbsoluteUrl(ut){return ct.test(ut)}function isSchemeRelativeUrl(ct){return ct.startsWith("//")}function isAbsolutePath(ct){return ct.startsWith("/")}function isFileUrl(ct){return ct.startsWith("file:")}function isRelative(ct){return/^[.?#]/.test(ct)}function parseAbsoluteUrl(ct){const pt=ut.exec(ct);return makeUrl(pt[1],pt[2]||"",pt[3],pt[4]||"",pt[5]||"/",pt[6]||"",pt[7]||"")}function parseFileUrl(ct){const ut=pt.exec(ct);const dt=ut[2];return makeUrl("file:","",ut[1]||"","",isAbsolutePath(dt)?dt:"/"+dt,ut[3]||"",ut[4]||"")}function makeUrl(ct,ut,pt,dt,ft,_t,mt){return{scheme:ct,user:ut,host:pt,port:dt,path:ft,query:_t,hash:mt,type:7}}function parseUrl(ct){if(isSchemeRelativeUrl(ct)){const ut=parseAbsoluteUrl("http:"+ct);ut.scheme="";ut.type=6;return ut}if(isAbsolutePath(ct)){const ut=parseAbsoluteUrl("http://foo.com"+ct);ut.scheme="";ut.host="";ut.type=5;return ut}if(isFileUrl(ct))return parseFileUrl(ct);if(isAbsoluteUrl(ct))return parseAbsoluteUrl(ct);const ut=parseAbsoluteUrl("http://foo.com/"+ct);ut.scheme="";ut.host="";ut.type=ct?ct.startsWith("?")?3:ct.startsWith("#")?2:4:1;return ut}function stripPathFilename(ct){if(ct.endsWith("/.."))return ct;const ut=ct.lastIndexOf("/");return ct.slice(0,ut+1)}function mergePaths(ct,ut){normalizePath(ut,ut.type);if(ct.path==="/"){ct.path=ut.path}else{ct.path=stripPathFilename(ut.path)+ct.path}}function normalizePath(ct,ut){const pt=ut<=4;const dt=ct.path.split("/");let ft=1;let _t=0;let mt=false;for(let ct=1;ct<dt.length;ct++){const ut=dt[ct];if(!ut){mt=true;continue}mt=false;if(ut===".")continue;if(ut===".."){if(_t){mt=true;_t--;ft--}else if(pt){dt[ft++]=ut}continue}dt[ft++]=ut;_t++}let ht="";for(let ct=1;ct<ft;ct++){ht+="/"+dt[ct]}if(!ht||mt&&!ht.endsWith("/..")){ht+="/"}ct.path=ht}function resolve(ct,ut){if(!ct&&!ut)return"";const pt=parseUrl(ct);let dt=pt.type;if(ut&&dt!==7){const ct=parseUrl(ut);const ft=ct.type;switch(dt){case 1:pt.hash=ct.hash;case 2:pt.query=ct.query;case 3:case 4:mergePaths(pt,ct);case 5:pt.user=ct.user;pt.host=ct.host;pt.port=ct.port;case 6:pt.scheme=ct.scheme}if(ft>dt)dt=ft}normalizePath(pt,dt);const ft=pt.query+pt.hash;switch(dt){case 2:case 3:return ft;case 4:{const dt=pt.path.slice(1);if(!dt)return ft||".";if(isRelative(ut||ct)&&!isRelative(dt)){return"./"+dt+ft}return dt+ft}case 5:return pt.path+ft;default:return pt.scheme+"//"+pt.user+pt.host+pt.port+pt.path+ft}}return resolve}))},35073:function(ct,ut,pt){ct=pt.nmd(ct);(function(ut,pt){if(true){pt(ct);ct.exports=def(ct)}else{}function def(ct){return"default"in ct.exports?ct.exports.default:ct.exports}})(this,(function(ct){"use strict";var ut=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ft=Object.prototype.hasOwnProperty;var __export=(ct,pt)=>{for(var dt in pt)ut(ct,dt,{get:pt[dt],enumerable:true})};var __copyProps=(ct,_t,mt,ht)=>{if(_t&&typeof _t==="object"||typeof _t==="function"){for(let yt of dt(_t))if(!ft.call(ct,yt)&&yt!==mt)ut(ct,yt,{get:()=>_t[yt],enumerable:!(ht=pt(_t,yt))||ht.enumerable})}return ct};var __toCommonJS=ct=>__copyProps(ut({},"__esModule",{value:true}),ct);var _t={};__export(_t,{decode:()=>decode,decodeGeneratedRanges:()=>decodeGeneratedRanges,decodeOriginalScopes:()=>decodeOriginalScopes,encode:()=>encode,encodeGeneratedRanges:()=>encodeGeneratedRanges,encodeOriginalScopes:()=>encodeOriginalScopes});ct.exports=__toCommonJS(_t);var mt=",".charCodeAt(0);var ht=";".charCodeAt(0);var yt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var vt=new Uint8Array(64);var St=new Uint8Array(128);for(let ct=0;ct<yt.length;ct++){const ut=yt.charCodeAt(ct);vt[ct]=ut;St[ut]=ct}function decodeInteger(ct,ut){let pt=0;let dt=0;let ft=0;do{const ut=ct.next();ft=St[ut];pt|=(ft&31)<<dt;dt+=5}while(ft&32);const _t=pt&1;pt>>>=1;if(_t){pt=-2147483648|-pt}return ut+pt}function encodeInteger(ct,ut,pt){let dt=ut-pt;dt=dt<0?-dt<<1|1:dt<<1;do{let ut=dt&31;dt>>>=5;if(dt>0)ut|=32;ct.write(vt[ut])}while(dt>0);return ut}function hasMoreVlq(ct,ut){if(ct.pos>=ut)return false;return ct.peek()!==mt}var bt=1024*16;var xt=typeof TextDecoder!=="undefined"?new TextDecoder:typeof Buffer!=="undefined"?{decode(ct){const ut=Buffer.from(ct.buffer,ct.byteOffset,ct.byteLength);return ut.toString()}}:{decode(ct){let ut="";for(let pt=0;pt<ct.length;pt++){ut+=String.fromCharCode(ct[pt])}return ut}};var $t=class{constructor(){this.pos=0;this.out="";this.buffer=new Uint8Array(bt)}write(ct){const{buffer:ut}=this;ut[this.pos++]=ct;if(this.pos===bt){this.out+=xt.decode(ut);this.pos=0}}flush(){const{buffer:ct,out:ut,pos:pt}=this;return pt>0?ut+xt.decode(ct.subarray(0,pt)):ut}};var Et=class{constructor(ct){this.pos=0;this.buffer=ct}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(ct){const{buffer:ut,pos:pt}=this;const dt=ut.indexOf(ct,pt);return dt===-1?ut.length:dt}};var Ct=[];function decodeOriginalScopes(ct){const{length:ut}=ct;const pt=new Et(ct);const dt=[];const ft=[];let _t=0;for(;pt.pos<ut;pt.pos++){_t=decodeInteger(pt,_t);const ct=decodeInteger(pt,0);if(!hasMoreVlq(pt,ut)){const ut=ft.pop();ut[2]=_t;ut[3]=ct;continue}const mt=decodeInteger(pt,0);const ht=decodeInteger(pt,0);const yt=ht&1;const vt=yt?[_t,ct,0,0,mt,decodeInteger(pt,0)]:[_t,ct,0,0,mt];let St=Ct;if(hasMoreVlq(pt,ut)){St=[];do{const ct=decodeInteger(pt,0);St.push(ct)}while(hasMoreVlq(pt,ut))}vt.vars=St;dt.push(vt);ft.push(vt)}return dt}function encodeOriginalScopes(ct){const ut=new $t;for(let pt=0;pt<ct.length;){pt=_encodeOriginalScopes(ct,pt,ut,[0])}return ut.flush()}function _encodeOriginalScopes(ct,ut,pt,dt){const ft=ct[ut];const{0:_t,1:ht,2:yt,3:vt,4:St,vars:bt}=ft;if(ut>0)pt.write(mt);dt[0]=encodeInteger(pt,_t,dt[0]);encodeInteger(pt,ht,0);encodeInteger(pt,St,0);const xt=ft.length===6?1:0;encodeInteger(pt,xt,0);if(ft.length===6)encodeInteger(pt,ft[5],0);for(const ct of bt){encodeInteger(pt,ct,0)}for(ut++;ut<ct.length;){const ft=ct[ut];const{0:_t,1:mt}=ft;if(_t>yt||_t===yt&&mt>=vt){break}ut=_encodeOriginalScopes(ct,ut,pt,dt)}pt.write(mt);dt[0]=encodeInteger(pt,yt,dt[0]);encodeInteger(pt,vt,0);return ut}function decodeGeneratedRanges(ct){const{length:ut}=ct;const pt=new Et(ct);const dt=[];const ft=[];let _t=0;let mt=0;let ht=0;let yt=0;let vt=0;let St=0;let bt=0;let xt=0;do{const ct=pt.indexOf(";");let ut=0;for(;pt.pos<ct;pt.pos++){ut=decodeInteger(pt,ut);if(!hasMoreVlq(pt,ct)){const ct=ft.pop();ct[2]=_t;ct[3]=ut;continue}const $t=decodeInteger(pt,0);const Et=$t&1;const Tt=$t&2;const wt=$t&4;let At=null;let kt=Ct;let It;if(Et){const ct=decodeInteger(pt,mt);ht=decodeInteger(pt,mt===ct?ht:0);mt=ct;It=[_t,ut,0,0,ct,ht]}else{It=[_t,ut,0,0]}It.isScope=!!wt;if(Tt){const ct=yt;const ut=vt;yt=decodeInteger(pt,yt);const dt=ct===yt;vt=decodeInteger(pt,dt?vt:0);St=decodeInteger(pt,dt&&ut===vt?St:0);At=[yt,vt,St]}It.callsite=At;if(hasMoreVlq(pt,ct)){kt=[];do{bt=_t;xt=ut;const ct=decodeInteger(pt,0);let dt;if(ct<-1){dt=[[decodeInteger(pt,0)]];for(let ut=-1;ut>ct;ut--){const ct=bt;bt=decodeInteger(pt,bt);xt=decodeInteger(pt,bt===ct?xt:0);const ut=decodeInteger(pt,0);dt.push([ut,bt,xt])}}else{dt=[[ct]]}kt.push(dt)}while(hasMoreVlq(pt,ct))}It.bindings=kt;dt.push(It);ft.push(It)}_t++;pt.pos=ct+1}while(pt.pos<ut);return dt}function encodeGeneratedRanges(ct){if(ct.length===0)return"";const ut=new $t;for(let pt=0;pt<ct.length;){pt=_encodeGeneratedRanges(ct,pt,ut,[0,0,0,0,0,0,0])}return ut.flush()}function _encodeGeneratedRanges(ct,ut,pt,dt){const ft=ct[ut];const{0:_t,1:ht,2:yt,3:vt,isScope:St,callsite:bt,bindings:xt}=ft;if(dt[0]<_t){catchupLine(pt,dt[0],_t);dt[0]=_t;dt[1]=0}else if(ut>0){pt.write(mt)}dt[1]=encodeInteger(pt,ft[1],dt[1]);const $t=(ft.length===6?1:0)|(bt?2:0)|(St?4:0);encodeInteger(pt,$t,0);if(ft.length===6){const{4:ct,5:ut}=ft;if(ct!==dt[2]){dt[3]=0}dt[2]=encodeInteger(pt,ct,dt[2]);dt[3]=encodeInteger(pt,ut,dt[3])}if(bt){const{0:ct,1:ut,2:_t}=ft.callsite;if(ct!==dt[4]){dt[5]=0;dt[6]=0}else if(ut!==dt[5]){dt[6]=0}dt[4]=encodeInteger(pt,ct,dt[4]);dt[5]=encodeInteger(pt,ut,dt[5]);dt[6]=encodeInteger(pt,_t,dt[6])}if(xt){for(const ct of xt){if(ct.length>1)encodeInteger(pt,-ct.length,0);const ut=ct[0][0];encodeInteger(pt,ut,0);let dt=_t;let ft=ht;for(let ut=1;ut<ct.length;ut++){const _t=ct[ut];dt=encodeInteger(pt,_t[1],dt);ft=encodeInteger(pt,_t[2],ft);encodeInteger(pt,_t[0],0)}}}for(ut++;ut<ct.length;){const ft=ct[ut];const{0:_t,1:mt}=ft;if(_t>yt||_t===yt&&mt>=vt){break}ut=_encodeGeneratedRanges(ct,ut,pt,dt)}if(dt[0]<yt){catchupLine(pt,dt[0],yt);dt[0]=yt;dt[1]=0}else{pt.write(mt)}dt[1]=encodeInteger(pt,vt,dt[1]);return ut}function catchupLine(ct,ut,pt){do{ct.write(ht)}while(++ut<pt)}function decode(ct){const{length:ut}=ct;const pt=new Et(ct);const dt=[];let ft=0;let _t=0;let mt=0;let ht=0;let yt=0;do{const ct=pt.indexOf(";");const ut=[];let vt=true;let St=0;ft=0;while(pt.pos<ct){let dt;ft=decodeInteger(pt,ft);if(ft<St)vt=false;St=ft;if(hasMoreVlq(pt,ct)){_t=decodeInteger(pt,_t);mt=decodeInteger(pt,mt);ht=decodeInteger(pt,ht);if(hasMoreVlq(pt,ct)){yt=decodeInteger(pt,yt);dt=[ft,_t,mt,ht,yt]}else{dt=[ft,_t,mt,ht]}}else{dt=[ft]}ut.push(dt);pt.pos++}if(!vt)sort(ut);dt.push(ut);pt.pos=ct+1}while(pt.pos<=ut);return dt}function sort(ct){ct.sort(sortComparator)}function sortComparator(ct,ut){return ct[0]-ut[0]}function encode(ct){const ut=new $t;let pt=0;let dt=0;let ft=0;let _t=0;for(let yt=0;yt<ct.length;yt++){const vt=ct[yt];if(yt>0)ut.write(ht);if(vt.length===0)continue;let St=0;for(let ct=0;ct<vt.length;ct++){const ht=vt[ct];if(ct>0)ut.write(mt);St=encodeInteger(ut,ht[0],St);if(ht.length===1)continue;pt=encodeInteger(ut,ht[1],pt);dt=encodeInteger(ut,ht[2],dt);ft=encodeInteger(ut,ht[3],ft);if(ht.length===4)continue;_t=encodeInteger(ut,ht[4],_t)}}return ut.flush()}}))},17239:function(ct,ut,pt){ct=pt.nmd(ct);(function(ut,dt){if(true){dt(ct,pt(6001),pt(35073));ct.exports=def(ct)}else{}function def(ct){return"default"in ct.exports?ct.exports.default:ct.exports}})(this,(function(ct,ut,pt){"use strict";var dt=Object.create;var ft=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var ht=Object.getPrototypeOf;var yt=Object.prototype.hasOwnProperty;var __commonJS=(ct,ut)=>function __require(){return ut||(0,ct[mt(ct)[0]])((ut={exports:{}}).exports,ut),ut.exports};var __export=(ct,ut)=>{for(var pt in ut)ft(ct,pt,{get:ut[pt],enumerable:true})};var __copyProps=(ct,ut,pt,dt)=>{if(ut&&typeof ut==="object"||typeof ut==="function"){for(let ht of mt(ut))if(!yt.call(ct,ht)&&ht!==pt)ft(ct,ht,{get:()=>ut[ht],enumerable:!(dt=_t(ut,ht))||dt.enumerable})}return ct};var __toESM=(ct,ut,pt)=>(pt=ct!=null?dt(ht(ct)):{},__copyProps(ut||!ct||!ct.__esModule?ft(pt,"default",{value:ct,enumerable:true}):pt,ct));var __toCommonJS=ct=>__copyProps(ft({},"__esModule",{value:true}),ct);var vt=__commonJS({"umd:@jridgewell/sourcemap-codec"(ct,ut){ut.exports=pt}});var St=__commonJS({"umd:@jridgewell/resolve-uri"(ct,pt){pt.exports=ut}});var bt={};__export(bt,{AnyMap:()=>FlattenMap,FlattenMap:()=>FlattenMap,GREATEST_LOWER_BOUND:()=>Ft,LEAST_UPPER_BOUND:()=>Dt,TraceMap:()=>Mt,allGeneratedPositionsFor:()=>allGeneratedPositionsFor,decodedMap:()=>decodedMap,decodedMappings:()=>decodedMappings,eachMapping:()=>eachMapping,encodedMap:()=>encodedMap,encodedMappings:()=>encodedMappings,generatedPositionFor:()=>generatedPositionFor,isIgnored:()=>isIgnored,originalPositionFor:()=>originalPositionFor,presortedDecodedMap:()=>presortedDecodedMap,sourceContentFor:()=>sourceContentFor,traceSegment:()=>traceSegment});ct.exports=__toCommonJS(bt);var xt=__toESM(vt());var $t=__toESM(St());function stripFilename(ct){if(!ct)return"";const ut=ct.lastIndexOf("/");return ct.slice(0,ut+1)}function resolver(ct,ut){const pt=stripFilename(ct);const dt=ut?ut+"/":"";return ct=>(0,$t.default)(dt+(ct||""),pt)}var Et=0;var Ct=1;var Tt=2;var wt=3;var At=4;var kt=1;var It=2;function maybeSort(ct,ut){const pt=nextUnsortedSegmentLine(ct,0);if(pt===ct.length)return ct;if(!ut)ct=ct.slice();for(let dt=pt;dt<ct.length;dt=nextUnsortedSegmentLine(ct,dt+1)){ct[dt]=sortSegments(ct[dt],ut)}return ct}function nextUnsortedSegmentLine(ct,ut){for(let pt=ut;pt<ct.length;pt++){if(!isSorted(ct[pt]))return pt}return ct.length}function isSorted(ct){for(let ut=1;ut<ct.length;ut++){if(ct[ut][Et]<ct[ut-1][Et]){return false}}return true}function sortSegments(ct,ut){if(!ut)ct=ct.slice();return ct.sort(sortComparator)}function sortComparator(ct,ut){return ct[Et]-ut[Et]}function buildBySources(ct,ut){const pt=ut.map((()=>[]));for(let ut=0;ut<ct.length;ut++){const dt=ct[ut];for(let ct=0;ct<dt.length;ct++){const ft=dt[ct];if(ft.length===1)continue;const _t=ft[Ct];const mt=ft[Tt];const ht=ft[wt];const yt=pt[_t];const vt=yt[mt]||(yt[mt]=[]);vt.push([ht,ut,ft[Et]])}}for(let ct=0;ct<pt.length;ct++){const ut=pt[ct];for(let ct=0;ct<ut.length;ct++){const pt=ut[ct];if(pt)pt.sort(sortComparator)}}return pt}var Nt=false;function binarySearch(ct,ut,pt,dt){while(pt<=dt){const ft=pt+(dt-pt>>1);const _t=ct[ft][Et]-ut;if(_t===0){Nt=true;return ft}if(_t<0){pt=ft+1}else{dt=ft-1}}Nt=false;return pt-1}function upperBound(ct,ut,pt){for(let dt=pt+1;dt<ct.length;pt=dt++){if(ct[dt][Et]!==ut)break}return pt}function lowerBound(ct,ut,pt){for(let dt=pt-1;dt>=0;pt=dt--){if(ct[dt][Et]!==ut)break}return pt}function memoizedState(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function memoizedBinarySearch(ct,ut,pt,dt){const{lastKey:ft,lastNeedle:_t,lastIndex:mt}=pt;let ht=0;let yt=ct.length-1;if(dt===ft){if(ut===_t){Nt=mt!==-1&&ct[mt][Et]===ut;return mt}if(ut>=_t){ht=mt===-1?0:mt}else{yt=mt}}pt.lastKey=dt;pt.lastNeedle=ut;return pt.lastIndex=binarySearch(ct,ut,ht,yt)}function parse(ct){return typeof ct==="string"?JSON.parse(ct):ct}var FlattenMap=function(ct,ut){const pt=parse(ct);if(!("sections"in pt)){return new Mt(pt,ut)}const dt=[];const ft=[];const _t=[];const mt=[];const ht=[];recurse(pt,ut,dt,ft,_t,mt,ht,0,0,Infinity,Infinity);const yt={version:3,file:pt.file,names:mt,sources:ft,sourcesContent:_t,mappings:dt,ignoreList:ht};return presortedDecodedMap(yt)};function recurse(ct,ut,pt,dt,ft,_t,mt,ht,yt,vt,St){const{sections:bt}=ct;for(let ct=0;ct<bt.length;ct++){const{map:xt,offset:$t}=bt[ct];let Et=vt;let Ct=St;if(ct+1<bt.length){const ut=bt[ct+1].offset;Et=Math.min(vt,ht+ut.line);if(Et===vt){Ct=Math.min(St,yt+ut.column)}else if(Et<vt){Ct=yt+ut.column}}addSection(xt,ut,pt,dt,ft,_t,mt,ht+$t.line,yt+$t.column,Et,Ct)}}function addSection(ct,ut,pt,dt,ft,_t,mt,ht,yt,vt,St){const bt=parse(ct);if("sections"in bt)return recurse(...arguments);const xt=new Mt(bt,ut);const $t=dt.length;const kt=_t.length;const It=decodedMappings(xt);const{resolvedSources:Nt,sourcesContent:Pt,ignoreList:Ot}=xt;append(dt,Nt);append(_t,xt.names);if(Pt)append(ft,Pt);else for(let ct=0;ct<Nt.length;ct++)ft.push(null);if(Ot)for(let ct=0;ct<Ot.length;ct++)mt.push(Ot[ct]+$t);for(let ct=0;ct<It.length;ct++){const ut=ht+ct;if(ut>vt)return;const dt=getLine(pt,ut);const ft=ct===0?yt:0;const _t=It[ct];for(let ct=0;ct<_t.length;ct++){const pt=_t[ct];const mt=ft+pt[Et];if(ut===vt&&mt>=St)return;if(pt.length===1){dt.push([mt]);continue}const ht=$t+pt[Ct];const yt=pt[Tt];const bt=pt[wt];dt.push(pt.length===4?[mt,ht,yt,bt]:[mt,ht,yt,bt,kt+pt[At]])}}}function append(ct,ut){for(let pt=0;pt<ut.length;pt++)ct.push(ut[pt])}function getLine(ct,ut){for(let pt=ct.length;pt<=ut;pt++)ct[pt]=[];return ct[ut]}var Pt="`line` must be greater than 0 (lines start at line 1)";var Ot="`column` must be greater than or equal to 0 (columns start at column 0)";var Dt=-1;var Ft=1;var Mt=class{constructor(ct,ut){const pt=typeof ct==="string";if(!pt&&ct._decodedMemo)return ct;const dt=parse(ct);const{version:ft,file:_t,names:mt,sourceRoot:ht,sources:yt,sourcesContent:vt}=dt;this.version=ft;this.file=_t;this.names=mt||[];this.sourceRoot=ht;this.sources=yt;this.sourcesContent=vt;this.ignoreList=dt.ignoreList||dt.x_google_ignoreList||void 0;const St=resolver(ut,ht);this.resolvedSources=yt.map(St);const{mappings:bt}=dt;if(typeof bt==="string"){this._encoded=bt;this._decoded=void 0}else if(Array.isArray(bt)){this._encoded=void 0;this._decoded=maybeSort(bt,pt)}else if(dt.sections){throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`)}else{throw new Error(`invalid source map: ${JSON.stringify(dt)}`)}this._decodedMemo=memoizedState();this._bySources=void 0;this._bySourceMemos=void 0}};function cast(ct){return ct}function encodedMappings(ct){var ut,pt;return(pt=(ut=cast(ct))._encoded)!=null?pt:ut._encoded=(0,xt.encode)(cast(ct)._decoded)}function decodedMappings(ct){var ut;return(ut=cast(ct))._decoded||(ut._decoded=(0,xt.decode)(cast(ct)._encoded))}function traceSegment(ct,ut,pt){const dt=decodedMappings(ct);if(ut>=dt.length)return null;const ft=dt[ut];const _t=traceSegmentInternal(ft,cast(ct)._decodedMemo,ut,pt,Ft);return _t===-1?null:ft[_t]}function originalPositionFor(ct,ut){let{line:pt,column:dt,bias:ft}=ut;pt--;if(pt<0)throw new Error(Pt);if(dt<0)throw new Error(Ot);const _t=decodedMappings(ct);if(pt>=_t.length)return OMapping(null,null,null,null);const mt=_t[pt];const ht=traceSegmentInternal(mt,cast(ct)._decodedMemo,pt,dt,ft||Ft);if(ht===-1)return OMapping(null,null,null,null);const yt=mt[ht];if(yt.length===1)return OMapping(null,null,null,null);const{names:vt,resolvedSources:St}=ct;return OMapping(St[yt[Ct]],yt[Tt]+1,yt[wt],yt.length===5?vt[yt[At]]:null)}function generatedPositionFor(ct,ut){const{source:pt,line:dt,column:ft,bias:_t}=ut;return generatedPosition(ct,pt,dt,ft,_t||Ft,false)}function allGeneratedPositionsFor(ct,ut){const{source:pt,line:dt,column:ft,bias:_t}=ut;return generatedPosition(ct,pt,dt,ft,_t||Dt,true)}function eachMapping(ct,ut){const pt=decodedMappings(ct);const{names:dt,resolvedSources:ft}=ct;for(let ct=0;ct<pt.length;ct++){const _t=pt[ct];for(let pt=0;pt<_t.length;pt++){const mt=_t[pt];const ht=ct+1;const yt=mt[0];let vt=null;let St=null;let bt=null;let xt=null;if(mt.length!==1){vt=ft[mt[1]];St=mt[2]+1;bt=mt[3]}if(mt.length===5)xt=dt[mt[4]];ut({generatedLine:ht,generatedColumn:yt,source:vt,originalLine:St,originalColumn:bt,name:xt})}}}function sourceIndex(ct,ut){const{sources:pt,resolvedSources:dt}=ct;let ft=pt.indexOf(ut);if(ft===-1)ft=dt.indexOf(ut);return ft}function sourceContentFor(ct,ut){const{sourcesContent:pt}=ct;if(pt==null)return null;const dt=sourceIndex(ct,ut);return dt===-1?null:pt[dt]}function isIgnored(ct,ut){const{ignoreList:pt}=ct;if(pt==null)return false;const dt=sourceIndex(ct,ut);return dt===-1?false:pt.includes(dt)}function presortedDecodedMap(ct,ut){const pt=new Mt(clone(ct,[]),ut);cast(pt)._decoded=ct.mappings;return pt}function decodedMap(ct){return clone(ct,decodedMappings(ct))}function encodedMap(ct){return clone(ct,encodedMappings(ct))}function clone(ct,ut){return{version:ct.version,file:ct.file,names:ct.names,sourceRoot:ct.sourceRoot,sources:ct.sources,sourcesContent:ct.sourcesContent,mappings:ut,ignoreList:ct.ignoreList||ct.x_google_ignoreList}}function OMapping(ct,ut,pt,dt){return{source:ct,line:ut,column:pt,name:dt}}function GMapping(ct,ut){return{line:ct,column:ut}}function traceSegmentInternal(ct,ut,pt,dt,ft){let _t=memoizedBinarySearch(ct,dt,ut,pt);if(Nt){_t=(ft===Dt?upperBound:lowerBound)(ct,dt,_t)}else if(ft===Dt)_t++;if(_t===-1||_t===ct.length)return-1;return _t}function sliceGeneratedPositions(ct,ut,pt,dt,ft){let _t=traceSegmentInternal(ct,ut,pt,dt,Ft);if(!Nt&&ft===Dt)_t++;if(_t===-1||_t===ct.length)return[];const mt=Nt?dt:ct[_t][Et];if(!Nt)_t=lowerBound(ct,mt,_t);const ht=upperBound(ct,mt,_t);const yt=[];for(;_t<=ht;_t++){const ut=ct[_t];yt.push(GMapping(ut[kt]+1,ut[It]))}return yt}function generatedPosition(ct,ut,pt,dt,ft,_t){var mt,ht;pt--;if(pt<0)throw new Error(Pt);if(dt<0)throw new Error(Ot);const{sources:yt,resolvedSources:vt}=ct;let St=yt.indexOf(ut);if(St===-1)St=vt.indexOf(ut);if(St===-1)return _t?[]:GMapping(null,null);const bt=(mt=cast(ct))._bySourceMemos||(mt._bySourceMemos=yt.map(memoizedState));const xt=(ht=cast(ct))._bySources||(ht._bySources=buildBySources(decodedMappings(ct),bt));const $t=xt[St][pt];if($t==null)return _t?[]:GMapping(null,null);const Et=bt[St];if(_t)return sliceGeneratedPositions($t,Et,pt,dt,ft);const Ct=traceSegmentInternal($t,Et,pt,dt,ft);if(Ct===-1)return GMapping(null,null);const Tt=$t[Ct];return GMapping(Tt[kt]+1,Tt[It])}}))},3563:(ct,ut,pt)=>{const{parse:dt,format:ft}=pt(87016);const{pathToRegexp:_t,compile:mt,parse:ht}=pt(44985);ct.exports=Layer;function Layer(ct,ut,pt,dt={}){this.opts=dt;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(pt)?pt:[pt];for(const ct of ut){const ut=this.methods.push(ct.toUpperCase());if(this.methods[ut-1]==="GET")this.methods.unshift("HEAD")}for(let pt=0;pt<this.stack.length;pt++){const dt=this.stack[pt];const ft=typeof dt;if(ft!=="function")throw new Error(`${ut.toString()} \`${this.opts.name||ct}\`: \`middleware\` must be a function, not \`${ft}\``)}this.path=ct;this.regexp=_t(ct,this.paramNames,this.opts)}Layer.prototype.match=function(ct){return this.regexp.test(ct)};Layer.prototype.params=function(ct,ut,pt={}){for(let ct=ut.length,dt=0;dt<ct;dt++){if(this.paramNames[dt]){const ct=ut[dt];if(ct&&ct.length>0)pt[this.paramNames[dt].name]=ct?safeDecodeURIComponent(ct):ct}}return pt};Layer.prototype.captures=function(ct){return this.opts.ignoreCaptures?[]:ct.match(this.regexp).slice(1)};Layer.prototype.url=function(ct,ut){let pt=ct;const _t=this.path.replace(/\(\.\*\)/g,"");if(typeof ct!=="object"){pt=Array.prototype.slice.call(arguments);if(typeof pt[pt.length-1]==="object"){ut=pt[pt.length-1];pt=pt.slice(0,-1)}}const yt=mt(_t,{encode:encodeURIComponent,...ut});let vt;const St=ht(_t);let bt={};if(Array.isArray(pt)){for(let ct=St.length,ut=0,dt=0;ut<ct;ut++){if(St[ut].name)bt[St[ut].name]=pt[dt++]}}else if(St.some((ct=>ct.name))){bt=ct}else if(!ut){ut=ct}vt=yt(bt);if(ut&&ut.query){vt=dt(vt);if(typeof ut.query==="string"){vt.search=ut.query}else{vt.search=undefined;vt.query=ut.query}return ft(vt)}return vt};Layer.prototype.param=function(ct,ut){const{stack:pt}=this;const dt=this.paramNames;const middleware=function(pt,dt){return ut.call(this,pt.params[ct],pt,dt)};middleware.param=ct;const ft=dt.map((function(ct){return ct.name}));const _t=ft.indexOf(ct);if(_t>-1){pt.some((function(ct,ut){if(!ct.param||ft.indexOf(ct.param)>_t){pt.splice(ut,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(ct){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${ct}${this.path}`:ct;this.paramNames=[];this.regexp=_t(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(ct){try{return decodeURIComponent(ct)}catch{return ct}}},53777:(ct,ut,pt)=>{const dt=pt(77246);const ft=pt(58024);const _t=pt(93);const{pathToRegexp:mt}=pt(44985);const ht=pt(3563);const yt=pt(26675)("koa-router");ct.exports=Router;function Router(ct={}){if(!(this instanceof Router))return new Router(ct);this.opts=ct;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 vt of _t){function setMethodVerb(ct){Router.prototype[ct]=function(ut,pt,dt){if(typeof pt==="string"||pt instanceof RegExp){dt=Array.prototype.slice.call(arguments,2)}else{dt=Array.prototype.slice.call(arguments,1);pt=ut;ut=null}if(typeof pt!=="string"&&!(pt instanceof RegExp)&&(!Array.isArray(pt)||pt.length===0))throw new Error(`You have to provide a path when adding a ${ct} handler`);this.register(pt,[ct],dt,{name:ut});return this}}setMethodVerb(vt)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const ct=this;const ut=Array.prototype.slice.call(arguments);let pt;if(Array.isArray(ut[0])&&typeof ut[0][0]==="string"){const ft=ut[0];for(const _t of ft){ct.use.apply(ct,[_t].concat(ut.slice(1)))}return this}const dt=typeof ut[0]==="string";if(dt)pt=ut.shift();for(const yt of ut){if(yt.router){const vt=Object.assign(Object.create(Router.prototype),yt.router,{stack:[...yt.router.stack]});for(let St=0;St<vt.stack.length;St++){const bt=vt.stack[St];const xt=Object.assign(Object.create(ht.prototype),bt);if(pt)xt.setPrefix(pt);if(ct.opts.prefix)xt.setPrefix(ct.opts.prefix);ct.stack.push(xt);vt.stack[St]=xt}if(ct.params){function setRouterParams(ut){const pt=ut;for(const ut of pt){vt.param(ut,ct.params[ut])}}setRouterParams(Object.keys(ct.params))}}else{const $t=[];mt(ct.opts.prefix||"",$t);const Et=ct.opts.prefix&&$t.length;ct.register(pt||"([^/]*)",[],yt,{end:false,ignoreCaptures:!dt&&!Et})}}return this};Router.prototype.prefix=function(ct){ct=ct.replace(/\/$/,"");this.opts.prefix=ct;for(let ut=0;ut<this.stack.length;ut++){const pt=this.stack[ut];pt.setPrefix(ct)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const ct=this;const ut=function dispatch(ut,pt){yt("%s %s",ut.method,ut.path);const ft=ct.matchHost(ut.host);if(!ft){return pt()}const _t=ct.opts.routerPath||ut.newRouterPath||ut.path||ut.routerPath;const mt=ct.match(_t,ut.method);let ht;if(ut.matched){ut.matched.push.apply(ut.matched,mt.path)}else{ut.matched=mt.path}ut.router=ct;if(!mt.route)return pt();const vt=mt.pathAndMethod;const St=vt[vt.length-1];ut._matchedRoute=St.path;if(St.name){ut._matchedRouteName=St.name}ht=(ct.exclusive?[St]:vt).reduce((function(ct,ut){ct.push((function(ct,pt){ct.captures=ut.captures(_t,ct.captures);ct.params=ct.request.params=ut.params(_t,ct.captures,ct.params);ct.routerPath=ut.path;ct.routerName=ut.name;ct._matchedRoute=ut.path;if(ut.name){ct._matchedRouteName=ut.name}return pt()}));return ct.concat(ut.stack)}),[]);return dt(ht)(ut,pt)};ut.router=this;return ut};Router.prototype.allowedMethods=function(ct={}){const ut=this.methods;return function allowedMethods(pt,dt){return dt().then((function(){const dt={};if(!pt.status||pt.status===404){for(let ct=0;ct<pt.matched.length;ct++){const ut=pt.matched[ct];for(let ct=0;ct<ut.methods.length;ct++){const pt=ut.methods[ct];dt[pt]=pt}}const _t=Object.keys(dt);if(!~ut.indexOf(pt.method)){if(ct.throw){const ut=typeof ct.notImplemented==="function"?ct.notImplemented():new ft.NotImplemented;throw ut}else{pt.status=501;pt.set("Allow",_t.join(", "))}}else if(_t.length>0){if(pt.method==="OPTIONS"){pt.status=200;pt.body="";pt.set("Allow",_t.join(", "))}else if(!dt[pt.method]){if(ct.throw){const ut=typeof ct.methodNotAllowed==="function"?ct.methodNotAllowed():new ft.MethodNotAllowed;throw ut}else{pt.status=405;pt.set("Allow",_t.join(", "))}}}}}))}};Router.prototype.all=function(ct,ut,pt){if(typeof ut==="string"){pt=Array.prototype.slice.call(arguments,2)}else{pt=Array.prototype.slice.call(arguments,1);ut=ct;ct=null}if(typeof ut!=="string"&&!(ut instanceof RegExp)&&(!Array.isArray(ut)||ut.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(ut,_t,pt,{name:ct});return this};Router.prototype.redirect=function(ct,ut,pt){if(typeof ct==="symbol"||ct[0]!=="/"){ct=this.url(ct);if(ct instanceof Error)throw ct}if(typeof ut==="symbol"||ut[0]!=="/"&&!ut.includes("://")){ut=this.url(ut);if(ut instanceof Error)throw ut}return this.all(ct,(ct=>{ct.redirect(ut);ct.status=pt||301}))};Router.prototype.register=function(ct,ut,pt,dt={}){const ft=this;const{stack:_t}=this;if(Array.isArray(ct)){for(const _t of ct){ft.register.call(ft,_t,ut,pt,dt)}return this}const mt=new ht(ct,ut,pt,{end:dt.end===false?dt.end:true,name:dt.name,sensitive:dt.sensitive||this.opts.sensitive||false,strict:dt.strict||this.opts.strict||false,prefix:dt.prefix||this.opts.prefix||"",ignoreCaptures:dt.ignoreCaptures});if(this.opts.prefix){mt.setPrefix(this.opts.prefix)}for(let ct=0;ct<Object.keys(this.params).length;ct++){const ut=Object.keys(this.params)[ct];mt.param(ut,this.params[ut])}_t.push(mt);yt("defined route %s %s",mt.methods,mt.path);return mt};Router.prototype.route=function(ct){const ut=this.stack;for(let pt=ut.length,dt=0;dt<pt;dt++){if(ut[dt].name&&ut[dt].name===ct)return ut[dt]}return false};Router.prototype.url=function(ct,ut){const pt=this.route(ct);if(pt){const ct=Array.prototype.slice.call(arguments,1);return pt.url.apply(pt,ct)}return new Error(`No route found for name: ${String(ct)}`)};Router.prototype.match=function(ct,ut){const pt=this.stack;let dt;const ft={path:[],pathAndMethod:[],route:false};for(let _t=pt.length,mt=0;mt<_t;mt++){dt=pt[mt];yt("test %s %s",dt.path,dt.regexp);if(dt.match(ct)){ft.path.push(dt);if(dt.methods.length===0||~dt.methods.indexOf(ut)){ft.pathAndMethod.push(dt);if(dt.methods.length>0)ft.route=true}}}return ft};Router.prototype.matchHost=function(ct){const{host:ut}=this;if(!ut){return true}if(!ct){return false}if(typeof ut==="string"){return ct===ut}if(typeof ut==="object"&&ut instanceof RegExp){return ut.test(ct)}};Router.prototype.param=function(ct,ut){this.params[ct]=ut;for(let pt=0;pt<this.stack.length;pt++){const dt=this.stack[pt];dt.param(ct,ut)}return this};Router.url=function(ct){const ut=Array.prototype.slice.call(arguments,1);return ht.prototype.url.apply({path:ct},ut)}},86979:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.AsyncHooksContextManager=void 0;const dt=pt(46123);const ft=pt(90290);class AsyncHooksContextManager{constructor(){this._contexts=new Map;this._stack=[];this._asyncHook=ft.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 ct;return(ct=this._stack[this._stack.length-1])!==null&&ct!==void 0?ct:dt.ASYNC_ROOT_CONTEXT}with(ct,ut,pt,...dt){this._enterContext(ct);try{return ut.call(pt,...dt)}finally{this._exitContext()}}enable(){this._asyncHook.enable();return this}disable(){this._asyncHook.disable();this._contexts.clear();this._stack=[];return this}_init(ct,ut){if(ut==="TIMERWRAP")return;const pt=this._stack[this._stack.length-1];if(pt!==undefined){this._contexts.set(ct,pt)}}_destroy(ct){this._contexts.delete(ct)}_before(ct){const ut=this._contexts.get(ct);if(ut!==undefined){this._enterContext(ut)}}_after(){this._exitContext()}_enterContext(ct){this._stack.push(ct)}_exitContext(){this._stack.pop()}bind(ct,ut){if(typeof ut==="function"){const pt=this;const contextWrapper=function(...dt){return pt.with(ct,(()=>ut.apply(this,dt)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:ut.length});return contextWrapper}return ut}}ut.AsyncHooksContextManager=AsyncHooksContextManager},63259:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.AsyncLocalStorageContextManager=void 0;const dt=pt(46123);const ft=pt(90290);class AsyncLocalStorageContextManager{constructor(){this._asyncLocalStorage=new ft.AsyncLocalStorage}active(){var ct;return(ct=this._asyncLocalStorage.getStore())!==null&&ct!==void 0?ct:dt.ASYNC_ROOT_CONTEXT}with(ct,ut,pt,...dt){const ft=pt==null?ut:ut.bind(pt);return this._asyncLocalStorage.run(ct,ft,...dt)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(ct,ut){if(typeof ut==="function"){const pt=this;const contextWrapper=function(...dt){return pt.with(ct,(()=>ut.apply(this,dt)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:ut.length});return contextWrapper}return ut}}ut.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},44101:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.createContextManager=ut.isSemverGreaterThanOrEqualTo=void 0;ft(pt(86979),ut);ft(pt(63259),ut);var _t=pt(43349);Object.defineProperty(ut,"isSemverGreaterThanOrEqualTo",{enumerable:true,get:function(){return _t.isSemverGreaterThanOrEqualTo}});Object.defineProperty(ut,"createContextManager",{enumerable:true,get:function(){return _t.createContextManager}})},43349:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createContextManager=ut.isSemverGreaterThanOrEqualTo=void 0;const dt=pt(63259);const ft=pt(86979);const _t=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i;function isSemverGreaterThanOrEqualTo(ct,ut){const pt=_t.exec(ct);const dt=_t.exec(ut);if(pt&&dt){if(pt[1]===dt[1]&&pt[2]===dt[2]&&pt[3]===dt[3]&&pt[4]===dt[4]){return true}return gteString(pt[1],dt[1])||pt[1]===dt[1]&&gteString(pt[2],dt[2])||pt[1]===dt[1]&&pt[2]===dt[2]&&gteString(pt[3],dt[3])||pt[1]===dt[1]&&pt[2]===dt[2]&&pt[3]===dt[3]&&gteString(pt[4],dt[4])}return false}ut.isSemverGreaterThanOrEqualTo=isSemverGreaterThanOrEqualTo;function gteString(ct,ut){const pt=parseInt(ct,10);const dt=parseInt(ut,10);return pt>dt}function createContextManager(){const ct=isSemverGreaterThanOrEqualTo(process.version,"14.8.0")?dt.AsyncLocalStorageContextManager:ft.AsyncHooksContextManager;return new ct}ut.createContextManager=createContextManager},26733:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Bootstrap=ut.BootstrapStarter=void 0;const dt=pt(46123);const ft=pt(16928);const _t=pt(51169);const mt=pt(44101);const ht=pt(5982);const yt=pt(92364);class BootstrapStarter{constructor(){this.globalOptions={}}configure(ct={}){this.globalOptions=ct;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 ht.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new ht.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const ct=await(0,dt.loadModule)((0,ft.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=(ct===null||ct===void 0?void 0:ct.type)==="module"?"esm":"commonjs"}this.applicationContext=await(0,dt.initializeGlobalApplicationContext)({asyncContextManager:(0,mt.createContextManager)(),loggerFactory:_t.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 ct=this.applicationContext.get(dt.MidwayApplicationManager);const ut=ct.getApplication("socketIO");(0,yt.setupWorker)(ut)}}const ct=this.applicationContext.get(dt.MidwayFrameworkService);if(!ct.getMainApp()){throw new dt.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,dt.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,dt.isTypeScriptEnvironment)()){return(0,ft.join)(this.appDir,"src")}else{return(0,ft.join)(this.appDir,"dist")}}}ut.BootstrapStarter=BootstrapStarter;class Bootstrap{static configure(ct={}){this.configured=true;if(!this.logger&&!ct.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(ct.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}ct.logger=this.logger}else{this.logger=this.logger||ct.logger}if(ct.appDir&&ct.appDir!==process.cwd()){process.chdir(ct.appDir)}this.getStarter().configure(ct);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((ct=>{this.logger.error(ct);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(ct){this.logger.info("[midway:bootstrap] receive signal %s, closing",ct);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(ct){this.logger.error("[midway:bootstrap] close with error: ",ct);process.exit(1)}}static onExit(ct){this.logger.info("[midway:bootstrap] exit with code:%s",ct)}static uncaughtExceptionHandler(ct){if(!(ct instanceof Error)){ct=new Error(String(ct))}if(ct.name==="Error"){ct.name="unhandledExceptionError"}this.logger.error(ct)}static unhandledRejectionHandler(ct){if(!(ct instanceof Error)){const ut=new Error(String(ct));if(ct){if(ct.name)ut.name=ct.name;if(ct.message)ut.message=ct.message;if(ct.stack)ut.stack=ct.stack}ct=ut}if(ct.name==="Error"){ct.name="unhandledRejectionError"}this.logger.error(ct)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}ut.Bootstrap=Bootstrap;Bootstrap.configured=false;Bootstrap.bootstrapLoggerFactory=new _t.MidwayLoggerContainer},84575:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.setupStickyMaster=ut.AbstractForkManager=ut.ClusterManager=ut.BootstrapStarter=ut.Bootstrap=void 0;ft(pt(82516),ut);var _t=pt(26733);Object.defineProperty(ut,"Bootstrap",{enumerable:true,get:function(){return _t.Bootstrap}});Object.defineProperty(ut,"BootstrapStarter",{enumerable:true,get:function(){return _t.BootstrapStarter}});var mt=pt(93772);Object.defineProperty(ut,"ClusterManager",{enumerable:true,get:function(){return mt.ClusterManager}});var ht=pt(84338);Object.defineProperty(ut,"AbstractForkManager",{enumerable:true,get:function(){return ht.AbstractForkManager}});var yt=pt(92364);Object.defineProperty(ut,"setupStickyMaster",{enumerable:true,get:function(){return yt.setupStickyMaster}})},82516:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},84338:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.AbstractForkManager=void 0;const dt=pt(70857);const ft=pt(39023);const _t=pt(53599);const mt=pt(24434);const ht=pt(39023);const yt=(0,ht.debuglog)("midway:bootstrap");class AbstractForkManager{constructor(ct){this.options=ct;this.reforks=[];this.disconnectCount=0;this.unexpectedCount=0;this.disconnects={};this.hub=new mt.EventEmitter;this.workers=new Map;this.isClosing=false;ct.count=ct.count||dt.cpus().length-1;ct.refork=ct.refork!==false;ct.limit=ct.limit||60;ct.duration=ct.duration||6e4;ct.logger=ct.logger||console;ct.workerInitTimeout=ct.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:ct.workerInitTimeout})}async start(){yt("Start manager with options: %j",this.options);this.bindWorkerDisconnect((ct=>{yt(" - worker(%s): trigger event = disconnect",this.getWorkerId(ct));const ut=this.options.logger[ct["disableRefork"]?"info":"error"];this.disconnectCount++;const pt=this.isWorkerDead(ct);if(pt){yt(" - worker(%s): worker is dead",this.getWorkerId(ct));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,_t.logDate)(),process.pid,this.getWorkerId(ct));return}if(ct["disableRefork"]){yt(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(ct));ut("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,_t.logDate)(),process.pid,this.getWorkerId(ct));return}this.disconnects[this.getWorkerId(ct)]=(0,_t.logDate)();this.tryToRefork(ct)}));this.bindWorkerExit(((ct,ut,pt)=>{yt(" - worker(%s): trigger event = exit",this.getWorkerId(ct));this.workers.delete(this.getWorkerId(ct));if(ct["disableRefork"]){return}const dt=!!this.disconnects[this.getWorkerId(ct)];yt(" - worker(%s): isExpected=%s",this.getWorkerId(ct),dt);if(dt){delete this.disconnects[this.getWorkerId(ct)];return}yt(" - worker(%s): isWorkerDead=%s",this.getWorkerId(ct),this.isWorkerDead(ct));if(this.isWorkerDead(ct)){return}yt(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(ct);this.onUnexpected(ct,ut,pt)}));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 ct=0;ct<this.options.count;ct++){const ct=this.createWorker();yt(" - worker(%s) created",this.getWorkerId(ct));this.eventBus.addWorker(ct);this.workers.set(this.getWorkerId(ct),ct)}await this.eventBus.start()}tryToRefork(ct){if(this.allowRefork()){yt(" - worker(%s): allow refork and will fork new",this.getWorkerId(ct));const ut=this.createWorker(ct);this.workers.set(this.getWorkerId(ut),ut);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,_t.logDate)(),process.pid,this.getWorkerId(ut),ut["state"]);this.eventBus.addWorker(ut)}else{yt(" - worker(%s): forbidden refork and will stop",this.getWorkerId(ct));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,_t.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const ct=this.reforks.push(Date.now());if(ct>this.options.limit){this.reforks.shift()}const ut=this.reforks[this.reforks.length-1]-this.reforks[0];const pt=this.reforks.length<this.options.limit||ut>this.options.duration;if(!pt){this.hub.emit("reachReforkLimit")}return pt}onerror(ct){if(!ct){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,_t.logDate)(),process.pid,ct.stack);this.options.logger.error(ct);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(ct,ut,pt){const dt=ct.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const mt=new Error(ft.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(ct),ut,pt,dt,ct[dt],ct["state"]));mt.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,_t.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,mt.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,_t.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(ct,ut){await this.closeWorker(ct);await Promise.race([(0,mt.once)(ct,"exit"),(0,_t.sleep)(ut)]);if(ct.killed)return;(ct.process||ct).kill("SIGKILL")}async stop(ct=2e3){yt("run close");this.isClosing=true;await this.eventBus.stop();for(const ut of this.workers.values()){ut["disableRefork"]=true;await this.killWorker(ut,ct)}if(this.exitListener){await this.exitListener()}}hasWorker(ct){return this.workers.has(ct)}getWorker(ct){return this.workers.get(ct)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(ct){this.exitListener=ct}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(ct){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",ct);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(ct){this.options.logger.error("[midway:master] close with error: ",ct);process.exit(1)}}}onMasterExit(ct){this.options.logger.info("[bootstrap:master] exit with code:%s",ct)}}ut.AbstractForkManager=AbstractForkManager},93772:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ClusterManager=void 0;const dt=pt(5982);const ft=pt(84338);const _t=pt(29907);const mt=pt(39023);const ht=pt(46123);const yt=(0,mt.debuglog)("midway:bootstrap");class ClusterManager extends ft.AbstractForkManager{constructor(ct={}){super(ct);this.options=ct;ct.args=ct.args||[];ct.execArgv=ct.execArgv||[];if((0,ht.isTypeScriptEnvironment)()){ct.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(_t["setupPrimary"]){_t["setupPrimary"](this.options)}else if(_t["setupMaster"]){_t["setupMaster"](this.options)}return _t.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(ct){yt("Bind cluster.disconnect event");_t.on("disconnect",ct)}bindWorkerExit(ct){yt("Bind cluster.exit event");_t.on("exit",ct)}getWorkerId(ct){return String(ct.process.pid)}isWorkerDead(ct){return ct.isDead()}closeWorker(ct){ct.kill("SIGTERM")}createEventBus(ct){return new dt.ChildProcessEventBus(ct)}isPrimary(){return!_t.isWorker}}ut.ClusterManager=ClusterManager},92364:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.setupWorker=ut.setupStickyMaster=void 0;const dt=pt(29907);const ft=pt(76982);const randomId=()=>(0,ft.randomBytes)(8).toString("hex");function setupStickyMaster(ct,ut={}){const pt={loadBalancingMethod:"least-connection",...ut};const ft=new Map;const _t=/sid=([\w-]{20})/;let mt=0;const computeWorkerId=ct=>{const ut=_t.exec(ct);if(ut){const ct=ut[1];const pt=ft.get(ct);if(pt&&dt.workers[pt]){return pt}}switch(pt.loadBalancingMethod){case"random":{const ct=Object.keys(dt.workers);return ct[Math.floor(Math.random()*ct.length)]}case"round-robin":{const ct=Object.keys(dt.workers);mt++;if(mt>=ct.length){mt=0}return ct[mt]}case"least-connection":let ct;for(const ut in dt.workers){const pt=dt.workers[ut];if(ct===undefined){ct=pt}else{const ut=pt["clientsCount"]||0;const dt=ct["clientsCount"]||0;if(ut<dt){ct=pt}}}return ct.id}};ct.on("connection",(ct=>{let ut,pt;const sendCallback=ut=>{if(ut){ct.destroy()}};ct.on("data",(ft=>{let _t="utf-8";let mt=ft.toString(_t);if(ut&&pt){dt.workers[ut].send({type:"sticky:http-chunk",data:mt,encoding:_t,connectionId:pt},sendCallback);return}ut=computeWorkerId(mt);const ht=!(mt.startsWith("GET")||mt.substring(0,mt.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(mt.startsWith("POST")&&mt.includes("multipart/form-data")){_t="base64";mt=ft.toString("base64")}ct.pause();if(ht){pt=randomId()}dt.workers[ut].send({type:"sticky:connection",data:mt,encoding:_t,connectionId:pt},ct,{keepOpen:ht},sendCallback)}))}));ct.on("request",(ct=>{ct.on("data",(()=>{}))}));dt.on("message",((ct,{type:ut,data:dt})=>{switch(ut){case"sticky:connection":ft.set(dt,ct.id);if(pt.loadBalancingMethod==="least-connection"){ct["clientsCount"]=(ct["clientsCount"]||0)+1}break;case"sticky:disconnection":ft.delete(dt);if(pt.loadBalancingMethod==="least-connection"){ct["clientsCount"]--}break}}))}ut.setupStickyMaster=setupStickyMaster;function setupWorker(ct){const ut=new Map;process.on("message",(({type:pt,data:dt,encoding:ft,connectionId:_t},mt)=>{switch(pt){case"sticky:connection":if(!mt){return}ct.httpServer.emit("connection",mt);mt.emit("data",Buffer.from(dt,ft));mt.resume();if(_t){ut.set(_t,mt);mt.on("close",(()=>{ut.delete(_t)}))}break;case"sticky:http-chunk":{const ct=ut.get(_t);if(ct){ct.emit("data",Buffer.from(dt,ft))}}}}));const ignoreError=()=>{};ct.engine.on("connection",(ct=>{process.send({type:"sticky:connection",data:ct.id},ignoreError);ct.once("close",(()=>{process.send({type:"sticky:disconnection",data:ct.id},ignoreError)}))}))}ut.setupWorker=setupWorker},53599:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.sleep=ut.logDate=void 0;function logDate(){const ct=new Date;let ut=ct.getDate();if(ut<10){ut="0"+ut}let pt=ct.getMonth()+1;if(pt<10){pt="0"+pt}let dt=ct.getHours();if(dt<10){dt="0"+dt}let ft=ct.getMinutes();if(ft<10){ft="0"+ft}let _t=ct.getSeconds();if(_t<10){_t="0"+_t}let mt=ct.getMilliseconds();if(mt<10){mt="00"+mt}else if(mt<100){mt="0"+mt}return ct.getFullYear()+"-"+pt+"-"+ut+" "+dt+":"+ft+":"+_t+"."+mt}ut.logDate=logDate;async function sleep(ct){return new Promise((ut=>{setTimeout(ut,ct)}))}ut.sleep=sleep},64080:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.multiCaching=ut.createCache=ut.caching=void 0;const dt=pt(48851);const ft=pt(87932);async function caching(ct,ut){if(ct==="memory"){const ct=(0,ft.memoryStore)(ut);return createCache(ct,ut)}if(typeof ct==="function"){const pt=await ct(ut);return createCache(pt,ut)}return createCache(ct,ut)}ut.caching=caching;function createCache(ct,ut){return{wrap:async(pt,ft,_t)=>(0,dt.coalesceAsync)(pt,(async()=>{const mt=await ct.get(pt);if(mt===undefined){const ut=await ft();const dt=typeof _t==="function"?_t(ut):_t;await ct.set(pt,ut,dt);return ut}else if(ut===null||ut===void 0?void 0:ut.refreshThreshold){const ht=typeof _t==="function"?_t(mt):_t;const yt=await ct.ttl(pt);if(yt!==-1&&yt<ut.refreshThreshold){(0,dt.coalesceAsync)(`+++${pt}`,ft).then((ut=>ct.set(pt,ut,ht)))}}return mt})),store:ct,del:ut=>ct.del(ut),get:ut=>ct.get(ut),set:(ut,pt,dt)=>ct.set(ut,pt,dt),reset:()=>ct.reset(),methodWrap:async(pt,ft,_t,mt)=>(0,dt.coalesceAsync)(pt,(async()=>{const ht=await ct.get(pt);if(ht===undefined){const ut=await ft(..._t);const dt=typeof mt==="function"?mt(ut):mt;await ct.set(pt,ut,dt);return ut}else if(ut===null||ut===void 0?void 0:ut.refreshThreshold){const yt=typeof mt==="function"?mt(ht):mt;const vt=await ct.ttl(pt);if(vt!==-1&&vt<ut.refreshThreshold){(0,dt.coalesceAsync)(`+++${pt}`,(()=>ft(..._t))).then((ut=>ct.set(pt,ut,yt)))}}return ht}))}}ut.createCache=createCache;function multiCaching(ct){const get=async ut=>{for(const pt of ct){try{const ct=await pt.get(ut);if(ct!==undefined)return ct}catch(ct){}}};const set=async(ut,pt,dt)=>{await Promise.all(ct.map((ct=>ct.set(ut,pt,dt))))};return{get:get,set:set,del:async ut=>{await Promise.all(ct.map((ct=>ct.del(ut))))},async wrap(ut,pt,dt){let ft;let _t=0;for(;_t<ct.length;_t++){try{ft=await ct[_t].get(ut);if(ft!==undefined)break}catch(ct){}}if(ft===undefined){const ct=await pt();const ft=typeof dt==="function"?dt(ct):dt;await set(ut,ct,ft);return ct}else{const mt=typeof dt==="function"?dt(ft):dt;Promise.all(ct.slice(0,_t).map((ct=>ct.set(ut,ft,mt)))).then();ct[_t].wrap(ut,pt,dt).then()}return ft},reset:async()=>{await Promise.all(ct.map((ct=>ct.reset())))},mget:async(...ut)=>{const pt=new Array(ut.length).fill(undefined);for(const dt of ct){if(pt.every((ct=>ct!==undefined)))break;try{const ct=await dt.store.mget(...ut);ct.forEach(((ct,ut)=>{if(pt[ut]===undefined&&ct!==undefined)pt[ut]=ct}))}catch(ct){}}return pt},mset:async(ut,pt)=>{await Promise.all(ct.map((ct=>ct.store.mset(ut,pt))))},mdel:async(...ut)=>{await Promise.all(ct.map((ct=>ct.store.mdel(...ut))))},methodWrap:async(ut,pt,dt,ft)=>{let _t;let mt=0;for(;mt<ct.length;mt++){try{_t=await ct[mt].get(ut);if(_t!==undefined)break}catch(ct){}}if(_t===undefined){const ct=await pt(...dt);const _t=typeof ft==="function"?ft(ct):ft;await set(ut,ct,_t);return ct}else{const ht=typeof ft==="function"?ft(_t):ft;Promise.all(ct.slice(0,mt).map((ct=>ct.set(ut,_t,ht)))).then();ct[mt].methodWrap(ut,pt,dt,ft).then()}return _t}}}ut.multiCaching=multiCaching},8869:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ft(pt(64080),ut);ft(pt(87932),ut);ft(pt(91724),ut)},48851:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.coalesceAsync=void 0;const pt=new Map;async function coalesceAsync(ct,ut){if(!hasKey(ct)){addKey(ct);try{const pt=await Promise.resolve(ut());coalesce({key:ct,result:pt});return pt}catch(ut){coalesce({key:ct,error:ut});throw ut}}return enqueue(ct)}ut.coalesceAsync=coalesceAsync;function hasKey(ct){return pt.has(ct)}function addKey(ct){pt.set(ct,[])}function removeKey(ct){pt.delete(ct)}function addCallbackToKey(ct,ut){const dt=getCallbacksByKey(ct);dt.push(ut);pt.set(ct,dt)}function getCallbacksByKey(ct){var ut;return(ut=pt.get(ct))!==null&&ut!==void 0?ut:[]}function enqueue(ct){return new Promise(((ut,pt)=>{const dt={resolve:ut,reject:pt};addCallbackToKey(ct,dt)}))}function dequeue(ct){const ut=getCallbacksByKey(ct);removeKey(ct);return ut}function coalesce(ct){const{key:ut,error:pt,result:dt}=ct;dequeue(ut).forEach((ct=>{if(pt){ct.reject(pt)}else{ct.resolve(dt)}}))}},87932:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.memoryStore=void 0;const dt=pt(57223);const ft=pt(19944);function clone(ct){if(typeof ct==="object"&&ct!==null){return ft(ct)}return ct}function memoryStore(ct){var ut;const pt=(ct===null||ct===void 0?void 0:ct.shouldCloneBeforeSet)!==false;const ft=(ut=ct===null||ct===void 0?void 0:ct.isCacheable)!==null&&ut!==void 0?ut:ct=>ct!==undefined;const _t={ttlAutopurge:true,...ct,max:(ct===null||ct===void 0?void 0:ct.max)||500,ttl:(ct===null||ct===void 0?void 0:ct.ttl)!==undefined?ct.ttl:0};const mt=new dt(_t);return{async del(ct){mt.delete(ct)},get:async ct=>mt.get(ct),keys:async()=>[...mt.keys()],mget:async(...ct)=>ct.map((ct=>mt.get(ct))),async mset(ct,ut){const dt={ttl:ut!==undefined?ut:_t.ttl};for(const[ut,_t]of ct){if(!ft(_t))throw new Error(`no cacheable value ${JSON.stringify(_t)}`);if(pt)mt.set(ut,clone(_t),dt);else mt.set(ut,_t,dt)}},async mdel(...ct){for(const ut of ct)mt.delete(ut)},async reset(){mt.clear()},ttl:async ct=>mt.getRemainingTTL(ct),async set(ct,ut,dt){if(!ft(ut))throw new Error(`no cacheable value ${JSON.stringify(ut)}`);if(pt)ut=clone(ut);const ht=dt!==undefined?dt:_t.ttl;mt.set(ct,ut,{ttl:ht})},get calculatedSize(){return mt.calculatedSize},get size(){return mt.size},dump:()=>mt.dump(),load:(...ct)=>mt.load(...ct)}}ut.memoryStore=memoryStore},91724:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},68805:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.CacheConfiguration=ut.getClassMethodDefaultCacheKey=void 0;const _t=pt(46123);const mt=pt(42696);const ht=pt(91761);function getClassMethodDefaultCacheKey(ct,ut){return ct.name+"-"+(0,_t.getProviderUUId)(ct)+"-"+ut}ut.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;let yt=class CacheConfiguration{async onReady(ct){this.cacheService=await ct.getAsync(ht.CachingFactory);this.decoratorService.registerMethodHandler(mt.CACHE_DECORATOR_KEY,(({target:ct,propertyName:ut,metadata:pt})=>{if(!pt.cacheKey){pt.cacheKey=getClassMethodDefaultCacheKey(ct,ut)}return{around:async ct=>{let ut=pt.cacheKey;const dt=this.cacheService.get(pt.cacheInstanceName);if(typeof ut==="function"){ut=await ut({methodArgs:ct.args,ctx:ct.target[_t.REQUEST_OBJ_CTX_KEY],target:ct.target})}if(typeof ut==="string"){return dt.methodWrap(ut,ct.proceed,ct.args,pt.ttl)}else{return ct.proceed(...ct.args)}}}}))}};dt([(0,_t.Inject)(),ft("design:type",_t.MidwayDecoratorService)],yt.prototype,"decoratorService",void 0);yt=dt([(0,_t.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],yt);ut.CacheConfiguration=yt},42696:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Caching=ut.CACHE_DECORATOR_KEY=void 0;const dt=pt(46123);ut.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(ct,pt,ft){if(typeof pt==="number"){ft=pt;pt=undefined}return(0,dt.createCustomMethodDecorator)(ut.CACHE_DECORATOR_KEY,{cacheInstanceName:ct,cacheKey:pt,ttl:ft})}ut.Caching=Caching},91761:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.CachingFactory=void 0;const _t=pt(46123);const mt=pt(8869);let ht=class CachingFactory extends _t.ServiceFactory{async init(){await this.initClients(this.cacheManagerConfig)}async createClient(ct,ut){if(Array.isArray(ct.store)){const pt=[];for(const dt of ct.store){if(typeof dt==="string"){if(!this.has(dt)){throw new _t.MidwayCommonError(`cache instance "${dt}" not found in "${ut}", please check your configuration.`)}pt.push(this.get(dt))}else if(typeof dt==="function"){pt.push(await dt())}else if(dt["wrap"]){pt.push(dt["wrap"])}else if(typeof dt==="object"){if(typeof dt.store==="function"){dt.store=await dt.store(dt["options"]||{},this.applicationContext)}if(!dt.store){throw new _t.MidwayCommonError(`cache instance "${ut}" store is undefined, please check your configuration.`)}pt.push(await(0,mt.caching)(dt.store,dt["options"]))}else{throw new _t.MidwayCommonError("invalid cache config")}}return await(0,mt.multiCaching)(pt)}else{if(typeof ct.store==="function"){ct.store=await ct.store(ct["options"]||{},this.applicationContext)}if(!ct.store){throw new _t.MidwayCommonError(`cache instance "${ut}" store is undefined, please check your configuration.`)}return await(0,mt.caching)(ct.store,ct["options"])}}getName(){return"cache-manager"}getCaching(ct){return this.get(ct)}getMultiCaching(ct){return this.get(ct)}};dt([(0,_t.Config)("cacheManager"),ft("design:type",Object)],ht.prototype,"cacheManagerConfig",void 0);dt([(0,_t.ApplicationContext)(),ft("design:type",Object)],ht.prototype,"applicationContext",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],ht.prototype,"init",null);ht=dt([(0,_t.Provide)(),(0,_t.Scope)(_t.ScopeEnum.Singleton)],ht);ut.CachingFactory=ht},96955:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.CacheManager=ut.getClassMethodDefaultCacheKey=ut.Configuration=void 0;var _t=pt(68805);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.CacheConfiguration}});Object.defineProperty(ut,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return _t.getClassMethodDefaultCacheKey}});ft(pt(43488),ut);ft(pt(91761),ut);ft(pt(42696),ut);ut.CacheManager=pt(8869);ft(pt(93730),ut)},43488:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},93730:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createRedisStore=void 0;const dt=pt(46123);const getVal=ct=>JSON.stringify(ct)||'"undefined"';function createRedisStore(ct){return async(ut,pt)=>{const{RedisServiceFactory:ft}=(0,dt.safeRequire)("@midwayjs/redis");const _t=await pt.getAsync(ft);const mt=_t.get(ct);return createStore(mt,ut)}}ut.createRedisStore=createRedisStore;function createStore(ct,ut){const pt=(ut===null||ut===void 0?void 0:ut.isCacheable)||(ct=>ct!==undefined&&ct!==null);const keys=ut=>ct.keys(ut);return{async get(ut){const pt=await ct.get(ut);if(pt===undefined||pt===null)return undefined;else{try{return JSON.parse(pt)}catch(ct){return pt}}},async set(ft,_t,mt){if(!pt(_t))throw new dt.MidwayCommonError(`"${_t}" is not a cacheable value`);const ht=mt===undefined?ut===null||ut===void 0?void 0:ut.ttl:mt;if(ht!==undefined&&ht!==0)await ct.set(ft,getVal(_t),"PX",ht);else await ct.set(ft,getVal(_t))},async mset(ft,_t){const mt=_t===undefined?ut===null||ut===void 0?void 0:ut.ttl:_t;if(mt!==undefined&&mt!==0){const ut=ct.multi();for(const[ct,_t]of ft){if(!pt(_t))throw new dt.MidwayCommonError(`"${getVal(_t)}" is not a cacheable value`);ut.set(ct,getVal(_t),"PX",mt)}await ut.exec()}else await ct.mset(ft.flatMap((([ct,ut])=>{if(!pt(ut))throw new Error(`"${getVal(ut)}" is not a cacheable value`);return[ct,getVal(ut)]})))},mget:(...ut)=>ct.mget(ut).then((ct=>ct.map((ct=>{if(ct===null||ct===undefined){return undefined}else{try{return JSON.parse(ct)}catch(ut){return ct}}})))),async mdel(...ut){await ct.del(ut)},async del(ut){await ct.del(ut)},ttl:async ut=>ct.pttl(ut),keys:(ct="*")=>keys(ct),reset:()=>{throw new dt.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:pt}}},4074:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Cookie=void 0;const dt=pt(42613);const ft=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const _t=/^(?:none|lax|strict)$/i;class Cookie{constructor(ct,ut,pt){dt(ft.test(ct),"argument name is invalid");dt(!ut||ft.test(ut),"argument value is invalid");this.name=ct;this.value=ut||"";this.attrs=mergeDefaultAttrs(pt);dt(!this.attrs.path||ft.test(this.attrs.path),"argument option path is invalid");dt(!this.attrs.domain||ft.test(this.attrs.domain),"argument option domain is invalid");dt(!this.attrs.sameSite||this.attrs.sameSite===true||_t.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!ut){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let ct=this.toString();const ut=this.attrs;if(ut.path)ct+="; path="+ut.path;const pt=typeof ut.maxAge==="string"?parseInt(ut.maxAge,10):ut.maxAge;if(pt){ct+="; max-age="+Math.round(pt/1e3);ut.expires=new Date(Date.now()+pt)}if(ut.expires)ct+="; expires="+ut.expires.toUTCString();if(ut.domain)ct+="; domain="+ut.domain;if(ut.sameSite)ct+="; samesite="+(ut.sameSite===true?"strict":ut.sameSite.toLowerCase());if(ut.secure)ct+="; secure";if(ut.httpOnly)ct+="; httponly";if(ut.priority)ct+="; priority="+ut.priority;if(ut.partitioned)ct+="; partitioned";return ct}}ut.Cookie=Cookie;const mt=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(ct){const ut={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!ct)return ut;for(let pt=0;pt<mt.length;pt++){const dt=mt[pt];if(dt in ct)ut[dt]=ct[dt]}return ut}},11033:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.urlSafeDecode=ut.urlSafeEncode=ut.Cookies=void 0;const dt=pt(42613);const ft=pt(4074);const _t=pt(5693);const mt=pt(86054);const ht=Symbol("midwayCookies:keysArray");const yt=Symbol("midwayCookies:keys");const vt=new Map;class Cookies{constructor(ct,ut,pt,dt){var ft;this[ht]=ut?[].concat(ut):ut;this._defaultCookieOptions=pt;this._defaultGetCookieOptions=dt;this.ctx=ct;this.secure=(ft=pt===null||pt===void 0?void 0:pt.secure)!==null&&ft!==void 0?ft:this.ctx.secure;this.app=ct.app}get keys(){if(!this[yt]){const ct=this[ht];dt(Array.isArray(ct),".keys required for encrypt/sign cookies");const ut=vt.get(ct);if(ut){this[yt]=ut}else{this[yt]=new _t.Keygrip(this[ht]);vt.set(ct,this[yt])}}return this[yt]}get(ct,ut){ut=Object.assign({},this._defaultGetCookieOptions||{},ut);const pt=computeSigned(ut);const dt=this.ctx.get("cookie");if(!dt)return;const ft=dt.match(getPattern(ct));if(!ft)return;let _t=ft[1];if(!ut.encrypt&&!pt)return _t;if(pt){const ut=ct+".sig";const pt=this.get(ut,{signed:false});if(!pt)return;const dt=ct+"="+_t;const ft=this.keys.verify(dt,pt);if(ft<0){this.set(ut,null,{path:"/",signed:false});return}if(ft>0){this.set(ut,this.keys.sign(dt),{signed:false})}return _t}_t=urlSafeDecode(_t);const mt=this.keys.decrypt(_t);if(mt===null||mt===void 0?void 0:mt.value){return mt.value.toString()}return undefined}set(ct,ut,pt){if(!pt&&typeof ut!=="string"){pt=ut;ut=""}pt=Object.assign({},this._defaultCookieOptions,pt);const dt=computeSigned(pt);ut=ut||"";if(!this.secure&&pt.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let _t=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(_t))_t=[_t];if(pt.encrypt){ut=ut&&urlSafeEncode(this.keys.encrypt(ut))}if(ut.length>4093){this.app.emit("cookieLimitExceed",{name:ct,value:ut,ctx:this.ctx})}const mt=this.ctx.get("user-agent");if(pt.sameSite&&typeof pt.sameSite==="string"&&pt.sameSite.toLowerCase()==="none"){if(!this.secure||mt&&!this.isSameSiteNoneCompatible(mt)){pt.sameSite=false}}if(pt.partitioned){if(!this.secure||!mt||mt&&!this.isPartitionedCompatible(mt)){pt.partitioned=false}}if(pt.partitioned&&pt.removeUnpartitioned){const ut=pt.overwrite;if(ut){pt.overwrite=false;_t=ignoreCookiesByName(_t,ct)}const mt=Object.assign({},pt,{partitioned:false});const ht=new ft.Cookie(ct,"",mt);if(pt.secure===undefined)ht.attrs.secure=this.secure;_t=pushCookie(_t,ht);if(dt){ht.name+=".sig";_t=ignoreCookiesByName(_t,ht.name);_t=pushCookie(_t,ht)}}if(pt.priority){if(!mt||mt&&!this.isPriorityCompatible(mt)){pt.priority=undefined}}const ht=new ft.Cookie(ct,ut,pt);if(pt.secure===undefined)ht.attrs.secure=this.secure;_t=pushCookie(_t,ht);if(dt){ht.value=ut&&this.keys.sign(ht.toString());ht.name+=".sig";_t=pushCookie(_t,ht)}this.ctx.set("set-cookie",_t);return this}isSameSiteNoneCompatible(ct){const ut=this.parseChromiumAndMajorVersion(ct);if(ut.chromium&&ut.majorVersion){return ut.majorVersion>=80}return(0,mt.isSameSiteNoneCompatible)(ct)}isPartitionedCompatible(ct){const ut=this.parseChromiumAndMajorVersion(ct);if(ut.chromium&&ut.majorVersion){return ut.majorVersion>=114}return false}parseChromiumAndMajorVersion(ct){if(!this.uaParseResult){const ut=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(ct);if(!ut)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(ut[1])}}return this.uaParseResult}isPriorityCompatible(ct){const ut=this.parseChromiumAndMajorVersion(ct);if(ut.chromium&&ut.majorVersion){return ut.majorVersion>=81}return false}}ut.Cookies=Cookies;const St=new Map;function getPattern(ct){const ut=St.get(ct);if(ut)return ut;const pt=new RegExp("(?:^|;) *"+ct.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");St.set(ct,pt);return pt}function computeSigned(ct){if(ct.encrypt)return false;return ct.signed!==false}function pushCookie(ct,ut){if(ut.attrs.overwrite){ct=ignoreCookiesByName(ct,ut.name)}ct.push(ut.toHeader());return ct}function ignoreCookiesByName(ct,ut){const pt=`${ut}=`;return ct.filter((ct=>!ct.startsWith(pt)))}function urlSafeEncode(ct){return ct.replace(/\+/g,"-").replace(/\//g,"_")}ut.urlSafeEncode=urlSafeEncode;function urlSafeDecode(ct){return ct.replace(/-/g,"+").replace(/_/g,"/")}ut.urlSafeDecode=urlSafeDecode},60990:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ft(pt(33249),ut);ft(pt(11033),ut)},33249:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},5693:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Keygrip=void 0;const dt=pt(42613);const ft=pt(39023);const _t=pt(76982);const mt=pt(48978);const ht=(0,ft.debuglog)("midway:cookies");const yt={"/":"_","+":"-","=":""};class Keygrip{constructor(ct){dt(Array.isArray(ct)&&ct.length,"keys must be provided and should be an array");this.keys=ct;this.hash="sha256"}encrypt(ct,ut){ut=ut||this.keys[0];try{ct=String(ct);const pt=getAlgorithm();const dt=(0,_t.randomBytes)(64);const ft=(0,_t.randomBytes)(16);const mt=Math.floor(Math.random()*(99999-1e4+1))+1e4;const ht=deriveKeyFromPassword(ut,dt,Math.floor(mt*.47+1337));const yt=(0,_t.createCipheriv)(pt,ht,ft);const vt=Buffer.concat([yt.update(ct,"utf8"),yt.final()]);const St=yt.getAuthTag();const bt=Buffer.concat([dt,ft,St,Buffer.from(mt.toString()),vt]).toString("hex");return getEncryptedPrefix()+bt}catch(ct){ht("crypt error",ct.stack);return undefined}}decrypt(ct,ut){if(!ut){const ut=this.keys;for(let pt=0;pt<ut.length;pt++){const dt=this.decrypt(ct,ut[pt]);if(dt!==false)return{value:dt,index:pt}}return false}try{const pt=getAlgorithm();const dt=ct.split(getEncryptedPrefix());if(dt.length!==2){return void 0}else{ct=dt[1]}const ft=Buffer.from(ct,"hex");const mt=ft.slice(0,64);const ht=ft.slice(64,80);const yt=ft.slice(80,96);const vt=parseInt(ft.slice(96,101).toString("utf-8"),10);const St=ft.slice(101);const bt=deriveKeyFromPassword(ut,mt,Math.floor(vt*.47+1337));const xt=(0,_t.createDecipheriv)(pt,bt,ht);xt.setAuthTag(yt);return xt.update(St,"binary","utf-8")+xt.final("utf-8")}catch(ct){ht("crypt error",ct.stack);return false}}sign(ct,ut){ut=ut||this.keys[0];return(0,_t.createHmac)(this.hash,ut).update(ct).digest("base64").replace(/\/|\+|=/g,(ct=>yt[ct]))}verify(ct,ut){const pt=this.keys;for(let dt=0;dt<pt.length;dt++){if(mt(Buffer.from(ut),Buffer.from(this.sign(ct,pt[dt])))){ht("data %s match key %s",ct,pt[dt]);return dt}}return-1}}ut.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(ct,ut,pt){return(0,_t.pbkdf2Sync)(ct,ut,pt,32,"sha512")}},83872:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.BaseFramework=void 0;const _t=pt(6192);const mt=pt(2222);const ht=pt(49757);const yt=pt(97983);const vt=pt(70275);const St=pt(78842);const bt=pt(37482);const xt=pt(34888);const $t=pt(12738);const Et=pt(68220);const Ct=pt(39408);const Tt=pt(77306);const wt=pt(39023);const At=pt(75351);const kt=pt(40581);const It=wt.debuglog("midway:debug");class BaseFramework{constructor(ct){this.applicationContext=ct;this.defaultContext={};this.middlewareManager=this.createMiddlewareManager();this.filterManager=this.createFilterManager();this.guardManager=this.createGuardManager();this.composeMiddleware=null}async init(){var ct,ut;this.configurationOptions=(ct=this.configure())!==null&&ct!==void 0?ct:{};this.contextLoggerApplyLogger=(ut=this.configurationOptions.contextLoggerApplyLogger)!==null&&ut!==void 0?ut:"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(ct){this.bootstrapOptions=ct;await this.beforeContainerInitialize(ct);await this.containerInitialize(ct);await this.afterContainerInitialize(ct);await this.containerDirectoryLoad(ct);await this.afterContainerDirectoryLoad(ct);await this.applicationInitialize(ct);await this.containerReady(ct);await this.afterContainerReady(ct);await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(ct){}async containerDirectoryLoad(ct){}async containerReady(ct){if(!this.app.getApplicationContext){this.defineApplicationProperties()}}getApplicationContext(){return this.applicationContext}getConfiguration(ct){return this.configService.getConfiguration(ct)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(ct,ut){if(ut&&ut!=="appLogger"){const pt=this.getLogger(ut);let dt=ct.getAttr(mt.REQUEST_CTX_LOGGER_CACHE_KEY);if(!dt){dt=new Map;ct.setAttr(mt.REQUEST_CTX_LOGGER_CACHE_KEY,dt)}if(dt.has(ut)){return dt.get(ut)}const ft=this.loggerService.createContextLogger(ct,pt);dt.set(ut,ft);return ft}else{const pt=this.getLogger(ut!==null&&ut!==void 0?ut:this.contextLoggerApplyLogger);if(ct["_logger"]){return ct["_logger"]}ct["_logger"]=this.loggerService.createContextLogger(ct,pt,{contextFormat:this.contextLoggerFormat});return ct["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(ct={},ut=[]){const pt={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:ct=>this.getConfiguration(ct),getFrameworkType:()=>{if(this["getFrameworkType"]){return this["getFrameworkType"]()}},getProcessType:()=>_t.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:ct=>this.getLogger(ct),createLogger:(ct,ut={})=>this.createLogger(ct,ut),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:ct=>{const ut=ct||Object.create(this.defaultContext);if(!ut.startTime){ut.startTime=Date.now()}if(!ut.logger){ut.logger=this.createContextLogger(ut)}if(!ut.requestContext){ut.requestContext=new yt.MidwayRequestContainer(ut,this.getApplicationContext());ut.requestContext.ready()}if(!ut.getLogger){ut.getLogger=ct=>this.createContextLogger(ut,ct)}ut.setAttr=(ct,pt)=>{ut.requestContext.setAttr(ct,pt)};ut.getAttr=ct=>ut.requestContext.getAttr(ct);ut.getApp=()=>this.getApplication();return ut},addConfigObject:ct=>{this.configService.addObject(ct)},setAttr:(ct,ut)=>{this.getApplicationContext().setAttr(ct,ut)},getAttr:ct=>this.getApplicationContext().getAttr(ct),useMiddleware:ct=>this.useMiddleware(ct),getMiddleware:()=>this.getMiddleware(),useFilter:ct=>this.useFilter(ct),useGuard:ct=>this.useGuard(ct),getNamespace:()=>this.getNamespace()};for(const ct of ut){delete pt[ct]}Object.assign(this.app,pt,ct)}async beforeStop(){}async beforeContainerInitialize(ct){}async afterContainerInitialize(ct){}async afterContainerDirectoryLoad(ct){}async afterContainerReady(ct){}async applyMiddleware(ct){var ut;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(mt.ASYNC_CONTEXT_MANAGER_KEY)){const ct=this.configService.getConfiguration("asyncContextManager.enable")||false;const pt=ct?((ut=this.bootstrapOptions)===null||ut===void 0?void 0:ut.asyncContextManager)||new At.NoopContextManager:new At.NoopContextManager;if(ct){pt.enable()}this.applicationContext.registerObject(mt.ASYNC_CONTEXT_MANAGER_KEY,pt)}this.middlewareManager.insertFirst((async(ct,ut)=>{const pt=At.ASYNC_ROOT_CONTEXT.setValue(mt.ASYNC_CONTEXT_KEY,ct);const dt=this.applicationContext.get(mt.ASYNC_CONTEXT_MANAGER_KEY);return await dt.with(pt,(async()=>{await this.mockService.runSimulatorContextSetup(ct,this.app);this.mockService.applyContextMocks(this.app,ct);let pt=undefined;try{const dt=await ut();pt=await this.filterManager.runResultFilter(dt,ct)}catch(ut){pt=await this.filterManager.runErrorFilter(ut,ct)}finally{await this.mockService.runSimulatorContextTearDown(ct,this.app)}if(pt.error){throw pt.error}return pt.result}))}));It(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(ct){ct=Array.isArray(ct)?ct:[ct];return await this.middlewareService.compose([this.composeMiddleware,...ct],this.app)}return this.composeMiddleware}getLogger(ct){var ut;return(ut=this.loggerService.getLogger(ct))!==null&&ut!==void 0?ut:this.appLogger}getCoreLogger(){return this.logger}createLogger(ct,ut={}){return this.loggerService.createLogger(ct,ut)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(ct){this.middlewareManager.insertLast(ct)}getMiddleware(){return this.middlewareManager}useFilter(ct){return this.filterManager.useFilter(ct)}useGuard(ct){return this.guardManager.addGlobalGuard(ct)}async runGuard(ct,ut,pt){return this.guardManager.runGuard(ct,ut,pt)}createMiddlewareManager(){return new $t.ContextMiddlewareManager}createFilterManager(){return new Ct.FilterManager}createGuardManager(){return new kt.GuardManager}setNamespace(ct){this.namespace=ct}getNamespace(){return this.namespace}}dt([(0,ht.Inject)(),ft("design:type",xt.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);dt([(0,ht.Inject)(),ft("design:type",vt.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);dt([(0,ht.Inject)(),ft("design:type",St.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);dt([(0,ht.Inject)(),ft("design:type",bt.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);dt([(0,ht.Inject)(),ft("design:type",Et.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);dt([(0,ht.Inject)(),ft("design:type",Tt.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);dt([(0,ht.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],BaseFramework.prototype,"init",null);ut.BaseFramework=BaseFramework},43436:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayApplicationManager=void 0;const ft=pt(6192);const _t=pt(49757);let mt=class MidwayApplicationManager{constructor(){this.globalFrameworkMap=new Map;this.globalFrameworkTypeMap=new WeakMap}addFramework(ct,ut){this.globalFrameworkMap.set(ct,ut);if(ut["getFrameworkType"]){this.globalFrameworkTypeMap.set(ut["getFrameworkType"](),ut)}}getFramework(ct){if(typeof ct==="string"){if(this.globalFrameworkMap.has(ct)){return this.globalFrameworkMap.get(ct)}}else{if(this.globalFrameworkTypeMap.has(ct)){return this.globalFrameworkTypeMap.get(ct)}}}getApplication(ct){if(typeof ct==="string"){if(this.globalFrameworkMap.has(ct)){return this.globalFrameworkMap.get(ct).getApplication()}}else{if(this.globalFrameworkTypeMap.has(ct)){return this.globalFrameworkTypeMap.get(ct).getApplication()}}}getApplications(ct){if(!ct){return Array.from(this.globalFrameworkMap.values()).map((ct=>ct.getApplication())).filter((ct=>!!ct))}else{return ct.map((ct=>this.getApplication(ct))).filter((ct=>!!ct))}}};mt=dt([(0,_t.Provide)(),(0,_t.Scope)(ft.ScopeEnum.Singleton)],mt);ut.MidwayApplicationManager=mt},75351:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.NoopContextManager=ut.ASYNC_ROOT_CONTEXT=void 0;class AsyncBaseContext{constructor(ct){const ut=this;ut._currentContext=ct?new Map(ct):new Map;ut.getValue=ct=>ut._currentContext.get(ct);ut.setValue=(ct,pt)=>{const dt=new AsyncBaseContext(ut._currentContext);dt._currentContext.set(ct,pt);return dt};ut.deleteValue=ct=>{const pt=new AsyncBaseContext(ut._currentContext);pt._currentContext.delete(ct);return pt}}}ut.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return ut.ASYNC_ROOT_CONTEXT}with(ct,ut,pt,...dt){return ut.call(pt,...dt)}bind(ct,ut){return ut}enable(){return this}disable(){return this}}ut.NoopContextManager=NoopContextManager},46673:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.DataListener=void 0;const _t=pt(49757);class DataListener{async init(){this.innerData=await this.initData();await this.onData(this.setData.bind(this))}setData(ct){this.innerData=ct}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],DataListener.prototype,"init",null);dt([(0,_t.Destroy)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],DataListener.prototype,"stop",null);ut.DataListener=DataListener},12849:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.globModels=ut.formatGlobString=ut.DataSourceManager=void 0;const _t=pt(83486);const mt=pt(86314);const ht=pt(62525);const yt=pt(16928);const vt=pt(63289);const St=pt(2222);const bt=pt(39023);const xt=pt(65308);const $t=pt(49757);const Et=pt(70275);const Ct=pt(78842);const Tt=pt(67934);const wt=(0,bt.debuglog)("midway:debug");class DataSourceManager{constructor(){this.dataSource=new Map;this.options={};this.modelMapping=new WeakMap;this.dataSourcePriority={}}async initDataSource(ct,ut){var pt,dt;this.options=ct;if(!this.options.dataSource){throw new mt.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof ut==="string"){ut={baseDir:ut,entitiesConfigKey:"entities"}}const ft=ut;const _t=(dt=(pt=this.configService)===null||pt===void 0?void 0:pt.getConfiguration("core.concurrentDataSourceInitialization"))!==null&&dt!==void 0?dt:false;const processDataSource=async ut=>{var pt;const dt=ct.dataSource[ut];const _t=dt[ft.entitiesConfigKey];if(_t){const ct=new Set;for(const dt of _t){if(typeof dt==="string"){const _t=await globModels(dt,ft.baseDir,(pt=this.environmentService)===null||pt===void 0?void 0:pt.getModuleLoadType());for(const pt of _t){ct.add(pt);this.modelMapping.set(pt,ut)}}else{ct.add(dt);this.modelMapping.set(dt,ut)}}dt[ft.entitiesConfigKey]=Array.from(ct);wt(`[core]: DataManager load ${dt[ft.entitiesConfigKey].length} models from ${ut}.`)}const mt={cacheInstance:ct.cacheInstance,validateConnection:ct.validateConnection};await this.createInstance(dt,ut,mt)};const ht=Object.keys(ct.dataSource);if(_t){await Promise.all(ht.map(processDataSource))}else{for(const ct of ht){await processDataSource(ct)}}}getDataSource(ct){return this.dataSource.get(ct)}hasDataSource(ct){return this.dataSource.has(ct)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(ct){const ut=this.getDataSource(ct);return ut?this.checkConnected(ut):false}async createInstance(ct,ut,pt){const dt=pt&&typeof pt.cacheInstance==="boolean"?pt.cacheInstance:true;const ft=pt&&pt.validateConnection||false;const ht=(0,_t.extend)(true,{},this.options["default"],ct);const yt=await this.createDataSource(ht,ut);if(dt&&ut&&yt){this.dataSource.set(ut,yt)}if(ft){if(!yt){throw new mt.MidwayCommonError(`[DataSourceManager] ${ut} initialization failed.`)}const ct=await this.checkConnected(yt);if(!ct){throw new mt.MidwayCommonError(`[DataSourceManager] ${ut} is not connected.`)}}return yt}getDataSourceNameByModel(ct){return this.modelMapping.get(ct)}async stop(){const ct=Array.from(this.dataSource.values());await Promise.all(ct.map((ct=>this.destroyDataSource(ct))));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(ct){return this.priorityManager.getPriority(this.dataSourcePriority[ct])}isHighPriority(ct){return this.priorityManager.isHighPriority(this.dataSourcePriority[ct])}isMediumPriority(ct){return this.priorityManager.isMediumPriority(this.dataSourcePriority[ct])}isLowPriority(ct){return this.priorityManager.isLowPriority(this.dataSourcePriority[ct])}}dt([(0,$t.Inject)(),ft("design:type",String)],DataSourceManager.prototype,"appDir",void 0);dt([(0,$t.Inject)(),ft("design:type",Et.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);dt([(0,$t.Inject)(),ft("design:type",Ct.MidwayConfigService)],DataSourceManager.prototype,"configService",void 0);dt([(0,$t.Inject)(),ft("design:type",Tt.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0);ut.DataSourceManager=DataSourceManager;function formatGlobString(ct){let ut;if(!/^\*/.test(ct)){ct="/"+ct}const pt=(0,yt.parse)(ct);if(pt.base&&(/\*/.test(pt.base)||pt.ext)){ut=[ct]}else{ut=[...St.DEFAULT_PATTERN.map((ut=>(0,yt.join)(ct,ut)))]}return ut}ut.formatGlobString=formatGlobString;async function globModels(ct,ut,pt){const dt=formatGlobString(ct);const ft=[];const _t=(0,ht.run)(dt,{cwd:ut,ignore:St.IGNORE_PATTERN});for(const ct of _t){const ut=await(0,xt.loadModule)(ct,{loadMode:pt});if(vt.Types.isClass(ut)){ft.push(ut)}else{for(const ct in ut){const pt=ut[ct];if(vt.Types.isClass(pt)){ft.push(pt)}}}}return ft}ut.globModels=globModels},1845:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.CustomModuleDetector=ut.ESModuleFileDetector=ut.CommonJSFileDetector=ut.AbstractFileDetector=void 0;const dt=pt(63289);const ft=pt(62525);const _t=pt(86314);const mt=pt(2222);const ht=pt(49757);const yt=pt(65308);class AbstractFileDetector{constructor(ct){this.options=ct;this.extraDetectorOptions={}}setExtraDetectorOptions(ct){this.extraDetectorOptions=ct}}ut.AbstractFileDetector=AbstractFileDetector;const vt=["**/**.tsx"].concat(mt.DEFAULT_PATTERN);const St=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(mt.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{constructor(){super(...arguments);this.duplicateModuleCheckSet=new Map}run(ct){if(this.getType()==="commonjs"){return this.loadSync(ct)}else{return this.loadAsync(ct)}}loadSync(ct){var ut;this.options=this.options||{};const pt=[].concat((ut=this.options.loadDir)!==null&&ut!==void 0?ut:ct.get("baseDir"));for(const ut of pt){const pt=(0,ft.run)(vt.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:ut,ignore:St.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(ct,ut)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&dt.Types.isClass(ct)){const pt=(0,ht.getProviderName)(ct);if(pt){if(this.duplicateModuleCheckSet.has(pt)){throw new _t.MidwayDuplicateClassNameError(pt,ut.srcPath,this.duplicateModuleCheckSet.get(pt))}else{this.duplicateModuleCheckSet.set(pt,ut.srcPath)}}}};for(const ut of pt){const pt=require(ut);ct.bindClass(pt,{namespace:this.options.namespace,srcPath:ut,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(ct){var ut;this.options=this.options||{};const pt=[].concat((ut=this.options.loadDir)!==null&&ut!==void 0?ut:ct.get("baseDir"));for(const ut of pt){const pt=(0,ft.run)(vt.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:ut,ignore:St.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(ct,ut)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&dt.Types.isClass(ct)){const pt=(0,ht.getProviderName)(ct);if(pt){if(this.duplicateModuleCheckSet.has(pt)){throw new _t.MidwayDuplicateClassNameError(pt,ut.srcPath,this.duplicateModuleCheckSet.get(pt))}else{this.duplicateModuleCheckSet.set(pt,ut.srcPath)}}}};for(const ut of pt){const pt=await(0,yt.loadModule)(ut,{loadMode:"esm"});ct.bindClass(pt,{namespace:this.options.namespace,srcPath:ut,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}}ut.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}ut.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(ct){for(const ut of this.options.modules){ct.bindClass(ut,{namespace:this.options.namespace,createFrom:"module"})}}}ut.CustomModuleDetector=CustomModuleDetector},39408:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.FilterManager=void 0;const dt=pt(49757);const ft=pt(65308);class FilterManager{constructor(){this.errFilterList=[];this.successFilterList=[];this.exceptionMap=new WeakMap;this.defaultErrFilter=undefined;this.matchFnList=[];this.protoMatchList=[]}useFilter(ct){if(!Array.isArray(ct)){ct=[ct]}for(const ut of ct){if((0,dt.getClassMetadata)(dt.CATCH_KEY,ut)){this.errFilterList.push(ut)}if((0,dt.getClassMetadata)(dt.MATCH_KEY,ut)){this.successFilterList.push(ut)}}}async init(ct){for(const ut of this.errFilterList){const pt=await ct.getAsync(ut);const ft=(0,dt.getClassMetadata)(dt.CATCH_KEY,ut);if(ft&&ft.catchTargets){ft.catchOptions=ft.catchOptions||{};for(const ct of ft.catchTargets){this.exceptionMap.set(ct,{filter:pt,catchOptions:ft.catchOptions});if(ft.catchOptions["matchPrototype"]){this.protoMatchList.push((ut=>{if(ut instanceof ct){return ct}else{return false}}))}}}else{this.defaultErrFilter=pt}}for(const ut of this.successFilterList){const pt=await ct.getAsync(ut);const _t=(0,dt.getClassMetadata)(dt.MATCH_KEY,ut);if(_t&&_t.matchPattern){this.matchFnList.push({matchFn:(0,ft.toPathMatch)(_t.matchPattern),target:pt})}}}async runErrorFilter(ct,ut,pt,dt){let ft,_t;let mt=false;if(ct&&this.exceptionMap.has(ct.constructor)){mt=true;const _t=this.exceptionMap.get(ct.constructor);ft=await _t.filter.catch(ct,ut,pt,dt)}if(!mt&&this.protoMatchList.length){let _t;for(const ut of this.protoMatchList){_t=ut(ct);if(_t){break}}if(_t){mt=true;const ht=this.exceptionMap.get(_t);ft=await ht.filter.catch(ct,ut,pt,dt)}}if(!mt&&this.defaultErrFilter){mt=true;ft=await this.defaultErrFilter.catch(ct,ut,pt,dt)}if(!mt){_t=ct}return{result:ft,error:_t}}async runResultFilter(ct,ut,pt,dt){let ft=ct;for(const ct of this.matchFnList){if(ct.matchFn(ut,pt)){ft=await ct.target.match(ft,ut,pt,dt)}}return{result:ft,error:undefined}}}ut.FilterManager=FilterManager},40581:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.GuardManager=void 0;const dt=pt(49757);class GuardManager extends Array{addGlobalGuard(ct){if(!Array.isArray(ct)){this.push(ct)}else{this.push(...ct)}}async runGuard(ct,ut,pt){for(const dt of this){const ft=await ct.requestContext.getAsync(dt);const _t=await ft.canActivate(ct,ut,pt);if(!_t){return false}}const ft=(0,dt.getClassMetadata)(dt.GUARD_KEY,ut);if(ft){for(const dt of ft){const ft=await ct.requestContext.getAsync(dt);const _t=await ft.canActivate(ct,ut,pt);if(!_t){return false}}}const _t=(0,dt.getPropertyMetadata)(dt.GUARD_KEY,ut,pt);if(_t){for(const dt of _t){const ft=await ct.requestContext.getAsync(dt);const _t=await ft.canActivate(ct,ut,pt);if(!_t){return false}}}return true}}ut.GuardManager=GuardManager},82535:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.DefaultConsoleLoggerFactory=ut.LoggerFactory=void 0;class LoggerFactory{}ut.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{constructor(){this.instance=new Map}createLogger(ct,ut){this.instance.set(ct,console);return console}getLogger(ct){return this.instance.get(ct)}close(ct){}removeLogger(ct){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(ct,ut,pt){return ut}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}ut.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},12738:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createMiddleware=ut.ContextMiddlewareManager=void 0;class ContextMiddlewareManager extends Array{insertFirst(ct){if(Array.isArray(ct)){this.unshift(...ct)}else{this.unshift(ct)}}insertLast(ct){if(Array.isArray(ct)){this.push(...ct)}else{this.push(ct)}}insertBefore(ct,ut){if(typeof ut!=="number"){ut=this.findItemIndex(ut)}if(Array.isArray(ct)){this.splice(ut,0,...ct)}else{this.splice(ut,0,ct)}}insertAfter(ct,ut){if(typeof ut!=="number"){ut=this.findItemIndex(ut)}if(Array.isArray(ct)){this.splice(ut+1,0,...ct)}else{this.splice(ut+1,0,ct)}}findAndInsertAfter(ct,ut){ct=this.findItem(ct);ut=this.findItem(ut);if(!ct||!ut||ct===ut){return}if(ut){const pt=this.remove(ct);if(pt){this.insertAfter(pt,ut)}}}findAndInsertBefore(ct,ut){ct=this.findItem(ct);ut=this.findItem(ut);if(!ct||!ut||ct===ut){return}if(ut){const pt=this.remove(ct);if(pt){this.insertBefore(pt,ut)}}}findAndInsertFirst(ct){const ut=this.remove(ct);if(ut){this.insertFirst(ut)}}findAndInsertLast(ct){const ut=this.remove(ct);if(ut){this.insertLast(ut)}}findItemIndex(ct){if(typeof ct==="number"){return ct}else if(typeof ct==="string"){return this.findIndex((ut=>this.getMiddlewareName(ut)===ct))}else{return this.findIndex((ut=>ut===ct))}}findItem(ct){if(typeof ct==="number"){if(ct>=0&&ct<=this.length-1){return this[ct]}}else if(typeof ct==="string"){return this.find((ut=>this.getMiddlewareName(ut)===ct))}else{return ct}}getMiddlewareName(ct){var ut,pt,dt;if(ct["middleware"]){return(ut=ct.name)!==null&&ut!==void 0?ut:this.getMiddlewareName(ct["middleware"])}return(dt=(pt=ct.getName&&ct.getName())!==null&&pt!==void 0?pt:ct._name)!==null&&dt!==void 0?dt:ct.name}remove(ct){if(typeof ct==="number"&&ct!==-1){return this.splice(ct,1)[0]}else{const ut=this.findItemIndex(ct);if(ut!==-1){return this.splice(ut,1)[0]}}}push(...ct){ct.forEach((ct=>{if(typeof ct!=="string"&&!this.getMiddlewareName(ct)){ct._name="anonymous"}}));return super.push(...ct)}unshift(...ct){ct.forEach((ct=>{if(typeof ct!=="string"&&!this.getMiddlewareName(ct)){ct._name="anonymous"}}));return super.unshift(...ct)}getNames(){return this.map((ct=>this.getMiddlewareName(ct)))}}ut.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(ct,ut,pt){return{middleware:ct,options:ut,name:pt}}ut.createMiddleware=createMiddleware},70032:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayInitializerPerformanceManager=ut.MidwayPerformanceManager=void 0;const dt=pt(82987);class MidwayPerformanceManager{constructor(ct){this.group=ct;this.observer=null;this.marks=new Set;this.measures=new Set}static getInstance(ct){if(!this.instances.has(ct)){this.instances.set(ct,new MidwayPerformanceManager(ct))}return this.instances.get(ct)}formatKey(ct,ut){return`${this.group}:${ct}-${ut}`}markStart(ct){const ut=this.formatKey(ct,"start");dt.performance.mark(ut);this.marks.add(ut)}markEnd(ct){const ut=this.formatKey(ct,"start");const pt=this.formatKey(ct,"end");const ft=`${this.group}:${ct}`;dt.performance.mark(pt);this.marks.add(pt);dt.performance.measure(ft,ut,pt);this.measures.add(ft)}observeMeasure(ct){if(this.observer){return}this.observer=new dt.PerformanceObserver((ut=>{const pt=ut.getEntries().filter((ct=>ct.name.startsWith(`${this.group}:`)));if(pt.length>0){ct({getEntries:()=>pt})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((ct=>{try{dt.performance.clearMarks(ct)}catch(ut){console.warn(`Failed to clear mark ${ct}: ${ut}`)}}));this.marks.clear();this.measures.forEach((ct=>{try{dt.performance.clearMeasures(ct)}catch(ut){console.warn(`Failed to clear measure ${ct}: ${ut}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((ct=>ct.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const ct=[];dt.performance===null||dt.performance===void 0?void 0:dt.performance.getEntries().forEach((ut=>{if(ut.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){ct.push(ut.toJSON())}}));return ct}}ut.MidwayPerformanceManager=MidwayPerformanceManager;MidwayPerformanceManager.instances=new Map;MidwayPerformanceManager.DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};class MidwayInitializerPerformanceManager{static markStart(ct){const ut=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);ut.markStart(ct)}static markEnd(ct){const ut=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);ut.markEnd(ct)}static frameworkInitializeStart(ct){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${ct}`)}static frameworkInitializeEnd(ct){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${ct}`)}static frameworkRunStart(ct){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${ct}`)}static frameworkRunEnd(ct){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${ct}`)}static lifecycleStart(ct,ut){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${ct}:${ut}`)}static lifecycleEnd(ct,ut){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${ct}:${ut}`)}}ut.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(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayPriorityManager=ut.DEFAULT_PRIORITY=void 0;const ft=pt(49757);const _t=pt(6192);ut.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let mt=class MidwayPriorityManager{constructor(){this.priorityList=ut.DEFAULT_PRIORITY;this.defaultPriority=ut.DEFAULT_PRIORITY.L2}getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(ct=ut.DEFAULT_PRIORITY.L2){return ct===ut.DEFAULT_PRIORITY.L1}isMediumPriority(ct=ut.DEFAULT_PRIORITY.L2){return ct===ut.DEFAULT_PRIORITY.L2}isLowPriority(ct=ut.DEFAULT_PRIORITY.L2){return ct===ut.DEFAULT_PRIORITY.L3}getPriority(ct){return ct||this.getDefaultPriority()}};mt=dt([(0,ft.Provide)(),(0,ft.Scope)(_t.ScopeEnum.Singleton)],mt);ut.MidwayPriorityManager=mt},64842:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.ServiceFactory=void 0;const _t=pt(83486);const mt=pt(67934);const ht=pt(49757);class ServiceFactory{constructor(){this.clients=new Map;this.options={}}async initClients(ct={}){this.options=ct;if(ct.client){ct.clients=ct.clients||{};ct.clients["default"]=ct.clients["default"]||{};(0,_t.extend)(true,ct.clients["default"],ct.client)}if(ct.clients){for(const ut of Object.keys(ct.clients)){await this.createInstance(ct.clients[ut],ut)}}this.clientPriority=ct.priority||{}}get(ct="default"){return this.clients.get(ct)}has(ct){return this.clients.has(ct)}async createInstance(ct,ut){ct=(0,_t.extend)(true,{},this.options["default"],ct);const pt=await this.createClient(ct,ut);if(pt){if(ut){this.clients.set(ut,pt)}return pt}}async destroyClient(ct,ut){}async stop(){for(const[ct,ut]of this.clients.entries()){await this.destroyClient(ut,ct)}}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(ct){return this.priorityManager.getPriority(this.clientPriority[ct])}isHighPriority(ct){return this.priorityManager.isHighPriority(this.clientPriority[ct])}isMediumPriority(ct){return this.priorityManager.isMediumPriority(this.clientPriority[ct])}isLowPriority(ct){return this.priorityManager.isLowPriority(this.clientPriority[ct])}}dt([(0,ht.Inject)(),ft("design:type",mt.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0);ut.ServiceFactory=ServiceFactory},11330:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.TypedResourceManager=void 0;class TypedResourceManager{constructor(ct){this.typedResourceInitializerOptions=ct;this.resourceMap=new Map;this.resourceBindingMap=new Map}async createResource(ct,ut){const pt=await this.typedResourceInitializerOptions.resourceInitialize(ut,ct);this.resourceMap.set(ct,pt);return pt}async init(){for(const ct of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const ut=this.typedResourceInitializerOptions.initializeValue[ct];const pt=this.typedResourceInitializerOptions.initializeClzProvider[ct];const dt=await this.createResource(ct,ut);const ft=await this.typedResourceInitializerOptions.resourceBinding(pt,ut,dt,ct);if(ft){this.resourceBindingMap.set(ct,ft)}}}async startParallel(){const ct=[];for(const[ut,pt]of this.resourceMap.entries()){ct.push(this.typedResourceInitializerOptions.resourceStart(pt,this.typedResourceInitializerOptions.initializeValue[ut],this.resourceBindingMap.get(ut)))}await Promise.all(ct)}async start(){for(const[ct,ut]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(ut,this.typedResourceInitializerOptions.initializeValue[ct],this.resourceBindingMap.get(ct))}}async destroyParallel(){const ct=[];for(const[ut,pt]of this.resourceMap.entries()){ct.push(this.typedResourceInitializerOptions.resourceDestroy(pt,this.typedResourceInitializerOptions.initializeValue[ut]))}await Promise.all(ct)}async destroy(){for(const[ct,ut]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(ut,this.typedResourceInitializerOptions.initializeValue[ct])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(ct){return this.resourceMap.get(ct)}}ut.TypedResourceManager=TypedResourceManager},11026:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.WebControllerGenerator=void 0;const dt=pt(49757);const ft=pt(39023);const _t=pt(6192);const mt=pt(86314);const ht=pt(68220);const yt=ft.debuglog("midway:debug");class WebControllerGenerator{constructor(ct,ut){this.app=ct;this.midwayWebRouterService=ut}generateKoaController(ct){return async(ut,pt)=>{if(ct.controllerClz&&typeof ct.method==="string"){const pt=await this.app.getFramework().runGuard(ut,ct.controllerClz,ct.method);if(!pt){throw new mt.httpError.ForbiddenError}}const ft=[ut,pt];let _t;if(typeof ct.method!=="string"){_t=await ct.method(ut,pt)}else{const pt=await ut.requestContext.getAsync(ct.id);_t=await pt[ct.method].apply(pt,ft)}if(_t!==undefined){if(_t===null){ut.response._body=null;ut.response._midwayControllerNullBody=true}else{ut.body=_t}}if(Array.isArray(ct.responseMetadata)&&ct.responseMetadata.length){for(const pt of ct.responseMetadata){switch(pt.type){case dt.WEB_RESPONSE_HTTP_CODE:ut.status=pt.code;break;case dt.WEB_RESPONSE_HEADER:for(const ct in(pt===null||pt===void 0?void 0:pt.setHeaders)||{}){ut.set(ct,pt.setHeaders[ct])}break;case dt.WEB_RESPONSE_CONTENT_TYPE:ut.type=pt.contentType;break;case dt.WEB_RESPONSE_REDIRECT:ut.status=pt.code;ut.redirect(pt.url);return}}}}}async loadMidwayController(ct){var ut,pt;const dt=await this.midwayWebRouterService.getRouterTable();const ft=await this.midwayWebRouterService.getRoutePriorityList();const mt=this.app.getApplicationContext();const vt=this.app.getCoreLogger();const St=mt.get(ht.MidwayMiddlewareService);for(const ht of ft){mt.bindClass(ht.routerModule);vt.debug(`Load Controller "${ht.controllerId}", prefix=${ht.prefix}`);yt(`[core]: Load Controller "${ht.controllerId}", prefix=${ht.prefix}`);const ft=this.createRouter({prefix:ht.prefix,...ht.routerOptions});ht.middleware=(ut=ht.middleware)!==null&&ut!==void 0?ut:[];if(ht.middleware.length){const ct=await St.compose(ht.middleware,this.app);ft.use(ct)}const bt=dt.get(ht.prefix);for(const ct of bt){const ut=[];ct.middleware=(pt=ct.middleware)!==null&&pt!==void 0?pt:[];if(ct.middleware.length){const pt=await St.compose(ct.middleware,this.app);ut.push(pt)}if(this.app.getFrameworkType()===_t.MidwayFrameworkType.WEB_KOA){if(typeof ct.url==="string"&&/\*$/.test(ct.url)){ct.url=ct.url.replace("*","(.*)")}}const dt=[ct.routerName,ct.url,...ut,this.generateController(ct)];vt.debug(`Load Router "${ct.requestMethod.toUpperCase()} ${ct.url}"`);yt(`[core]: Load Router "${ct.requestMethod.toUpperCase()} ${ct.url}"`);ft[ct.requestMethod.toLowerCase()].apply(ft,dt)}ct&&ct(ft)}}}ut.WebControllerGenerator=WebControllerGenerator},42193:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});const dt=pt(65308);ut["default"]=ct=>{const ut=(0,dt.isDevelopmentEnvironment)((0,dt.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3,concurrentDataSourceInitialization:false},asyncContextManager:{enable:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:ut?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:ut}}}},2222:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.SINGLETON_CONTAINER_CTX=ut.IGNORE_PATTERN=ut.DEFAULT_PATTERN=ut.ASYNC_CONTEXT_MANAGER_KEY=ut.ASYNC_CONTEXT_KEY=ut.REQUEST_CTX_LOGGER_CACHE_KEY=ut.HTTP_SERVER_KEY=ut.CONTAINER_OBJ_SCOPE=ut.REQUEST_OBJ_CTX_KEY=ut.REQUEST_CTX_KEY=ut.MIDWAY_LOGGER_WRITEABLE_DIR=ut.FUNCTION_INJECT_KEY=ut.KEYS=void 0;ut.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"};ut.FUNCTION_INJECT_KEY="midway:function_inject_key";ut.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";ut.REQUEST_CTX_KEY="ctx";ut.REQUEST_OBJ_CTX_KEY="_req_ctx";ut.CONTAINER_OBJ_SCOPE="_obj_scope";ut.HTTP_SERVER_KEY="_midway_http_server";ut.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";ut.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");ut.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";ut.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];ut.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];ut.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},9288:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayContainer=void 0;const dt=pt(49757);const ft=pt(24451);const _t=pt(39023);const mt=pt(20873);const ht=pt(6192);const yt=pt(2222);const vt=pt(47698);const St=pt(34881);const bt=pt(80932);const xt=pt(70275);const $t=pt(78842);const Et=pt(24434);const Ct=pt(86314);const Tt=pt(63289);const wt=pt(65308);const At=_t.debuglog("midway:debug");const kt=_t.debuglog("midway:bind");const It=9;class ContainerConfiguration{constructor(ct){this.container=ct;this.loadedMap=new WeakMap;this.namespaceList=[];this.configurationOptionsList=[]}load(ct){let ut=dt.MAIN_MODULE_KEY;const pt=this.getConfigurationExport(ct);if(!pt.length)return;for(let ct=0;ct<pt.length;ct++){const _t=pt[ct];if(this.loadedMap.get(_t)){continue}let mt;if(_t instanceof ft.FunctionalConfiguration){mt=_t.getConfigurationOptions()}else{mt=(0,dt.getClassMetadata)(dt.CONFIGURATION_KEY,_t)}this.loadedMap.set(_t,true);if(mt){if(mt.namespace!==undefined){ut=mt.namespace;this.namespaceList.push(ut)}this.configurationOptionsList.push(mt);At(`[core]: load configuration in namespace="${ut}"`);this.addImports(mt.imports);this.addImportObjects(mt.importObjects);this.addImportConfigs(mt.importConfigs);this.addImportConfigFilter(mt.importConfigFilter);this.bindConfigurationClass(_t,ut)}}this.container.bindClass(ct,{namespace:ut})}addImportConfigs(ct){if(ct){if(Array.isArray(ct)){this.container.get($t.MidwayConfigService).add(ct)}else{this.container.get($t.MidwayConfigService).addObject(ct)}}}addImportConfigFilter(ct){if(ct){this.container.get($t.MidwayConfigService).addFilter(ct)}}addImports(ct=[]){var ut;for(let pt of ct){if(!pt)continue;if(typeof pt==="string"){pt=require(pt)}if("Configuration"in pt){this.load(pt)}else if("component"in pt){if(pt===null||pt===void 0?void 0:pt.enabledEnvironment){if((ut=pt===null||pt===void 0?void 0:pt.enabledEnvironment)===null||ut===void 0?void 0:ut.includes(this.container.get(xt.MidwayEnvironmentService).getCurrentEnvironment())){this.load(pt.component)}}else{this.load(pt.component)}}else{this.load(pt)}}}addImportObjects(ct){if(ct){const ut=Object.keys(ct);for(const pt of ut){if(typeof ct[pt]!==undefined){this.container.registerObject(pt,ct[pt])}}}}bindConfigurationClass(ct,ut){if(ct instanceof ft.FunctionalConfiguration){}else{(0,dt.saveProviderId)(undefined,ct);const pt=(0,dt.getProviderUUId)(ct);this.container.bind(pt,ct,{namespace:ut,scope:ht.ScopeEnum.Singleton})}const pt=(0,dt.listModule)(dt.CONFIGURATION_KEY);const _t=pt.find((ut=>ut.target===ct));if(!_t){(0,dt.saveModule)(dt.CONFIGURATION_KEY,{target:ct,namespace:ut})}}getConfigurationExport(ct){const ut=[];if(Tt.Types.isClass(ct)||Tt.Types.isFunction(ct)||ct instanceof ft.FunctionalConfiguration){ut.push(ct)}else{for(const pt in ct){const dt=ct[pt];if(Tt.Types.isClass(dt)||Tt.Types.isFunction(dt)||dt instanceof ft.FunctionalConfiguration){ut.push(dt)}}}return ut}getNamespaceList(){return this.namespaceList}getConfigurationOptionsList(){return this.configurationOptionsList}}class MidwayContainer{constructor(ct){this._resolverFactory=null;this._registry=null;this._identifierMapping=null;this.moduleMap=null;this.parent=null;this.ctx=yt.SINGLETON_CONTAINER_CTX;this.attrMap=new Map;this._namespaceSet=null;this.parent=ct;this.init()}init(){this.registerObject(yt.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new Et}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new mt.ObjectDefinitionRegistry}return this._registry}set registry(ct){this._registry=ct}get managedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new bt.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(ct){var ut,pt,dt;if(!Array.isArray(ct)){ct=[ct]}const ft=new ContainerConfiguration(this);for(const ut of ct){if(ut){ft.load(ut)}}for(const ct of ft.getNamespaceList()){this.namespaceSet.add(ct);At(`[core]: load configuration in namespace="${ct}" complete`)}const _t=(ut=ft.getConfigurationOptionsList())!==null&&ut!==void 0?ut:[];const mt=(pt=_t.find((ct=>!ct.namespace)))!==null&&pt!==void 0?pt:{};this.fileDetector=(dt=mt.detector)!==null&&dt!==void 0?dt:this.fileDetector;if(this.fileDetector){this.fileDetector.setExtraDetectorOptions({conflictCheck:mt.conflictCheck,...mt.detectorOptions})}}loadDefinitions(){if(this.fileDetector){return this.fileDetector.run(this)}}bindClass(ct,ut){if(Tt.Types.isClass(ct)||Tt.Types.isFunction(ct)){this.bindModule(ct,ut)}else{for(const pt in ct){const dt=ct[pt];if(Tt.Types.isClass(dt)||Tt.Types.isFunction(dt)){this.bindModule(dt,ut)}}}}bind(ct,ut,pt){var ft;if(Tt.Types.isClass(ct)||Tt.Types.isFunction(ct)){return this.bindModule(ct,ut)}if(this.registry.hasDefinition(ct)){return}if(pt===null||pt===void 0?void 0:pt.bindHook){pt.bindHook(ut,pt)}let _t;if(Tt.Types.isClass(ut)){_t=new vt.ObjectDefinition;_t.name=(0,dt.getProviderName)(ut)}else{_t=new St.FunctionDefinition;if(!Tt.Types.isAsyncFunction(ut)){_t.asynchronous=false}_t.name=_t.id}_t.path=ut;_t.id=ct;_t.srcPath=(pt===null||pt===void 0?void 0:pt.srcPath)||null;_t.namespace=(pt===null||pt===void 0?void 0:pt.namespace)||"";_t.scope=(pt===null||pt===void 0?void 0:pt.scope)||ht.ScopeEnum.Request;_t.createFrom=pt===null||pt===void 0?void 0:pt.createFrom;if(_t.srcPath){At(`[core]: bind id "${_t.name} (${_t.srcPath}) ${ct}"`)}else{At(`[core]: bind id "${_t.name}" ${ct}`)}const mt=(0,dt.getPropertyInject)(ut);for(const ct in mt){const ut=mt[ct];kt(`${" ".repeat(It)}inject properties => [${JSON.stringify(ut)}]`);const pt=new bt.ManagedReference;pt.args=ut.args;pt.name=ut.value;pt.injectMode=ut["injectMode"];_t.properties.set(ut["targetKey"],pt)}const yt=(0,dt.getClassExtendedMetadata)(dt.INJECT_CUSTOM_PROPERTY,ut);for(const ct in yt){const ut=yt[ct];_t.handlerProps.push(ut)}const xt=(ft=(0,dt.getObjectDefinition)(ut))!==null&&ft!==void 0?ft:{};if(xt.initMethod){kt(`${" ".repeat(It)}register initMethod = ${xt.initMethod}`);_t.initMethod=xt.initMethod}if(xt.destroyMethod){kt(`${" ".repeat(It)}register destroyMethod = ${xt.destroyMethod}`);_t.destroyMethod=xt.destroyMethod}if(xt.scope){kt(`${" ".repeat(It)}register scope = ${xt.scope}`);_t.scope=xt.scope}if(xt.allowDowngrade){kt(`${" ".repeat(It)}register allowDowngrade = ${xt.allowDowngrade}`);_t.allowDowngrade=xt.allowDowngrade}this.objectCreateEventTarget.emit(ht.ObjectLifeCycleEvent.BEFORE_BIND,ut,{context:this,definition:_t,replaceCallback:ct=>{_t=ct}});if(_t){this.registry.registerDefinition(_t.id,_t)}}bindModule(ct,ut){if(Tt.Types.isClass(ct)){const pt=(0,dt.getProviderUUId)(ct);if(pt){this.identifierMapping.saveClassRelation(ct,ut===null||ut===void 0?void 0:ut.namespace);this.bind(pt,ct,ut)}else{}}else{const pt=ct[yt.FUNCTION_INJECT_KEY];if(pt&&pt.id){if(!pt.scope){pt.scope=ht.ScopeEnum.Request}const dt=wt.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(pt.id,dt);this.bind(dt,ct,{scope:pt.scope,namespace:ut.namespace,srcPath:ut.srcPath,createFrom:ut.createFrom})}}}setFileDetector(ct){this.fileDetector=ct}createChild(){return new MidwayContainer(this)}setAttr(ct,ut){this.attrMap.set(ct,ut)}getAttr(ct){return this.attrMap.get(ct)}getIdentifier(ct){return(0,dt.getProviderUUId)(ct)}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new bt.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll()}ready(){return this.loadDefinitions()}get(ct,ut,pt){var dt;ut=ut!==null&&ut!==void 0?ut:[];pt=pt!==null&&pt!==void 0?pt:{originName:ct};if(typeof ct!=="string"){pt.originName=ct.name;ct=this.getIdentifier(ct)}if(this.registry.hasObject(ct)){return this.registry.getObject(ct)}const ft=this.registry.getDefinition(ct);if(!ft&&this.parent){return this.parent.get(ct,ut)}if(!ft){throw new Ct.MidwayDefinitionNotFoundError((dt=pt===null||pt===void 0?void 0:pt.originName)!==null&&dt!==void 0?dt:ct)}return this.getManagedResolverFactory().create({definition:ft,args:ut})}async getAsync(ct,ut,pt){var dt;ut=ut!==null&&ut!==void 0?ut:[];pt=pt!==null&&pt!==void 0?pt:{originName:ct};if(typeof ct!=="string"){pt.originName=ct.name;ct=this.getIdentifier(ct)}if(this.registry.hasObject(ct)){return this.registry.getObject(ct)}const ft=this.registry.getDefinition(ct);if(!ft&&this.parent){return this.parent.getAsync(ct,ut)}if(!ft){throw new Ct.MidwayDefinitionNotFoundError((dt=pt===null||pt===void 0?void 0:pt.originName)!==null&&dt!==void 0?dt:ct)}return this.getManagedResolverFactory().createAsync({definition:ft,args:ut})}registerObject(ct,ut){this.registry.registerObject(ct,ut)}onBeforeBind(ct){this.objectCreateEventTarget.on(ht.ObjectLifeCycleEvent.BEFORE_BIND,ct)}onBeforeObjectCreated(ct){this.objectCreateEventTarget.on(ht.ObjectLifeCycleEvent.BEFORE_CREATED,ct)}onObjectCreated(ct){this.objectCreateEventTarget.on(ht.ObjectLifeCycleEvent.AFTER_CREATED,ct)}onObjectInit(ct){this.objectCreateEventTarget.on(ht.ObjectLifeCycleEvent.AFTER_INIT,ct)}onBeforeObjectDestroy(ct){this.objectCreateEventTarget.on(ht.ObjectLifeCycleEvent.BEFORE_DESTROY,ct)}saveModule(ct,ut){if(!this.moduleMap.has(ct)){this.moduleMap.set(ct,new Set)}this.moduleMap.get(ct).add(ut)}listModule(ct){return Array.from(this.moduleMap.get(ct)||{})}transformModule(ct){this.moduleMap=new Map(ct)}hasNamespace(ct){return this.namespaceSet.has(ct)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(ct){return this.registry.hasDefinition(ct)}hasObject(ct){return this.registry.hasObject(ct)}getInstanceScope(ct){if(ct[yt.CONTAINER_OBJ_SCOPE]){return ct[yt.CONTAINER_OBJ_SCOPE]}return undefined}}ut.MidwayContainer=MidwayContainer},20873:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ObjectDefinitionRegistry=void 0;const dt=pt(49757);const ft="_id_default_";class LegacyIdentifierRelation extends Map{saveClassRelation(ct,ut){const pt=(0,dt.getProviderUUId)(ct);this.set(pt,pt);if(pt){const ft=(0,dt.getProviderId)(ct);if(ft){this.set(ft,pt)}this.set((0,dt.getProviderName)(ct),pt);if(ut){this.set(ut+":"+(0,dt.getProviderName)(ct),pt)}}}saveFunctionRelation(ct,ut){this.set(ut,ut);this.set(ct,ut)}hasRelation(ct){return this.has(ct)}getRelation(ct){return this.get(ct)}}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(ct){this._identifierRelation=ct}get identifiers(){const ct=[];for(const ut of this.keys()){if(ut.indexOf(ft)===-1){ct.push(ut)}}return ct}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(ct){const ut=[];for(const pt of this.values()){const dt=pt;if(dt.name===ct){ut.push(dt)}}return ut}registerDefinition(ct,ut){if(ut.isSingletonScope()){this.singletonIds.push(ct)}this.set(ct,ut)}getDefinition(ct){var ut;ct=(ut=this.identifierRelation.getRelation(ct))!==null&&ut!==void 0?ut:ct;return this.get(ct)}removeDefinition(ct){this.delete(ct)}hasDefinition(ct){var ut;ct=(ut=this.identifierRelation.getRelation(ct))!==null&&ut!==void 0?ut:ct;return this.has(ct)}clearAll(){this.singletonIds=[];this.clear()}hasObject(ct){var ut;ct=(ut=this.identifierRelation.getRelation(ct))!==null&&ut!==void 0?ut:ct;return this.has(ft+ct)}registerObject(ct,ut){this.set(ft+ct,ut)}getObject(ct){var ut;ct=(ut=this.identifierRelation.getRelation(ct))!==null&&ut!==void 0?ut:ct;return this.get(ft+ct)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(ct){this.identifierRelation=ct}}ut.ObjectDefinitionRegistry=ObjectDefinitionRegistry},80932:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ManagedResolverFactory=ut.ManagedReference=void 0;const dt=pt(2222);const ft=pt(6192);const _t=pt(39023);const mt=pt(86314);const ht=_t.debuglog("midway:managedresolver");const yt=_t.debuglog("midway:debug");class ManagedReference{constructor(){this.type=dt.KEYS.REF_ELEMENT}}ut.ManagedReference=ManagedReference;class RefResolver{constructor(ct){this.factory=ct}get type(){return dt.KEYS.REF_ELEMENT}resolve(ct,ut){var pt;const dt=ct;if(dt.injectMode===ft.InjectModeEnum.Class&&!((pt=this.factory.context.parent)!==null&&pt!==void 0?pt:this.factory.context).hasDefinition(dt.name)){if(ut==="loggerService"){throw new mt.MidwayInconsistentVersionError}else{throw new mt.MidwayMissingImportComponentError(ut)}}return this.factory.context.get(dt.name,dt.args,{originName:ut})}async resolveAsync(ct,ut){var pt;const dt=ct;if(dt.injectMode===ft.InjectModeEnum.Class&&!((pt=this.factory.context.parent)!==null&&pt!==void 0?pt:this.factory.context).hasDefinition(dt.name)){if(ut==="loggerService"){throw new mt.MidwayInconsistentVersionError}else{throw new mt.MidwayMissingImportComponentError(ut)}}return this.factory.context.getAsync(dt.name,dt.args,{originName:ut})}}class ManagedResolverFactory{constructor(ct){this.resolvers={};this.creating=new Map;this.singletonCache=new Map;this.context=ct;this.resolvers={ref:new RefResolver(this)}}registerResolver(ct){this.resolvers[ct.type]=ct}resolveManaged(ct,ut){const pt=this.resolvers[ct.type];if(!pt||pt.type!==ct.type){throw new mt.MidwayResolverMissingError(ct.type)}return pt.resolve(ct,ut)}async resolveManagedAsync(ct,ut){const pt=this.resolvers[ct.type];if(!pt||pt.type!==ct.type){throw new mt.MidwayResolverMissingError(ct.type)}return pt.resolveAsync(ct,ut)}create(ct){const{definition:ut,args:pt}=ct;if(ut.isSingletonScope()&&this.singletonCache.has(ut.id)){return this.singletonCache.get(ut.id)}let _t=this.createProxyReference(ut);if(_t){return _t}this.compareAndSetCreateStatus(ut);if(ut.hasDependsOn()){for(const ct of ut.dependsOn){this.context.get(ct,pt)}}yt(`[core]: Create id = "${ut.name}" ${ut.id}.`);const ht=ut.creator.load();let vt=[];if(pt&&Array.isArray(pt)&&pt.length>0){vt=pt}this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.BEFORE_CREATED,ht,{constructorArgs:vt,definition:ut,context:this.context});_t=ut.creator.doConstruct(ht,vt,this.context);if(ut.isRequestScope()&&ut.constructor.name==="ObjectDefinition"){Object.defineProperty(_t,dt.REQUEST_OBJ_CTX_KEY,{value:this.context.get(dt.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(ut.properties){const ct=ut.properties.propertyKeys();for(const pt of ct){this.checkSingletonInvokeRequest(ut,pt);try{_t[pt]=this.resolveManaged(ut.properties.get(pt),pt)}catch(ct){if(mt.MidwayDefinitionNotFoundError.isClosePrototypeOf(ct)){const pt=ut.path.name;ct.updateErrorMsg(pt)}this.removeCreateStatus(ut,true);throw ct}}}this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.AFTER_CREATED,_t,{context:this.context,definition:ut,replaceCallback:ct=>{_t=ct}});ut.creator.doInit(_t);this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.AFTER_INIT,_t,{context:this.context,definition:ut});if(ut.id){if(ut.isSingletonScope()){this.singletonCache.set(ut.id,_t);this.setInstanceScope(_t,ft.ScopeEnum.Singleton)}else if(ut.isRequestScope()){this.context.registerObject(ut.id,_t);this.setInstanceScope(_t,ft.ScopeEnum.Request)}else{this.setInstanceScope(_t,ft.ScopeEnum.Prototype)}}this.removeCreateStatus(ut,true);return _t}async createAsync(ct){const{definition:ut,args:pt}=ct;if(ut.isSingletonScope()&&this.singletonCache.has(ut.id)){ht(`id = ${ut.id}(${ut.name}) get from singleton cache.`);return this.singletonCache.get(ut.id)}let _t=this.createProxyReference(ut);if(_t){ht(`id = ${ut.id}(${ut.name}) from proxy reference.`);return _t}this.compareAndSetCreateStatus(ut);if(ut.hasDependsOn()){for(const ct of ut.dependsOn){ht("id = %s init depend %s.",ut.id,ct);await this.context.getAsync(ct,pt)}}yt(`[core]: Create id = "${ut.name}" ${ut.id}.`);const vt=ut.creator.load();let St=[];if(pt&&Array.isArray(pt)&&pt.length>0){St=pt}this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.BEFORE_CREATED,vt,{constructorArgs:St,context:this.context});_t=await ut.creator.doConstructAsync(vt,St,this.context);if(!_t){this.removeCreateStatus(ut,false);throw new mt.MidwayCommonError(`${ut.id} construct return undefined`)}if(ut.isRequestScope()&&ut.constructor.name==="ObjectDefinition"){ht("id = %s inject ctx",ut.id);Object.defineProperty(_t,dt.REQUEST_OBJ_CTX_KEY,{value:this.context.get(dt.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(ut.properties){const ct=ut.properties.propertyKeys();for(const pt of ct){this.checkSingletonInvokeRequest(ut,pt);try{_t[pt]=await this.resolveManagedAsync(ut.properties.get(pt),pt)}catch(ct){if(mt.MidwayDefinitionNotFoundError.isClosePrototypeOf(ct)){const pt=ut.path.name;ct.updateErrorMsg(pt)}this.removeCreateStatus(ut,false);throw ct}}}this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.AFTER_CREATED,_t,{context:this.context,definition:ut,replaceCallback:ct=>{_t=ct}});await ut.creator.doInitAsync(_t);this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.AFTER_INIT,_t,{context:this.context,definition:ut});if(ut.id){if(ut.isSingletonScope()){ht(`id = ${ut.id}(${ut.name}) set to singleton cache`);this.singletonCache.set(ut.id,_t);this.setInstanceScope(_t,ft.ScopeEnum.Singleton)}else if(ut.isRequestScope()){ht(`id = ${ut.id}(${ut.name}) set to register object`);this.context.registerObject(ut.id,_t);this.setInstanceScope(_t,ft.ScopeEnum.Request)}else{this.setInstanceScope(_t,ft.ScopeEnum.Prototype)}}this.removeCreateStatus(ut,true);return _t}async destroyCache(){for(const ct of this.singletonCache.keys()){const ut=this.context.registry.getDefinition(ct);if(ut.creator){const pt=this.singletonCache.get(ct);this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.BEFORE_DESTROY,pt,{context:this.context,definition:ut});await ut.creator.doDestroyAsync(pt)}}this.singletonCache.clear();this.creating.clear()}removeCreateStatus(ct,ut){if(this.creating.has(ct.id)){this.creating.set(ct.id,false)}return true}isCreating(ct){return this.creating.has(ct.id)&&this.creating.get(ct.id)}compareAndSetCreateStatus(ct){if(!this.creating.has(ct.id)||!this.creating.get(ct.id)){this.creating.set(ct.id,true)}}createProxyReference(ct){if(this.isCreating(ct)){ht("create proxy for %s.",ct.id);if(!this.depthFirstSearch(ct.id,ct)){ht("id = %s after dfs return null",ct.id);return null}return new Proxy({__is_proxy__:true,__target_id__:ct.id},{get:(ut,pt)=>{let dt;if(ct.isRequestScope()){dt=this.context.registry.getObject(ct.id)}else if(ct.isSingletonScope()){dt=this.singletonCache.get(ct.id)}else{dt=this.context.get(ct.id)}if(dt){if(typeof dt[pt]==="function"){return dt[pt].bind(dt)}return dt[pt]}return undefined}})}return null}depthFirstSearch(ct,ut,pt){var dt;if(ut){ht("dfs for %s == %s start.",ct,ut.id);if(ut.properties){const ft=ut.properties.propertyKeys();if(ft.indexOf(ct)>-1){ht("dfs exist in properties %s == %s.",ct,ut.id);return true}for(const _t of ft){if(!Array.isArray(pt)){pt=[ct]}let ft=_t;const mt=ut.properties.get(_t);if(mt&&mt.name){ft=(dt=this.context.identifierMapping.getRelation(mt.name))!==null&&dt!==void 0?dt:mt.name}if(ft===ct){ht("dfs exist in properties key %s == %s.",ct,ut.id);return true}if(pt.indexOf(ft)>-1){ht("dfs depth circular %s == %s, %s, %j.",ct,ut.id,ft,pt);continue}else{pt.push(ft);ht("dfs depth push %s == %s, %j.",ct,ft,pt)}let yt=this.context.registry.getDefinition(ft);if(!yt&&this.context.parent){yt=this.context.parent.registry.getDefinition(ft)}if(this.depthFirstSearch(ct,yt,pt)){ht("dfs exist in sub tree %s == %s subId = %s.",ct,ut.id,yt.id);return true}}}ht("dfs for %s == %s end.",ct,ut.id)}return false}getObjectEventTarget(){if(this.context.parent){return this.context.parent.objectCreateEventTarget}return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(ct,ut){if(ct.isSingletonScope()){const pt=ct.properties.get(ut);if(this.context.hasDefinition(pt===null||pt===void 0?void 0:pt.name)){const ut=this.context.registry.getDefinition(pt.name);if(ut.isRequestScope()&&!ut.allowDowngrade){throw new mt.MidwaySingletonInjectRequestError(ct.path.name,ut.path.name)}}}return true}setInstanceScope(ct,ut){if(typeof ct==="object"){if(ut===ft.ScopeEnum.Request&&ct[dt.REQUEST_OBJ_CTX_KEY]===dt.SINGLETON_CONTAINER_CTX){ut=ft.ScopeEnum.Singleton}Object.defineProperty(ct,dt.CONTAINER_OBJ_SCOPE,{value:ut,writable:false,enumerable:false,configurable:false})}}}ut.ManagedResolverFactory=ManagedResolverFactory},28695:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.providerWrapper=void 0;const dt=pt(2222);function providerWrapper(ct){for(const ut of ct){Object.defineProperty(ut.provider,dt.FUNCTION_INJECT_KEY,{value:ut,writable:false})}}ut.providerWrapper=providerWrapper},97983:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayRequestContainer=void 0;const dt=pt(9288);const ft=pt(49757);const _t=pt(2222);class MidwayRequestContainer extends dt.MidwayContainer{constructor(ct,ut){super(ut);this.applicationContext=ut;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.ctx=ct;this.registerObject(_t.REQUEST_CTX_KEY,ct);this.registerObject("res",{});if(ct.logger){this.registerObject("logger",ct.logger)}}init(){}get(ct,ut){if(typeof ct!=="string"){ct=this.getIdentifier(ct)}if(this.registry.hasObject(ct)){return this.registry.getObject(ct)}const pt=this.applicationContext.registry.getDefinition(ct);if(pt){if(pt.isRequestScope()||pt.id===ft.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().create({definition:pt,args:ut})}}if(this.parent){return this.parent.get(ct,ut)}}async getAsync(ct,ut){if(typeof ct!=="string"){ct=this.getIdentifier(ct)}if(this.registry.hasObject(ct)){return this.registry.getObject(ct)}const pt=this.applicationContext.registry.getDefinition(ct);if(pt){if(pt.isRequestScope()||pt.id===ft.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().createAsync({definition:pt,args:ut})}}if(this.parent){return this.parent.getAsync(ct,ut)}}async ready(){}getContext(){return this.ctx}}ut.MidwayRequestContainer=MidwayRequestContainer},76271:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Aspect=void 0;const dt=pt(49757);const ft=pt(18025);const _t=pt(6192);function Aspect(ct,ut,pt){return function(mt){(0,dt.saveModule)(dt.ASPECT_KEY,mt);const ht=[].concat(ct);for(const ct of ht){(0,dt.attachClassMetadata)(dt.ASPECT_KEY,{aspectTarget:ct,match:ut,priority:pt},mt)}(0,ft.Scope)(_t.ScopeEnum.Singleton)(mt);(0,dt.Provide)()(mt)}}ut.Aspect=Aspect},2940:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Autoload=void 0;const dt=pt(45317);const ft=pt(39990);function Autoload(){return function(ct){(0,dt.savePreloadModule)(ct);(0,ft.Provide)()(ct)}}ut.Autoload=Autoload},73821:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=void 0;const dt=pt(49757);function Configuration(ct={}){return ut=>{(0,dt.saveClassMetadata)(dt.CONFIGURATION_KEY,ct,ut)}}ut.Configuration=Configuration},41573:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Match=ut.Catch=void 0;const dt=pt(45317);const ft=pt(75105);const _t=pt(18025);const mt=pt(39990);const ht=pt(6192);function Catch(ct,ut={}){return function(pt){const yt=ct?[].concat(ct):undefined;(0,dt.saveClassMetadata)(ft.CATCH_KEY,{catchTargets:yt,catchOptions:ut},pt);(0,_t.Scope)(ht.ScopeEnum.Singleton)(pt);(0,mt.Provide)()(pt)}}ut.Catch=Catch;function Match(ct=true){return function(ut){(0,dt.saveClassMetadata)(ft.MATCH_KEY,{matchPattern:ct},ut);(0,_t.Scope)(ht.ScopeEnum.Singleton)(ut);(0,mt.Provide)()(ut)}}ut.Match=Match},1623:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApplicationContext=ut.Logger=ut.App=ut.Config=ut.Plugin=ut.Framework=void 0;const dt=pt(49757);const ft=pt(6192);function Framework(){return ct=>{(0,dt.saveModule)(dt.FRAMEWORK_KEY,ct);(0,dt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,dt.Provide)()(ct)}}ut.Framework=Framework;function Plugin(ct){return(0,dt.createCustomPropertyDecorator)(dt.PLUGIN_KEY,{identifier:ct})}ut.Plugin=Plugin;function Config(ct){return(0,dt.createCustomPropertyDecorator)(dt.CONFIG_KEY,{identifier:ct})}ut.Config=Config;function App(ct){return(0,dt.createCustomPropertyDecorator)(dt.APPLICATION_KEY,{type:ct})}ut.App=App;function Logger(ct){return(0,dt.createCustomPropertyDecorator)(dt.LOGGER_KEY,{identifier:ct})}ut.Logger=Logger;function ApplicationContext(){return(0,dt.createCustomPropertyDecorator)(dt.APPLICATION_CONTEXT_KEY,{})}ut.ApplicationContext=ApplicationContext},41958:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Guard=ut.UseGuard=void 0;const dt=pt(45317);const ft=pt(6192);const _t=pt(75105);const mt=pt(39990);const ht=pt(18025);function UseGuard(ct){return(ut,pt,ft)=>{if(!Array.isArray(ct)){ct=[ct]}if(pt){(0,dt.savePropertyMetadata)(_t.GUARD_KEY,ct,ut,pt)}else{(0,dt.saveClassMetadata)(_t.GUARD_KEY,ct,ut)}}}ut.UseGuard=UseGuard;function Guard(){return ct=>{(0,mt.Provide)()(ct);(0,ht.Scope)(ft.ScopeEnum.Singleton)(ct)}}ut.Guard=Guard},92922:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.InjectClient=ut.Inject=void 0;const dt=pt(45317);const ft=pt(75105);function Inject(ct){return function(ut,pt){(0,dt.savePropertyInject)({target:ut,targetKey:pt,identifier:ct})}}ut.Inject=Inject;function InjectClient(ct,ut){return(0,dt.createCustomPropertyDecorator)(ft.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:ct,clientName:ut})}ut.InjectClient=InjectClient},17511:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Middleware=void 0;const dt=pt(49757);const ft=pt(6192);function Middleware(){return ct=>{(0,dt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,dt.Provide)()(ct)}}ut.Middleware=Middleware},56329:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Mock=void 0;const dt=pt(49757);const ft=pt(6192);function Mock(){return ct=>{(0,dt.saveModule)(dt.MOCK_KEY,ct);(0,dt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,dt.Provide)()(ct)}}ut.Mock=Mock},18025:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Singleton=ut.Scope=ut.Destroy=ut.Init=void 0;const dt=pt(45317);const ft=pt(39990);const _t=pt(6192);function Init(){return function(ct,ut){(0,dt.saveObjectDefinition)(ct,{initMethod:ut})}}ut.Init=Init;function Destroy(){return function(ct,ut){(0,dt.saveObjectDefinition)(ct,{destroyMethod:ut})}}ut.Destroy=Destroy;function Scope(ct,ut){return function(pt){(0,dt.saveObjectDefinition)(pt,{scope:ct,...ut})}}ut.Scope=Scope;function Singleton(){return function(ct){Scope(_t.ScopeEnum.Singleton)(ct);(0,ft.Provide)()(ct)}}ut.Singleton=Singleton},64331:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Pipe=void 0;const dt=pt(49757);const ft=pt(6192);function Pipe(){return ct=>{(0,dt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,dt.Provide)()(ct)}}ut.Pipe=Pipe},52953:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Pipeline=void 0;const dt=pt(45317);const ft=pt(75105);function Pipeline(ct){return(0,dt.createCustomPropertyDecorator)(ft.PIPELINE_IDENTIFIER,{valves:ct})}ut.Pipeline=Pipeline},39990:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Provide=void 0;const dt=pt(45317);function Provide(ct){return function(ut){return(0,dt.saveProviderId)(ct,ut)}}ut.Provide=Provide},75105:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.TAGGED_CLS=ut.INJECT_CUSTOM_PARAM=ut.INJECT_CUSTOM_METHOD=ut.INJECT_CUSTOM_PROPERTY=ut.INJECT_TAG=ut.NAMED_TAG=ut.CLASS_KEY_CONSTRUCTOR=ut.APPLICATION_CONTEXT_KEY=ut.APPLICATION_KEY=ut.LOGGER_KEY=ut.PLUGIN_KEY=ut.CONFIG_KEY=ut.MS_HSF_METHOD_KEY=ut.MS_DUBBO_METHOD_KEY=ut.MS_GRPC_METHOD_KEY=ut.MS_PROVIDER_KEY=ut.MS_PRODUCER_KEY=ut.MS_CONSUMER_KEY=ut.RPC_DUBBO_KEY=ut.RPC_GRPC_KEY=ut.HSF_KEY=ut.WS_EVENT_KEY=ut.WS_CONTROLLER_KEY=ut.MODULE_TASK_QUEUE_OPTIONS=ut.MODULE_TASK_QUEUE_KEY=ut.MODULE_TASK_TASK_LOCAL_OPTIONS=ut.MODULE_TASK_TASK_LOCAL_KEY=ut.MODULE_TASK_METADATA=ut.MODULE_TASK_KEY=ut.WEB_RESPONSE_RENDER=ut.WEB_RESPONSE_CONTENT_TYPE=ut.WEB_RESPONSE_HEADER=ut.WEB_RESPONSE_REDIRECT=ut.WEB_RESPONSE_HTTP_CODE=ut.WEB_RESPONSE_KEY=ut.WEB_ROUTER_PARAM_KEY=ut.WEB_ROUTER_KEY=ut.CONTROLLER_KEY=ut.SERVERLESS_FUNC_KEY=ut.FUNC_KEY=ut.FACTORY_SERVICE_CLIENT_KEY=ut.MOCK_KEY=ut.GUARD_KEY=ut.MATCH_KEY=ut.CATCH_KEY=ut.ASPECT_KEY=ut.FRAMEWORK_KEY=ut.CONFIGURATION_KEY=ut.SCHEDULE_KEY=ut.ALL=void 0;ut.PRIVATE_META_DATA_KEY=ut.MAIN_MODULE_KEY=ut.LIFECYCLE_IDENTIFIER_PREFIX=ut.PIPELINE_IDENTIFIER=ut.OBJ_DEF_CLS=ut.TAGGED_FUN=void 0;ut.ALL="common:all_value_key";ut.SCHEDULE_KEY="common:schedule";ut.CONFIGURATION_KEY="common:configuration";ut.FRAMEWORK_KEY="common:framework";ut.ASPECT_KEY="common:aspect";ut.CATCH_KEY="common:catch";ut.MATCH_KEY="common:match";ut.GUARD_KEY="common:guard";ut.MOCK_KEY="common:mock";ut.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";ut.FUNC_KEY="faas:func";ut.SERVERLESS_FUNC_KEY="faas:serverless:function";ut.CONTROLLER_KEY="web:controller";ut.WEB_ROUTER_KEY="web:router";ut.WEB_ROUTER_PARAM_KEY="web:router_param";ut.WEB_RESPONSE_KEY="web:response";ut.WEB_RESPONSE_HTTP_CODE="web:response_http_code";ut.WEB_RESPONSE_REDIRECT="web:response_redirect";ut.WEB_RESPONSE_HEADER="web:response_header";ut.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";ut.WEB_RESPONSE_RENDER="web:response_render";ut.MODULE_TASK_KEY="task:task";ut.MODULE_TASK_METADATA="task:task:options";ut.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";ut.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";ut.MODULE_TASK_QUEUE_KEY="task:task:queue";ut.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";ut.WS_CONTROLLER_KEY="ws:controller";ut.WS_EVENT_KEY="ws:event";ut.HSF_KEY="rpc:hsf";ut.RPC_GRPC_KEY="rpc:grpc";ut.RPC_DUBBO_KEY="rpc:dubbo";ut.MS_CONSUMER_KEY="ms:consumer";ut.MS_PRODUCER_KEY="ms:producer";ut.MS_PROVIDER_KEY="ms:provider";ut.MS_GRPC_METHOD_KEY="ms:grpc:method";ut.MS_DUBBO_METHOD_KEY="ms:dubbo:method";ut.MS_HSF_METHOD_KEY="ms:hsf:method";ut.CONFIG_KEY="config";ut.PLUGIN_KEY="plugin";ut.LOGGER_KEY="logger";ut.APPLICATION_KEY="__midway_framework_app__";ut.APPLICATION_CONTEXT_KEY="__midway_application_context__";ut.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";ut.NAMED_TAG="named";ut.INJECT_TAG="inject";ut.INJECT_CUSTOM_PROPERTY="inject_custom_property";ut.INJECT_CUSTOM_METHOD="inject_custom_method";ut.INJECT_CUSTOM_PARAM="inject_custom_param";ut.TAGGED_CLS="injection:tagged_class";ut.TAGGED_FUN="injection:tagged_function";ut.OBJ_DEF_CLS="injection:object_definition_class";ut.PIPELINE_IDENTIFIER="__pipeline_identifier__";ut.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__";ut.MAIN_MODULE_KEY="__main__";ut.PRIVATE_META_DATA_KEY="__midway_private_meta_data__"},45317:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createCustomParamDecorator=ut.createCustomMethodDecorator=ut.createCustomPropertyDecorator=ut.getMethodReturnTypes=ut.getPropertyType=ut.getMethodParamTypes=ut.BaseType=ut.isProvide=ut.getProviderUUId=ut.getProviderName=ut.getProviderId=ut.saveProviderId=ut.getObjectDefinition=ut.saveObjectDefinition=ut.getPropertyInject=ut.savePropertyInject=ut.transformTypeFromTSDesign=ut.clearAllModule=ut.resetModule=ut.listModule=ut.clearBindContainer=ut.bindContainer=ut.saveModule=ut.listPreloadModule=ut.savePreloadModule=ut.getPropertyMetadata=ut.attachPropertyMetadata=ut.savePropertyMetadata=ut.listPropertyDataFromClass=ut.getPropertyDataFromClass=ut.attachPropertyDataToClass=ut.savePropertyDataToClass=ut.getClassMetadata=ut.getClassExtendedMetadata=ut.attachClassMetadata=ut.saveClassMetadata=ut.DecoratorManager=ut.INJECT_CLASS_KEY_PREFIX=ut.PRELOAD_MODULE_KEY=void 0;pt(37159);const dt=pt(6192);const ft=pt(75105);const _t=pt(63289);const mt=pt(90406);const ht=pt(65308);const yt=pt(61327);const vt=pt(39023).debuglog("midway:core");ut.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY";ut.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class DecoratorManager extends Map{constructor(){super(...arguments);this.injectClassKeyPrefix=ut.INJECT_CLASS_KEY_PREFIX;this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA";this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(ct,ut){if(this.container){return this.container.saveModule(ct,ut)}if(!this.has(ct)){this.set(ct,new Set)}this.get(ct).add(ut)}listModule(ct){if(this.container){return this.container.listModule(ct)}return Array.from(this.get(ct)||{})}resetModule(ct){this.set(ct,new Set)}bindContainer(ct){this.container=ct;this.container.transformModule(this)}static getDecoratorClassKey(ct){return ct.toString()+"_CLS"}static removeDecoratorClassKeySuffix(ct){return ct.toString().replace("_CLS","")}static getDecoratorMethodKey(ct){return ct.toString()+"_METHOD"}static getDecoratorClsExtendedKey(ct){return ct.toString()+"_EXT"}static getDecoratorClsMethodPrefix(ct){return ct.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(ct,ut){return DecoratorManager.getDecoratorClsMethodPrefix(ct)+":"+ut.toString()}static getDecoratorMethod(ct,ut){return DecoratorManager.getDecoratorMethodKey(ct)+"_"+ut.toString()}static saveMetadata(ct,ut,pt,dt){if(typeof ut==="object"&&ut.constructor){ut=ut.constructor}let ft;if(Reflect.hasOwnMetadata(ct,ut)){ft=Reflect.getMetadata(ct,ut)}else{ft=new Map}ft.set(pt,dt);Reflect.defineMetadata(ct,ft,ut)}static attachMetadata(ct,ut,pt,dt,ft,_t="one"){if(typeof ut==="object"&&ut.constructor){ut=ut.constructor}let mt;if(Reflect.hasOwnMetadata(ct,ut)){mt=Reflect.getMetadata(ct,ut)}else{mt=new Map}if(!mt.has(pt)){if(ft){mt.set(pt,{})}else{mt.set(pt,[])}}if(ft){if(_t==="one"){mt.get(pt)[ft]=dt}else{if(mt.get(pt)[ft]){mt.get(pt)[ft].push(dt)}else{mt.get(pt)[ft]=[dt]}}}else{mt.get(pt).push(dt)}Reflect.defineMetadata(ct,mt,ut)}static getMetadata(ct,ut,pt){if(typeof ut==="object"&&ut.constructor){ut=ut.constructor}let dt;if(!Reflect.hasOwnMetadata(ct,ut)){dt=new Map;Reflect.defineMetadata(ct,dt,ut)}else{dt=Reflect.getMetadata(ct,ut)}if(!pt){return dt}return dt.get(pt)}saveMetadata(ct,ut,pt,dt){if(dt){const ft=DecoratorManager.getDecoratorMethod(ct,dt);DecoratorManager.saveMetadata(this.injectMethodKeyPrefix,pt,ft,ut)}else{const dt=DecoratorManager.getDecoratorClassKey(ct);DecoratorManager.saveMetadata(this.injectClassKeyPrefix,pt,dt,ut)}}attachMetadata(ct,ut,pt,dt,ft,_t){if(dt){const mt=DecoratorManager.getDecoratorMethod(ct,dt);DecoratorManager.attachMetadata(this.injectMethodKeyPrefix,pt,mt,ut,ft,_t)}else{const dt=DecoratorManager.getDecoratorClassKey(ct);DecoratorManager.attachMetadata(this.injectClassKeyPrefix,pt,dt,ut,ft,_t)}}getMetadata(ct,ut,pt){if(pt){const dt=DecoratorManager.getDecoratorMethod(ct,pt);return DecoratorManager.getMetadata(this.injectMethodKeyPrefix,ut,dt)}else{const pt=`${DecoratorManager.getDecoratorClassKey(ct)}`;return DecoratorManager.getMetadata(this.injectClassKeyPrefix,ut,pt)}}savePropertyDataToClass(ct,ut,pt,dt){const ft=DecoratorManager.getDecoratorClsMethodKey(ct,dt);DecoratorManager.saveMetadata(this.injectClassMethodKeyPrefix,pt,ft,ut)}attachPropertyDataToClass(ct,ut,pt,dt,ft){const _t=DecoratorManager.getDecoratorClsMethodKey(ct,dt);DecoratorManager.attachMetadata(this.injectClassMethodKeyPrefix,pt,_t,ut,ft)}getPropertyDataFromClass(ct,ut,pt){const dt=DecoratorManager.getDecoratorClsMethodKey(ct,pt);return DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,ut,dt)}listPropertyDataFromClass(ct,ut){const pt=DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,ut);const dt=[];for(const[ut,ft]of pt){if(ut.indexOf(DecoratorManager.getDecoratorClsMethodPrefix(ct))!==-1){dt.push(ft)}}return dt}}ut.DecoratorManager=DecoratorManager;let St=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 ct=(0,yt.getModuleRequirePathList)("@midwayjs/core");if(ct.length){console.info("The module may be located in:");ct.forEach(((ct,ut)=>{console.info(`${ut+1}. ${ct}`)}))}St=global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]}else{global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=St}}function saveClassMetadata(ct,ut,pt,dt){if(dt&&typeof ut==="object"){const dt=St.getMetadata(ct,pt);if(!dt){return St.saveMetadata(ct,ut,pt)}if(Array.isArray(dt)){return St.saveMetadata(ct,dt.concat(ut),pt)}else{return St.saveMetadata(ct,Object.assign(dt,ut),pt)}}else{return St.saveMetadata(ct,ut,pt)}}ut.saveClassMetadata=saveClassMetadata;function attachClassMetadata(ct,ut,pt,dt,ft){return St.attachMetadata(ct,ut,pt,undefined,dt,ft)}ut.attachClassMetadata=attachClassMetadata;function getClassExtendedMetadata(ct,ut,pt,dt){if(dt===undefined){dt=true}const ft=DecoratorManager.getDecoratorClsExtendedKey(ct);let _t=St.getMetadata(ft,ut,pt);if(dt&&_t!==undefined){return _t}const mt=Reflect.getPrototypeOf(ut);if(mt&&mt.constructor!==Object){_t=(0,ht.merge)(getClassExtendedMetadata(ct,mt,pt,dt),St.getMetadata(ct,ut,pt))}St.saveMetadata(ft,_t||null,ut,pt);return _t}ut.getClassExtendedMetadata=getClassExtendedMetadata;function getClassMetadata(ct,ut){return St.getMetadata(ct,ut)}ut.getClassMetadata=getClassMetadata;function savePropertyDataToClass(ct,ut,pt,dt){return St.savePropertyDataToClass(ct,ut,pt,dt)}ut.savePropertyDataToClass=savePropertyDataToClass;function attachPropertyDataToClass(ct,ut,pt,dt,ft){return St.attachPropertyDataToClass(ct,ut,pt,dt,ft)}ut.attachPropertyDataToClass=attachPropertyDataToClass;function getPropertyDataFromClass(ct,ut,pt){return St.getPropertyDataFromClass(ct,ut,pt)}ut.getPropertyDataFromClass=getPropertyDataFromClass;function listPropertyDataFromClass(ct,ut){return St.listPropertyDataFromClass(ct,ut)}ut.listPropertyDataFromClass=listPropertyDataFromClass;function savePropertyMetadata(ct,ut,pt,dt){return St.saveMetadata(ct,ut,pt,dt)}ut.savePropertyMetadata=savePropertyMetadata;function attachPropertyMetadata(ct,ut,pt,dt){return St.attachMetadata(ct,ut,pt,dt)}ut.attachPropertyMetadata=attachPropertyMetadata;function getPropertyMetadata(ct,ut,pt){return St.getMetadata(ct,ut,pt)}ut.getPropertyMetadata=getPropertyMetadata;function savePreloadModule(ct){return saveModule(ut.PRELOAD_MODULE_KEY,ct)}ut.savePreloadModule=savePreloadModule;function listPreloadModule(){return listModule(ut.PRELOAD_MODULE_KEY)}ut.listPreloadModule=listPreloadModule;function saveModule(ct,ut){if((0,_t.isClass)(ut)){saveProviderId(undefined,ut)}return St.saveModule(ct,ut)}ut.saveModule=saveModule;function bindContainer(ct){return St.bindContainer(ct)}ut.bindContainer=bindContainer;function clearBindContainer(){return St.container=null}ut.clearBindContainer=clearBindContainer;function listModule(ct,ut){const pt=St.listModule(ct);if(ut){return pt.filter(ut)}else{return pt}}ut.listModule=listModule;function resetModule(ct){return St.resetModule(ct)}ut.resetModule=resetModule;function clearAllModule(){vt("--- clear all module here ---");return St.clear()}ut.clearAllModule=clearAllModule;function transformTypeFromTSDesign(ct){if((0,_t.isNullOrUndefined)(ct)){return{name:"undefined",isBaseType:true,originDesign:ct}}switch(ct.name){case"String":return{name:"string",isBaseType:true,originDesign:ct};case"Number":return{name:"number",isBaseType:true,originDesign:ct};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:ct};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:ct};case"Object":return{name:"object",isBaseType:true,originDesign:ct};case"Function":return{name:"function",isBaseType:true,originDesign:ct};default:return{name:ct.name,isBaseType:false,originDesign:ct}}}ut.transformTypeFromTSDesign=transformTypeFromTSDesign;function savePropertyInject(ct){let ut=ct.identifier;let pt=dt.InjectModeEnum.Identifier;if(!ut){const ft=getPropertyType(ct.target,ct.targetKey);if(!ft.isBaseType&&(0,_t.isClass)(ft.originDesign)&&isProvide(ft.originDesign)){ut=getProviderUUId(ft.originDesign);pt=dt.InjectModeEnum.Class}if(!ut){ut=ct.targetKey;pt=dt.InjectModeEnum.PropertyName}}attachClassMetadata(ft.INJECT_TAG,{targetKey:ct.targetKey,value:ut,args:ct.args,injectMode:pt},ct.target,ct.targetKey)}ut.savePropertyInject=savePropertyInject;function getPropertyInject(ct,ut){return getClassExtendedMetadata(ft.INJECT_TAG,ct,undefined,ut)}ut.getPropertyInject=getPropertyInject;function saveObjectDefinition(ct,ut={}){saveClassMetadata(ft.OBJ_DEF_CLS,ut,ct,true);return ct}ut.saveObjectDefinition=saveObjectDefinition;function getObjectDefinition(ct){return getClassExtendedMetadata(ft.OBJ_DEF_CLS,ct)}ut.getObjectDefinition=getObjectDefinition;function saveProviderId(ct,ut){if(isProvide(ut)){if(ct){const pt=getClassMetadata(ft.TAGGED_CLS,ut);if(pt.id!==ct){pt.id=ct;saveClassMetadata(ft.TAGGED_CLS,pt,ut);vt(`update provide: ${ut.name} -> ${pt.uuid}`)}}}else{const pt=(0,ht.generateRandomId)();saveClassMetadata(ft.TAGGED_CLS,{id:ct,originName:ut.name,uuid:pt,name:(0,mt.camelCase)(ut.name)},ut);vt(`save provide: ${ut.name} -> ${pt}`)}return ut}ut.saveProviderId=saveProviderId;function getProviderId(ct){const ut=getClassMetadata(ft.TAGGED_CLS,ct);if(ut&&ut.id){return ut.id}}ut.getProviderId=getProviderId;function getProviderName(ct){const ut=getClassMetadata(ft.TAGGED_CLS,ct);if(ut&&ut.name){return ut.name}}ut.getProviderName=getProviderName;function getProviderUUId(ct){const ut=getClassMetadata(ft.TAGGED_CLS,ct);if(ut&&ut.uuid){return ut.uuid}}ut.getProviderUUId=getProviderUUId;function isProvide(ct){return!!getClassMetadata(ft.TAGGED_CLS,ct)}ut.isProvide=isProvide;var bt;(function(ct){ct["Boolean"]="boolean";ct["Number"]="number";ct["String"]="string"})(bt=ut.BaseType||(ut.BaseType={}));function getMethodParamTypes(ct,ut){if((0,_t.isClass)(ct)){ct=ct.prototype}return Reflect.getMetadata("design:paramtypes",ct,ut)}ut.getMethodParamTypes=getMethodParamTypes;function getPropertyType(ct,ut){return transformTypeFromTSDesign(Reflect.getMetadata("design:type",ct,ut))}ut.getPropertyType=getPropertyType;function getMethodReturnTypes(ct,ut){if((0,_t.isClass)(ct)){ct=ct.prototype}return Reflect.getMetadata("design:returntype",ct,ut)}ut.getMethodReturnTypes=getMethodReturnTypes;function createCustomPropertyDecorator(ct,ut,pt=true){return function(dt,_t){attachClassMetadata(ft.INJECT_CUSTOM_PROPERTY,{propertyName:_t,key:ct,metadata:ut,impl:pt},dt,_t)}}ut.createCustomPropertyDecorator=createCustomPropertyDecorator;function createCustomMethodDecorator(ct,ut,pt={impl:true}){if(typeof pt==="boolean"){pt={impl:pt}}if(pt.impl===undefined){pt.impl=true}return function(dt,_t,mt){attachClassMetadata(ft.INJECT_CUSTOM_METHOD,{propertyName:_t,key:ct,metadata:ut,options:pt},dt)}}ut.createCustomMethodDecorator=createCustomMethodDecorator;function createCustomParamDecorator(ct,ut,pt={impl:true}){if(typeof pt==="boolean"){pt={impl:pt}}if(pt.impl===undefined){pt.impl=true}return function(dt,_t,mt){attachClassMetadata(ft.INJECT_CUSTOM_PARAM,{key:ct,parameterIndex:mt,propertyName:_t,metadata:ut,options:pt},dt,_t,"multi")}}ut.createCustomParamDecorator=createCustomParamDecorator},69193:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ServerlessTrigger=ut.ServerlessFunction=void 0;const dt=pt(49757);const ft=pt(6192);function ServerlessFunction(ct){return(ut,pt,ft)=>{(0,dt.savePropertyMetadata)(dt.SERVERLESS_FUNC_KEY,ct,ut,pt)}}ut.ServerlessFunction=ServerlessFunction;function ServerlessTrigger(ct,ut={}){return(pt,_t,mt)=>{var ht;if(ct===ft.ServerlessTriggerType.HTTP||ct===ft.ServerlessTriggerType.API_GATEWAY){ut["method"]=(ht=ut["method"])!==null&&ht!==void 0?ht:"get"}(0,dt.saveModule)(dt.FUNC_KEY,pt.constructor);ut=ut||{};(0,dt.attachClassMetadata)(dt.FUNC_KEY,{type:ct,methodName:_t,metadata:ut},pt)}}ut.ServerlessTrigger=ServerlessTrigger},49757:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ft(pt(39990),ut);ft(pt(92922),ut);ft(pt(52953),ut);ft(pt(76271),ut);ft(pt(2940),ut);ft(pt(73821),ut);ft(pt(18025),ut);ft(pt(1623),ut);ft(pt(41573),ut);ft(pt(17511),ut);ft(pt(41958),ut);ft(pt(64331),ut);ft(pt(56329),ut);ft(pt(69193),ut);ft(pt(86690),ut);ft(pt(58843),ut);ft(pt(29619),ut);ft(pt(92233),ut);ft(pt(75105),ut);ft(pt(45317),ut);ft(pt(573),ut);ft(pt(4132),ut);ft(pt(76543),ut);ft(pt(64767),ut);ft(pt(41684),ut);ft(pt(17640),ut);ft(pt(81970),ut);ft(pt(52963),ut);ft(pt(57706),ut);ft(pt(67999),ut);ft(pt(20551),ut)},573:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Consumer=void 0;const dt=pt(49757);const ft=pt(6192);function Consumer(ct,ut={}){return pt=>{(0,dt.saveModule)(dt.MS_CONSUMER_KEY,pt);(0,dt.saveClassMetadata)(dt.MS_CONSUMER_KEY,{type:ct,metadata:ut},pt);(0,dt.Scope)(ft.ScopeEnum.Request)(pt);(0,dt.Provide)()(pt)}}ut.Consumer=Consumer},64767:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.KafkaListener=void 0;const dt=pt(49757);function KafkaListener(ct,ut={}){return(pt,ft)=>{ut.topic=ct;ut.propertyKey=ft;(0,dt.attachPropertyDataToClass)(dt.MS_CONSUMER_KEY,ut,pt,ft)}}ut.KafkaListener=KafkaListener},4132:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.DubboMethod=ut.GrpcMethod=ut.GrpcStreamTypeEnum=ut.Provider=void 0;const dt=pt(49757);const ft=pt(6192);function Provider(ct,ut={}){return pt=>{(0,dt.saveModule)(dt.MS_PROVIDER_KEY,pt);(0,dt.saveClassMetadata)(dt.MS_PROVIDER_KEY,{type:ct,metadata:ut},pt);(0,dt.Scope)(ft.ScopeEnum.Request)(pt);(0,dt.Provide)()(pt)}}ut.Provider=Provider;var _t;(function(ct){ct["BASE"]="base";ct["DUPLEX"]="ServerDuplexStream";ct["READABLE"]="ServerReadableStream";ct["WRITEABLE"]="ServerWritableStream"})(_t=ut.GrpcStreamTypeEnum||(ut.GrpcStreamTypeEnum={}));function GrpcMethod(ct={}){return(ut,pt,ft)=>{if(!ct.type){ct.type=_t.BASE}(0,dt.savePropertyMetadata)(dt.MS_GRPC_METHOD_KEY,{methodName:ct.methodName||pt,type:ct.type,onEnd:ct.onEnd},ut,pt);return ft}}ut.GrpcMethod=GrpcMethod;function DubboMethod(ct){return(ut,pt,ft)=>{(0,dt.attachClassMetadata)(dt.MS_DUBBO_METHOD_KEY,{methodName:ct||pt},ut);return ft}}ut.DubboMethod=DubboMethod},76543:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.RabbitMQListener=void 0;const dt=pt(49757);function RabbitMQListener(ct,ut={}){return(pt,ft)=>{ut.queueName=ct;ut.propertyKey=ft;(0,dt.attachPropertyDataToClass)(dt.MS_CONSUMER_KEY,ut,pt,ft)}}ut.RabbitMQListener=RabbitMQListener},41684:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.HSF=void 0;const dt=pt(49757);const ft=pt(6192);function HSF(ct={}){return ut=>{(0,dt.saveModule)(dt.HSF_KEY,ut);(0,dt.saveClassMetadata)(dt.HSF_KEY,ct,ut);(0,dt.Scope)(ft.ScopeEnum.Request)(ut);(0,dt.Provide)()(ut)}}ut.HSF=HSF},17640:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Queue=void 0;const dt=pt(49757);const ft=pt(75105);function Queue(ct){return function(ut){(0,dt.saveModule)(ft.MODULE_TASK_QUEUE_KEY,ut);(0,dt.saveClassMetadata)(ft.MODULE_TASK_QUEUE_OPTIONS,{options:ct,name:ut.name},ut);(0,dt.Provide)()(ut)}}ut.Queue=Queue},57706:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Schedule=void 0;const dt=pt(49757);const ft=pt(6192);function Schedule(ct){return function(ut){(0,dt.saveModule)(dt.SCHEDULE_KEY,ut);(0,dt.saveClassMetadata)(dt.SCHEDULE_KEY,ct,ut);(0,dt.Scope)(ft.ScopeEnum.Request)(ut);(0,dt.Provide)()(ut)}}ut.Schedule=Schedule},81970:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Task=void 0;const dt=pt(49757);const ft=pt(75105);function Task(ct){return function(ut,pt,_t){(0,dt.saveModule)(ft.MODULE_TASK_KEY,ut.constructor);(0,dt.attachClassMetadata)(ft.MODULE_TASK_METADATA,{options:ct,propertyKey:pt,value:_t.value,name:ut.constructor.name},ut)}}ut.Task=Task},52963:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.TaskLocal=void 0;const dt=pt(49757);const ft=pt(75105);function TaskLocal(ct){return function(ut,pt,_t){(0,dt.saveModule)(ft.MODULE_TASK_TASK_LOCAL_KEY,ut.constructor);(0,dt.attachClassMetadata)(ft.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:ct,propertyKey:pt,value:_t.value},ut)}}ut.TaskLocal=TaskLocal},86690:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Controller=void 0;const dt=pt(49757);const ft=pt(6192);function Controller(ct="/",ut={middleware:[],sensitive:true}){return pt=>{(0,dt.saveModule)(dt.CONTROLLER_KEY,pt);if(ct)(0,dt.saveClassMetadata)(dt.CONTROLLER_KEY,{prefix:ct,routerOptions:ut},pt);(0,dt.Scope)(ft.ScopeEnum.Request)(pt);(0,dt.Provide)()(pt)}}ut.Controller=Controller},58843:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Fields=ut.Queries=ut.RequestIP=ut.RequestPath=ut.Files=ut.File=ut.Headers=ut.Param=ut.Query=ut.Body=ut.Session=ut.createRequestParamDecorator=ut.RouteParamTypes=void 0;const dt=pt(49757);var ft;(function(ct){ct["QUERY"]="query";ct["BODY"]="body";ct["PARAM"]="param";ct["HEADERS"]="headers";ct["SESSION"]="session";ct["FILESTREAM"]="file_stream";ct["FILESSTREAM"]="files_stream";ct["NEXT"]="next";ct["REQUEST_PATH"]="request_path";ct["REQUEST_IP"]="request_ip";ct["QUERIES"]="queries";ct["FIELDS"]="fields";ct["CUSTOM"]="custom"})(ft=ut.RouteParamTypes||(ut.RouteParamTypes={}));const createParamMapping=function(ct){return(ut,pt={})=>{let ft=ut;if(Array.isArray(ut)&&pt.pipes===undefined){pt.pipes=ut;ft=undefined}return(0,dt.createCustomParamDecorator)(dt.WEB_ROUTER_PARAM_KEY,{type:ct,propertyData:ft},pt)}};const createRequestParamDecorator=function(ct,ut){ut=ut||{};if(Array.isArray(ut)){ut={pipes:ut}}return createParamMapping(ft.CUSTOM)(ct,ut)};ut.createRequestParamDecorator=createRequestParamDecorator;const Session=(ct,ut)=>createParamMapping(ft.SESSION)(ct,{pipes:ut});ut.Session=Session;const Body=(ct,ut)=>createParamMapping(ft.BODY)(ct,{pipes:ut});ut.Body=Body;const Query=(ct,ut)=>createParamMapping(ft.QUERY)(ct,{pipes:ut});ut.Query=Query;const Param=(ct,ut)=>createParamMapping(ft.PARAM)(ct,{pipes:ut});ut.Param=Param;const Headers=(ct,ut)=>createParamMapping(ft.HEADERS)(ct,{pipes:ut});ut.Headers=Headers;const File=(ct,ut)=>createParamMapping(ft.FILESTREAM)(ct,{pipes:ut});ut.File=File;const Files=(ct,ut)=>createParamMapping(ft.FILESSTREAM)(ct,{pipes:ut});ut.Files=Files;const RequestPath=ct=>createParamMapping(ft.REQUEST_PATH)(undefined,{pipes:ct});ut.RequestPath=RequestPath;const RequestIP=ct=>createParamMapping(ft.REQUEST_IP)(undefined,{pipes:ct});ut.RequestIP=RequestIP;const Queries=(ct,ut)=>createParamMapping(ft.QUERIES)(ct,{pipes:ut});ut.Queries=Queries;const Fields=(ct,ut)=>createParamMapping(ft.FIELDS)(ct,{pipes:ut});ut.Fields=Fields},29619:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.All=ut.Head=ut.Options=ut.Patch=ut.Put=ut.Del=ut.Get=ut.Post=ut.RequestMapping=ut.RequestMethod=void 0;const dt=pt(49757);ut.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const ft={path:"/",requestMethod:ut.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(ct=ft)=>{const pt=ct.path||"/";const _t=ct.requestMethod||ut.RequestMethod.GET;const mt=ct.routerName;const ht=ct.middleware;return(ut,ft,yt)=>{var vt;(0,dt.attachClassMetadata)(dt.WEB_ROUTER_KEY,{path:pt,requestMethod:_t,routerName:mt,method:ft,middleware:ht,summary:(ct===null||ct===void 0?void 0:ct.summary)||"",description:(ct===null||ct===void 0?void 0:ct.description)||"",ignoreGlobalPrefix:(vt=ct===null||ct===void 0?void 0:ct.ignoreGlobalPrefix)!==null&&vt!==void 0?vt:false},ut);return yt}};ut.RequestMapping=RequestMapping;const createMappingDecorator=ct=>(pt,dt={middleware:[]})=>(0,ut.RequestMapping)(Object.assign(dt,{requestMethod:ct,path:pt}));ut.Post=createMappingDecorator(ut.RequestMethod.POST);ut.Get=createMappingDecorator(ut.RequestMethod.GET);ut.Del=createMappingDecorator(ut.RequestMethod.DELETE);ut.Put=createMappingDecorator(ut.RequestMethod.PUT);ut.Patch=createMappingDecorator(ut.RequestMethod.PATCH);ut.Options=createMappingDecorator(ut.RequestMethod.OPTIONS);ut.Head=createMappingDecorator(ut.RequestMethod.HEAD);ut.All=createMappingDecorator(ut.RequestMethod.ALL)},92233:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createRender=ut.ContentType=ut.SetHeader=ut.HttpCode=ut.Redirect=void 0;const dt=pt(49757);function Redirect(ct,ut=302){return(pt,ft,_t)=>{(0,dt.attachPropertyMetadata)(dt.WEB_RESPONSE_KEY,{type:dt.WEB_RESPONSE_REDIRECT,url:ct,code:ut},pt,ft);return _t}}ut.Redirect=Redirect;function HttpCode(ct){return(ut,pt,ft)=>{(0,dt.attachPropertyMetadata)(dt.WEB_RESPONSE_KEY,{type:dt.WEB_RESPONSE_HTTP_CODE,code:ct},ut,pt);return ft}}ut.HttpCode=HttpCode;function SetHeader(ct,ut){return(pt,ft,_t)=>{let mt={};if(ut){mt[ct]=ut}else{mt=ct}(0,dt.attachPropertyMetadata)(dt.WEB_RESPONSE_KEY,{type:dt.WEB_RESPONSE_HEADER,setHeaders:mt},pt,ft);return _t}}ut.SetHeader=SetHeader;function ContentType(ct){return(ut,pt,ft)=>{(0,dt.attachPropertyMetadata)(dt.WEB_RESPONSE_KEY,{type:dt.WEB_RESPONSE_CONTENT_TYPE,contentType:ct},ut,pt);return ft}}ut.ContentType=ContentType;function createRender(ct){return ct=>(ut,pt,ft)=>{(0,dt.attachPropertyMetadata)(dt.WEB_RESPONSE_KEY,{type:dt.WEB_RESPONSE_RENDER,templateName:ct},ut,pt);return ft}}ut.createRender=createRender},67999:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.WSController=void 0;const dt=pt(49757);const ft=pt(6192);function WSController(ct="/",ut={middleware:[],connectionMiddleware:[]}){return pt=>{(0,dt.saveModule)(dt.WS_CONTROLLER_KEY,pt);(0,dt.saveClassMetadata)(dt.WS_CONTROLLER_KEY,{namespace:ct,routerOptions:ut},pt);(0,dt.Scope)(ft.ScopeEnum.Request)(pt);(0,dt.Provide)()(pt)}}ut.WSController=WSController},20551:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.OnConnection=ut.OnDisConnection=ut.Emit=ut.OnMessage=ut.WSBroadCast=ut.WSEmit=ut.OnWSMessage=ut.OnWSDisConnection=ut.OnWSConnection=ut.WSEventTypeEnum=void 0;const dt=pt(49757);var ft;(function(ct){ct["ON_CONNECTION"]="ws:onConnection";ct["ON_DISCONNECTION"]="ws:onDisconnection";ct["ON_MESSAGE"]="ws:onMessage";ct["ON_SOCKET_ERROR"]="ws:onSocketError";ct["EMIT"]="ws:Emit";ct["BROADCAST"]="ws:broadcast"})(ft=ut.WSEventTypeEnum||(ut.WSEventTypeEnum={}));function OnWSConnection(ct={}){return(ut,pt,_t)=>{(0,dt.attachClassMetadata)(dt.WS_EVENT_KEY,{eventType:ft.ON_CONNECTION,propertyName:pt,eventOptions:ct,descriptor:_t},ut.constructor)}}ut.OnWSConnection=OnWSConnection;function OnWSDisConnection(){return(ct,ut,pt)=>{(0,dt.attachClassMetadata)(dt.WS_EVENT_KEY,{eventType:ft.ON_DISCONNECTION,propertyName:ut,descriptor:pt},ct.constructor)}}ut.OnWSDisConnection=OnWSDisConnection;function OnWSMessage(ct,ut={}){return(pt,_t,mt)=>{(0,dt.attachClassMetadata)(dt.WS_EVENT_KEY,{eventType:ft.ON_MESSAGE,messageEventName:ct,propertyName:_t,eventOptions:ut,descriptor:mt},pt.constructor)}}ut.OnWSMessage=OnWSMessage;function WSEmit(ct,ut=[]){return(pt,_t,mt)=>{(0,dt.attachClassMetadata)(dt.WS_EVENT_KEY,{eventType:ft.EMIT,propertyName:_t,messageEventName:ct,roomName:[].concat(ut),descriptor:mt},pt.constructor)}}ut.WSEmit=WSEmit;function WSBroadCast(ct="",ut=[]){return(pt,_t,mt)=>{(0,dt.attachClassMetadata)(dt.WS_EVENT_KEY,{eventType:ft.BROADCAST,propertyName:_t,messageEventName:ct,roomName:[].concat(ut),descriptor:mt},pt.constructor)}}ut.WSBroadCast=WSBroadCast;ut.OnMessage=OnWSMessage;ut.Emit=WSEmit;ut.OnDisConnection=OnWSDisConnection;ut.OnConnection=OnWSConnection},34881:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.FunctionDefinition=void 0;const dt=pt(6192);const ft=pt(59327);class FunctionWrapperCreator extends ft.ObjectCreator{doConstruct(ct,ut,pt){if(!ct){return null}return ct(pt,ut)}async doConstructAsync(ct,ut,pt){if(!ct){return null}return ct(pt,ut)}}class FunctionDefinition{constructor(){this.constructorArgs=[];this.namespace="";this.asynchronous=true;this.handlerProps=[];this.allowDowngrade=false;this.innerAutowire=false;this.innerScope=dt.ScopeEnum.Singleton;this.creator=new FunctionWrapperCreator(this)}getAttr(ct){}hasAttr(ct){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(ct){this.innerScope=ct}isSingletonScope(){return this.innerScope===dt.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===dt.ScopeEnum.Request}setAttr(ct,ut){}}ut.FunctionDefinition=FunctionDefinition},59327:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ObjectCreator=void 0;const dt=pt(86314);const ft=pt(63289);class ObjectCreator{constructor(ct){this.definition=ct}load(){let ct=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return ct}const ut=this.definition.path;if(this.definition.export){ct=require(ut)[this.definition.export]}else{ct=require(ut)}}else{ct=this.definition.path}return ct}doConstruct(ct,ut){if(!ct){return Object.create(null)}let pt;if(this.definition.constructMethod){pt=ct[this.definition.constructMethod].apply(ct,ut)}else{pt=Reflect.construct(ct,ut)}return pt}async doConstructAsync(ct,ut){if(!ct){return Object.create(null)}let pt;if(this.definition.constructMethod){const dt=ct[this.definition.constructMethod];if(ft.Types.isAsyncFunction(dt)){pt=await dt.apply(ct,ut)}else{pt=dt.apply(ct,ut)}}else{pt=Reflect.construct(ct,ut)}return pt}doInit(ct){const ut=ct;if(this.definition.initMethod&&ut[this.definition.initMethod]){if(ft.Types.isGeneratorFunction(ut[this.definition.initMethod])||ft.Types.isAsyncFunction(ut[this.definition.initMethod])){throw new dt.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const ct=ut[this.definition.initMethod].call(ut);if(ft.Types.isPromise(ct)){throw new dt.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(ct){const ut=ct;if(this.definition.initMethod&&ut[this.definition.initMethod]){const ct=ut[this.definition.initMethod];if(ft.Types.isAsyncFunction(ct)){await ct.call(ut)}else{if(ct.length===1){await new Promise((pt=>{ct.call(ut,pt)}))}else{ct.call(ut)}}}}doDestroy(ct){if(this.definition.destroyMethod&&ct[this.definition.destroyMethod]){ct[this.definition.destroyMethod].call(ct)}}async doDestroyAsync(ct){if(this.definition.destroyMethod&&ct[this.definition.destroyMethod]){const ut=ct[this.definition.destroyMethod];if(ft.Types.isAsyncFunction(ut)){await ut.call(ct)}else{if(ut.length===1){await new Promise((pt=>{ut.call(ct,pt)}))}else{ut.call(ct)}}}}}ut.ObjectCreator=ObjectCreator},47698:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ObjectDefinition=void 0;const dt=pt(6192);const ft=pt(74701);const _t=pt(59327);class ObjectDefinition{constructor(){this._attrs=new Map;this._asynchronous=false;this.scope=dt.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 ft.ObjectProperties;this.namespace="";this.handlerProps=[];this.allowDowngrade=false;this.creator=new _t.ObjectCreator(this)}set asynchronous(ct){this._asynchronous=ct}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===dt.ScopeEnum.Singleton}isRequestScope(){return this.scope===dt.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(ct){return this._attrs.get(ct)}hasAttr(ct){return this._attrs.has(ct)}setAttr(ct,ut){this._attrs.set(ct,ut)}}ut.ObjectDefinition=ObjectDefinition},74701:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ObjectProperties=void 0;class ObjectProperties extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(ct,ut){if(this.has(ct)){return this.get(ct)}return ut}setProperty(ct,ut){return this.set(ct,ut)}}ut.ObjectProperties=ObjectProperties},21769:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayHttpError=ut.MidwayError=ut.registerErrorCode=void 0;const dt=pt(58611);const ft=new Set;function registerErrorCode(ct,ut){if(ft.has(ct)){throw new MidwayError(`Error group ${ct} is duplicated, please check before adding.`)}else{ft.add(ct)}const pt={};for(const dt in ut){pt[dt]=ct.toUpperCase()+"_"+String(ut[dt]).toUpperCase()}return pt}ut.registerErrorCode=registerErrorCode;class MidwayError extends Error{constructor(ct,ut,pt){super(ct);if(!ut||typeof ut==="object"){pt=ut;ut="MIDWAY_10000"}this.name=this.constructor.name;this.code=ut;this.cause=pt===null||pt===void 0?void 0:pt.cause}}ut.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{constructor(ct,ut,pt,ft){super(ct?typeof ct==="string"?ct:ct.message:dt.STATUS_CODES[ut],pt!==null&&pt!==void 0?pt:String(ut),ft);if(ct&&ct["stack"]){this.stack=ct["stack"]}this.status=ut}}ut.MidwayHttpError=MidwayHttpError},37198:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayEmptyValueError=ut.MidwayInvalidConfigPropertyError=ut.MidwayMainFrameworkMissingError=ut.MidwayCodeInvokeTimeoutError=ut.MidwayInvokeForbiddenError=ut.MidwayRetryExceededMaxTimesError=ut.MidwayDuplicateControllerOptionsError=ut.MidwayDuplicateClassNameError=ut.MidwayInconsistentVersionError=ut.MidwayUtilHttpClientTimeoutError=ut.MidwayMissingImportComponentError=ut.MidwaySingletonInjectRequestError=ut.MidwayUseWrongMethodError=ut.MidwayDuplicateRouteError=ut.MidwayResolverMissingError=ut.MidwayInvalidConfigError=ut.MidwayConfigMissingError=ut.MidwayFeatureNotImplementedError=ut.MidwayFeatureNoLongerSupportedError=ut.MidwayDefinitionNotFoundError=ut.MidwayParameterError=ut.MidwayCommonError=ut.FrameworkErrorEnum=void 0;const dt=pt(21769);ut.FrameworkErrorEnum=(0,dt.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 dt.MidwayError{constructor(ct){super(ct,ut.FrameworkErrorEnum.COMMON)}}ut.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends dt.MidwayError{constructor(ct){super(ct!==null&&ct!==void 0?ct:"Parameter type not match",ut.FrameworkErrorEnum.PARAM_TYPE)}}ut.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends dt.MidwayError{static isClosePrototypeOf(ct){return ct?ct[MidwayDefinitionNotFoundError.type]===MidwayDefinitionNotFoundError.type:false}constructor(ct){super(`${ct} is not valid in current context`,ut.FrameworkErrorEnum.DEFINITION_NOT_FOUND);this[MidwayDefinitionNotFoundError.type]=MidwayDefinitionNotFoundError.type}updateErrorMsg(ct){const ut=this.message.split(" is not valid in current context")[0];this.message=`${ut} in class ${ct} is not valid in current context`}}ut.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;MidwayDefinitionNotFoundError.type=Symbol.for("#NotFoundError");class MidwayFeatureNoLongerSupportedError extends dt.MidwayError{constructor(ct){super("This feature no longer supported \n"+ct,ut.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}ut.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends dt.MidwayError{constructor(ct){super("This feature not implemented \n"+ct,ut.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}ut.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends dt.MidwayError{constructor(ct){super(`Can't found config key "${ct}" in your config, please set it first`,ut.FrameworkErrorEnum.MISSING_CONFIG)}}ut.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends dt.MidwayError{constructor(ct){super("Invalid config file \n"+ct,ut.FrameworkErrorEnum.INVALID_CONFIG)}}ut.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayResolverMissingError extends dt.MidwayError{constructor(ct){super(`Resolver "${ct}" is missing.`,ut.FrameworkErrorEnum.MISSING_RESOLVER)}}ut.MidwayResolverMissingError=MidwayResolverMissingError;class MidwayDuplicateRouteError extends dt.MidwayError{constructor(ct,pt,dt){super(`Duplicate router "${ct}" at "${pt}" and "${dt}"`,ut.FrameworkErrorEnum.DUPLICATE_ROUTER)}}ut.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends dt.MidwayError{constructor(ct,pt,dt){const ft=dt?`${dt} not valid by ${ct}, Use ${pt} instead!`:`You should not invoked by ${ct}, Use ${pt} instead!`;super(ft,ut.FrameworkErrorEnum.USE_WRONG_METHOD)}}ut.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends dt.MidwayError{constructor(ct,pt){const dt=`${ct} with singleton scope can't implicitly inject ${pt} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${pt} or use "ctx.requestContext.getAsync(${pt})".`;super(dt,ut.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}ut.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends dt.MidwayError{constructor(ct){const pt=`"${ct}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(pt,ut.FrameworkErrorEnum.MISSING_IMPORTS)}}ut.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends dt.MidwayError{constructor(ct){super(ct,ut.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}ut.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends dt.MidwayError{constructor(){const ct='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(ct,ut.FrameworkErrorEnum.INCONSISTENT_VERSION)}}ut.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends dt.MidwayError{constructor(ct,pt,dt){super(`"${ct}" duplicated between "${pt}" and "${dt}"`,ut.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}ut.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends dt.MidwayError{constructor(ct,pt,dt){super(`"Prefix ${ct}" with duplicated controller options between "${pt}" and "${dt}"`,ut.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}ut.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends dt.MidwayError{constructor(ct,pt,dt){super(`Invoke "${ct}" retries exceeded the maximum number of times(${pt}), error: ${dt.message}`,ut.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:dt})}}ut.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends dt.MidwayError{constructor(ct,pt){super(`Invoke "${pt?pt.name:"unknown"}.${ct}" is forbidden.`,ut.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}ut.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends dt.MidwayError{constructor(ct,pt){super(`Invoke "${ct}" running timeout(${pt}ms)`,ut.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}ut.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends dt.MidwayError{constructor(){super("Main framework missing, please check your configuration.",ut.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}ut.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends dt.MidwayError{constructor(ct,pt){super(`Invalid config property "${ct}", ${pt?`only ${pt.join(",")} can be set`:"please check your configuration"}.`,ut.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}ut.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends dt.MidwayError{constructor(ct){super(ct!==null&&ct!==void 0?ct:"There is an empty value got and it is not allowed.",ut.FrameworkErrorEnum.EMPTY_VALUE)}}ut.MidwayEmptyValueError=MidwayEmptyValueError},9504:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.httpError=ut.GatewayTimeoutError=ut.ServiceUnavailableError=ut.BadGatewayError=ut.NotImplementedError=ut.InternalServerErrorError=ut.TooManyRequestsError=ut.UnprocessableEntityError=ut.UnsupportedMediaTypeError=ut.PayloadTooLargeError=ut.GoneError=ut.ConflictError=ut.RequestTimeoutError=ut.NotAcceptableError=ut.ForbiddenError=ut.NotFoundError=ut.UnauthorizedError=ut.BadRequestError=ut.HttpStatus=void 0;const dt=pt(21769);var ft;(function(ct){ct[ct["CONTINUE"]=100]="CONTINUE";ct[ct["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";ct[ct["PROCESSING"]=102]="PROCESSING";ct[ct["EARLYHINTS"]=103]="EARLYHINTS";ct[ct["OK"]=200]="OK";ct[ct["CREATED"]=201]="CREATED";ct[ct["ACCEPTED"]=202]="ACCEPTED";ct[ct["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";ct[ct["NO_CONTENT"]=204]="NO_CONTENT";ct[ct["RESET_CONTENT"]=205]="RESET_CONTENT";ct[ct["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";ct[ct["AMBIGUOUS"]=300]="AMBIGUOUS";ct[ct["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";ct[ct["FOUND"]=302]="FOUND";ct[ct["SEE_OTHER"]=303]="SEE_OTHER";ct[ct["NOT_MODIFIED"]=304]="NOT_MODIFIED";ct[ct["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";ct[ct["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";ct[ct["BAD_REQUEST"]=400]="BAD_REQUEST";ct[ct["UNAUTHORIZED"]=401]="UNAUTHORIZED";ct[ct["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";ct[ct["FORBIDDEN"]=403]="FORBIDDEN";ct[ct["NOT_FOUND"]=404]="NOT_FOUND";ct[ct["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";ct[ct["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";ct[ct["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";ct[ct["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";ct[ct["CONFLICT"]=409]="CONFLICT";ct[ct["GONE"]=410]="GONE";ct[ct["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";ct[ct["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";ct[ct["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";ct[ct["URI_TOO_LONG"]=414]="URI_TOO_LONG";ct[ct["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";ct[ct["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";ct[ct["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";ct[ct["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";ct[ct["MISDIRECTED"]=421]="MISDIRECTED";ct[ct["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";ct[ct["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";ct[ct["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";ct[ct["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";ct[ct["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";ct[ct["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";ct[ct["BAD_GATEWAY"]=502]="BAD_GATEWAY";ct[ct["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";ct[ct["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";ct[ct["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(ft=ut.HttpStatus||(ut.HttpStatus={}));class BadRequestError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.BAD_REQUEST)}}ut.BadRequestError=BadRequestError;class UnauthorizedError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.UNAUTHORIZED)}}ut.UnauthorizedError=UnauthorizedError;class NotFoundError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.NOT_FOUND)}}ut.NotFoundError=NotFoundError;class ForbiddenError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.FORBIDDEN)}}ut.ForbiddenError=ForbiddenError;class NotAcceptableError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.NOT_ACCEPTABLE)}}ut.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.REQUEST_TIMEOUT)}}ut.RequestTimeoutError=RequestTimeoutError;class ConflictError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.CONFLICT)}}ut.ConflictError=ConflictError;class GoneError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.GONE)}}ut.GoneError=GoneError;class PayloadTooLargeError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.PAYLOAD_TOO_LARGE)}}ut.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.UNSUPPORTED_MEDIA_TYPE)}}ut.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.UNPROCESSABLE_ENTITY)}}ut.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.TOO_MANY_REQUESTS)}}ut.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.INTERNAL_SERVER_ERROR)}}ut.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.NOT_IMPLEMENTED)}}ut.NotImplementedError=NotImplementedError;class BadGatewayError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.BAD_GATEWAY)}}ut.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.SERVICE_UNAVAILABLE)}}ut.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.GATEWAY_TIMEOUT)}}ut.GatewayTimeoutError=GatewayTimeoutError;ut.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(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.httpError=ut.HttpStatus=void 0;ft(pt(21769),ut);var _t=pt(9504);Object.defineProperty(ut,"HttpStatus",{enumerable:true,get:function(){return _t.HttpStatus}});Object.defineProperty(ut,"httpError",{enumerable:true,get:function(){return _t.httpError}});ft(pt(37198),ut)},24451:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createConfiguration=ut.FunctionalConfiguration=void 0;class FunctionalConfiguration{constructor(ct){this.options=ct;this.readyHandler=()=>{};this.stopHandler=()=>{};this.configLoadHandler=()=>{};this.serverReadyHandler=()=>{}}onConfigLoad(ct,ut){if(typeof ct==="function"){this.configLoadHandler=ct}else{return this.configLoadHandler(ct,ut)}return this}onReady(ct,ut){if(typeof ct==="function"){this.readyHandler=ct}else{return this.readyHandler(ct,ut)}return this}onServerReady(ct,ut){if(typeof ct==="function"){this.serverReadyHandler=ct}else{return this.serverReadyHandler(ct,ut)}return this}onStop(ct,ut){if(typeof ct==="function"){this.stopHandler=ct}else{return this.stopHandler(ct,ut)}return this}getConfigurationOptions(){return this.options}}ut.FunctionalConfiguration=FunctionalConfiguration;const createConfiguration=ct=>new FunctionalConfiguration(ct);ut.createConfiguration=createConfiguration},46123:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayPerformanceManager=ut.TypedResourceManager=ut.HttpServerResponse=ut.ServerResponse=ut.FORMAT=ut.FileUtils=ut.PathFileUtil=ut.Types=ut.retryWith=ut.retryWithAsync=ut.extend=ut.Utils=ut.sleep=ut.isTypeScriptEnvironment=ut.wrapAsync=ut.wrapMiddleware=ut.pathMatching=ut.transformRequestObjectByType=ut.deprecatedOutput=ut.delegateTargetAllPrototypeMethod=ut.delegateTargetProperties=ut.delegateTargetMethod=ut.delegateTargetPrototypeMethod=ut.loadModule=ut.safeRequire=ut.safelyGet=ut.ASYNC_ROOT_CONTEXT=ut.MidwayPriorityManager=ut.DEFAULT_PRIORITY=ut.DataSourceManager=ut.WebRouterCollector=ut.MidwayServerlessFunctionService=ut.MidwayWebRouterService=ut.MidwayHealthService=ut.MidwayMockService=ut.MidwayDecoratorService=ut.MidwayMiddlewareService=ut.MidwayLifeCycleService=ut.MidwayAspectService=ut.MidwayFrameworkService=ut.MidwayLoggerService=ut.MidwayInformationService=ut.MidwayEnvironmentService=ut.MidwayConfigService=ut.FunctionalConfiguration=ut.createConfiguration=ut.BaseFramework=ut.MidwayRequestContainer=void 0;ft(pt(6192),ut);ft(pt(9288),ut);var _t=pt(97983);Object.defineProperty(ut,"MidwayRequestContainer",{enumerable:true,get:function(){return _t.MidwayRequestContainer}});var mt=pt(83872);Object.defineProperty(ut,"BaseFramework",{enumerable:true,get:function(){return mt.BaseFramework}});ft(pt(28695),ut);ft(pt(2222),ut);var ht=pt(24451);Object.defineProperty(ut,"createConfiguration",{enumerable:true,get:function(){return ht.createConfiguration}});Object.defineProperty(ut,"FunctionalConfiguration",{enumerable:true,get:function(){return ht.FunctionalConfiguration}});var yt=pt(78842);Object.defineProperty(ut,"MidwayConfigService",{enumerable:true,get:function(){return yt.MidwayConfigService}});var vt=pt(70275);Object.defineProperty(ut,"MidwayEnvironmentService",{enumerable:true,get:function(){return vt.MidwayEnvironmentService}});var St=pt(37482);Object.defineProperty(ut,"MidwayInformationService",{enumerable:true,get:function(){return St.MidwayInformationService}});var bt=pt(34888);Object.defineProperty(ut,"MidwayLoggerService",{enumerable:true,get:function(){return bt.MidwayLoggerService}});var xt=pt(33332);Object.defineProperty(ut,"MidwayFrameworkService",{enumerable:true,get:function(){return xt.MidwayFrameworkService}});var $t=pt(70812);Object.defineProperty(ut,"MidwayAspectService",{enumerable:true,get:function(){return $t.MidwayAspectService}});var Et=pt(13328);Object.defineProperty(ut,"MidwayLifeCycleService",{enumerable:true,get:function(){return Et.MidwayLifeCycleService}});var Ct=pt(68220);Object.defineProperty(ut,"MidwayMiddlewareService",{enumerable:true,get:function(){return Ct.MidwayMiddlewareService}});var Tt=pt(96367);Object.defineProperty(ut,"MidwayDecoratorService",{enumerable:true,get:function(){return Tt.MidwayDecoratorService}});var wt=pt(77306);Object.defineProperty(ut,"MidwayMockService",{enumerable:true,get:function(){return wt.MidwayMockService}});var At=pt(658);Object.defineProperty(ut,"MidwayHealthService",{enumerable:true,get:function(){return At.MidwayHealthService}});var kt=pt(19985);Object.defineProperty(ut,"MidwayWebRouterService",{enumerable:true,get:function(){return kt.MidwayWebRouterService}});var It=pt(42592);Object.defineProperty(ut,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return It.MidwayServerlessFunctionService}});Object.defineProperty(ut,"WebRouterCollector",{enumerable:true,get:function(){return It.WebRouterCollector}});var Nt=pt(12849);Object.defineProperty(ut,"DataSourceManager",{enumerable:true,get:function(){return Nt.DataSourceManager}});var Pt=pt(67934);Object.defineProperty(ut,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return Pt.DEFAULT_PRIORITY}});Object.defineProperty(ut,"MidwayPriorityManager",{enumerable:true,get:function(){return Pt.MidwayPriorityManager}});ft(pt(28602),ut);ft(pt(82535),ut);ft(pt(64842),ut);ft(pt(46673),ut);ft(pt(1845),ut);ft(pt(11026),ut);ft(pt(12738),ut);ft(pt(39408),ut);ft(pt(43436),ut);ft(pt(29222),ut);ft(pt(86314),ut);var Ot=pt(75351);Object.defineProperty(ut,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return Ot.ASYNC_ROOT_CONTEXT}});ft(pt(49757),ut);ft(pt(45317),ut);ft(pt(75105),ut);var Dt=pt(65308);Object.defineProperty(ut,"safelyGet",{enumerable:true,get:function(){return Dt.safelyGet}});Object.defineProperty(ut,"safeRequire",{enumerable:true,get:function(){return Dt.safeRequire}});Object.defineProperty(ut,"loadModule",{enumerable:true,get:function(){return Dt.loadModule}});Object.defineProperty(ut,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return Dt.delegateTargetPrototypeMethod}});Object.defineProperty(ut,"delegateTargetMethod",{enumerable:true,get:function(){return Dt.delegateTargetMethod}});Object.defineProperty(ut,"delegateTargetProperties",{enumerable:true,get:function(){return Dt.delegateTargetProperties}});Object.defineProperty(ut,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return Dt.delegateTargetAllPrototypeMethod}});Object.defineProperty(ut,"deprecatedOutput",{enumerable:true,get:function(){return Dt.deprecatedOutput}});Object.defineProperty(ut,"transformRequestObjectByType",{enumerable:true,get:function(){return Dt.transformRequestObjectByType}});Object.defineProperty(ut,"pathMatching",{enumerable:true,get:function(){return Dt.pathMatching}});Object.defineProperty(ut,"wrapMiddleware",{enumerable:true,get:function(){return Dt.wrapMiddleware}});Object.defineProperty(ut,"wrapAsync",{enumerable:true,get:function(){return Dt.wrapAsync}});Object.defineProperty(ut,"isTypeScriptEnvironment",{enumerable:true,get:function(){return Dt.isTypeScriptEnvironment}});Object.defineProperty(ut,"sleep",{enumerable:true,get:function(){return Dt.sleep}});Object.defineProperty(ut,"Utils",{enumerable:true,get:function(){return Dt.Utils}});var Ft=pt(83486);Object.defineProperty(ut,"extend",{enumerable:true,get:function(){return Ft.extend}});ft(pt(46422),ut);ft(pt(50539),ut);ft(pt(73861),ut);ft(pt(87653),ut);var Mt=pt(25198);Object.defineProperty(ut,"retryWithAsync",{enumerable:true,get:function(){return Mt.retryWithAsync}});Object.defineProperty(ut,"retryWith",{enumerable:true,get:function(){return Mt.retryWith}});var Rt=pt(63289);Object.defineProperty(ut,"Types",{enumerable:true,get:function(){return Rt.Types}});var Lt=pt(61327);Object.defineProperty(ut,"PathFileUtil",{enumerable:true,get:function(){return Lt.PathFileUtil}});var Bt=pt(7589);Object.defineProperty(ut,"FileUtils",{enumerable:true,get:function(){return Bt.FileUtils}});var Vt=pt(30001);Object.defineProperty(ut,"FORMAT",{enumerable:true,get:function(){return Vt.FORMAT}});var jt=pt(89995);Object.defineProperty(ut,"ServerResponse",{enumerable:true,get:function(){return jt.ServerResponse}});Object.defineProperty(ut,"HttpServerResponse",{enumerable:true,get:function(){return jt.HttpServerResponse}});var Ut=pt(11330);Object.defineProperty(ut,"TypedResourceManager",{enumerable:true,get:function(){return Ut.TypedResourceManager}});var Jt=pt(70032);Object.defineProperty(ut,"MidwayPerformanceManager",{enumerable:true,get:function(){return Jt.MidwayPerformanceManager}})},6192:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayProcessTypeEnum=ut.ObjectLifeCycleEvent=ut.ServerlessTriggerType=ut.MidwayFrameworkType=ut.FrameworkType=ut.MSListenerType=ut.MSProviderType=ut.InjectModeEnum=ut.ScopeEnum=void 0;var pt;(function(ct){ct["Singleton"]="Singleton";ct["Request"]="Request";ct["Prototype"]="Prototype"})(pt=ut.ScopeEnum||(ut.ScopeEnum={}));var dt;(function(ct){ct["Identifier"]="Identifier";ct["Class"]="Class";ct["PropertyName"]="PropertyName"})(dt=ut.InjectModeEnum||(ut.InjectModeEnum={}));var ft;(function(ct){ct["DUBBO"]="dubbo";ct["GRPC"]="gRPC"})(ft=ut.MSProviderType||(ut.MSProviderType={}));var _t;(function(ct){ct["RABBITMQ"]="rabbitmq";ct["MQTT"]="mqtt";ct["KAFKA"]="kafka";ct["REDIS"]="redis"})(_t=ut.MSListenerType||(ut.MSListenerType={}));class FrameworkType{}ut.FrameworkType=FrameworkType;class MidwayFrameworkType extends FrameworkType{constructor(ct){super();this.name=ct}}ut.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 mt;(function(ct){ct["EVENT"]="event";ct["HTTP"]="http";ct["API_GATEWAY"]="apigw";ct["OS"]="os";ct["CDN"]="cdn";ct["LOG"]="log";ct["TIMER"]="timer";ct["MQ"]="mq";ct["KAFKA"]="kafka";ct["HSF"]="hsf";ct["MTOP"]="mtop";ct["SSR"]="ssr"})(mt=ut.ServerlessTriggerType||(ut.ServerlessTriggerType={}));var ht;(function(ct){ct["BEFORE_BIND"]="beforeBind";ct["BEFORE_CREATED"]="beforeObjectCreated";ct["AFTER_CREATED"]="afterObjectCreated";ct["AFTER_INIT"]="afterObjectInit";ct["BEFORE_DESTROY"]="beforeObjectDestroy"})(ht=ut.ObjectLifeCycleEvent||(ut.ObjectLifeCycleEvent={}));var yt;(function(ct){ct["APPLICATION"]="APPLICATION";ct["AGENT"]="AGENT"})(yt=ut.MidwayProcessTypeEnum||(ut.MidwayProcessTypeEnum={}))},72838:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ServerResponse=void 0;class ServerResponse{constructor(ct){this.isSuccess=true;this.ctx=ct}json(ct){return Object.getPrototypeOf(this).constructor.JSON_TPL(ct,this.isSuccess,this.ctx)}text(ct){return Object.getPrototypeOf(this).constructor.TEXT_TPL(ct,this.isSuccess,this.ctx)}blob(ct){return Object.getPrototypeOf(this).constructor.BLOB_TPL(ct,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}ut.ServerResponse=ServerResponse;ServerResponse.TEXT_TPL=(ct,ut,pt)=>ct;ServerResponse.JSON_TPL=(ct,ut,pt)=>{if(ut){return{success:"true",data:ct}}else{return{success:"false",message:ct||"fail"}}};ServerResponse.BLOB_TPL=(ct,ut,pt)=>ct},91959:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.HttpServerResponse=void 0;const dt=pt(79896);const ft=pt(72838);const _t=pt(82738);const mt=pt(37407);const ht=pt(16928);class HttpServerResponse extends ft.ServerResponse{constructor(ct){super(ct)}status(ct){this.ctx.res.statusCode=ct;return this}header(ct,ut){this.ctx.res.setHeader(ct,ut);return this}headers(ct){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(ct)))}else{for(const ut in ct){this.header(ut,ct[ut])}}return this}json(ct){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(ct,this.isSuccess,this.ctx)}text(ct){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(ct,this.isSuccess,this.ctx)}file(ct,ut){this.header("Content-Type",ut||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,ht.basename)(ct)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof ct==="string"?(0,dt.createReadStream)(ct):ct,this.isSuccess,this.ctx)}blob(ct,ut){this.header("Content-Type",ut||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(ct,this.isSuccess,this.ctx)}html(ct){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(ct,this.isSuccess,this.ctx)}redirect(ct,ut=302){this.status(ut);if(this.ctx.redirect){return this.ctx.redirect(ct)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(ct)}else{this.header("Location",ct)}}sse(ct={}){return new _t.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...ct})}stream(ct={}){return new mt.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...ct})}}ut.HttpServerResponse=HttpServerResponse;HttpServerResponse.FILE_TPL=(ct,ut,pt)=>ct;HttpServerResponse.SSE_TPL=(ct,ut)=>ct;HttpServerResponse.STREAM_TPL=(ct,ut)=>ct;HttpServerResponse.HTML_TPL=(ct,ut,pt)=>ct},89995:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.HttpServerResponse=ut.ServerResponse=void 0;var dt=pt(72838);Object.defineProperty(ut,"ServerResponse",{enumerable:true,get:function(){return dt.ServerResponse}});var ft=pt(91959);Object.defineProperty(ut,"HttpServerResponse",{enumerable:true,get:function(){return ft.HttpServerResponse}})},82738:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ServerSendEventStream=void 0;const dt=pt(2203);class ServerSendEventStream extends dt.Transform{constructor(ct,ut={}){super({objectMode:true,...ut});this.isActive=false;this.ctx=ct;this.closeEvent=ut.closeEvent||"close";this.options=ut;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(ct,ut,pt){try{let ut,dt="data: ";const ft=/^\s*:\s*/;const _t=[];if(!this.isActive){this.isActive=true;const ct={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const ut in ct){this.ctx.res.setHeader(ut,ct[ut])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);_t.push(": ok")}const mt=ct;if(mt.event)_t.push("event: "+mt.event);if(mt.retry)_t.push("retry: "+mt.retry);if(mt.id)_t.push("id: "+mt.id);if(typeof mt.data==="object"){ut=JSON.stringify(mt.data);_t.push(dt+ut)}else if(typeof mt.data==="undefined"){_t.push(dt)}else{mt.data=String(mt.data);if(mt.data.search(ft)!==-1){mt.data=mt.data.replace(ft,"");dt=": "}mt.data=mt.data.replace(/(\r\n|\r|\n)/g,"\n");ut=mt.data.split(/\n/);for(let ct=0,pt=ut.length;ct<pt;++ct){const ft=ut[ct];if(ct+1===pt){_t.push(dt+ft)}else{_t.push(dt+ft)}}}this.push(_t.join("\n")+"\n\n");pt()}catch(ct){this.ctx.logger.error(ct);this.sendError(ct);this.end();pt(ct)}}sendError(ct){this.send({event:"error",data:ct.message||"An error occurred"})}sendEnd(ct){ct.event=this.closeEvent;this.send(ct)}send(ct){super.write(this.options.tpl(ct,this.ctx))}handleClose(){this.end()}}ut.ServerSendEventStream=ServerSendEventStream},37407:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.HttpStreamResponse=void 0;const dt=pt(2203);class HttpStreamResponse extends dt.Transform{constructor(ct,ut={}){super({objectMode:true,...ut});this.isActive=false;this.ctx=ct;this.options=ut}_transform(ct,ut,pt){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 ct==="string"){this.ctx.res.write(ct)}else{this.ctx.res.write(JSON.stringify(ct))}pt()}catch(ct){this.ctx.logger.error(ct);this.end();this.ctx.res.end();pt(ct)}}send(ct){if(!this.writable){return}this.write(this.options.tpl(ct,this.ctx))}sendError(ct){this.ctx.logger.error(ct);this.end();this.ctx.res.end()}_flush(ct){this.ctx.res.end();ct()}}ut.HttpStreamResponse=HttpStreamResponse},70812:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayAspectService=void 0;const _t=pt(65675);const mt=pt(6192);const ht=pt(49757);const yt=pt(63289);let vt=class MidwayAspectService{constructor(ct){this.applicationContext=ct}async loadAspect(){const ct=(0,ht.listModule)(ht.ASPECT_KEY);let ut=[];for(const pt of ct){const ct=(0,ht.getClassMetadata)(ht.ASPECT_KEY,pt);ut=ut.concat(ct.map((ct=>{ct.aspectModule=pt;return ct})))}ut.sort(((ct,ut)=>(ut.priority||0)-(ct.priority||0)));for(const ct of ut){const ut=await this.applicationContext.getAsync(ct.aspectModule);await this.addAspect(ut,ct)}}async addAspect(ct,ut){const pt=ut.aspectTarget;const dt=Object.getOwnPropertyNames(pt.prototype);const ft=ut.match?_t(ut.match):()=>true;for(const ut of dt){if(ut==="constructor"||!ft(ut)){continue}const dt=Object.getOwnPropertyDescriptor(pt.prototype,ut);if(!dt||dt.writable===false){continue}this.interceptPrototypeMethod(pt,ut,ct)}}interceptPrototypeMethod(ct,ut,pt){const dt=ct.prototype[ut];if(yt.Types.isAsyncFunction(ct.prototype[ut])){ct.prototype[ut]=async function(...ct){var ft,_t,mt;let ht,yt;const newProceed=(...ct)=>dt.apply(this,ct);const vt={methodName:ut,target:this,args:ct,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof pt==="function"){pt=pt()}try{await((ft=pt.before)===null||ft===void 0?void 0:ft.call(pt,vt));if(pt.around){yt=await pt.around(vt)}else{yt=await dt.call(this,...vt.args)}vt.proceed=undefined;const ct=await((_t=pt.afterReturn)===null||_t===void 0?void 0:_t.call(pt,vt,yt));yt=typeof ct==="undefined"?yt:ct;return yt}catch(ct){vt.proceed=undefined;ht=ct;if(pt.afterThrow){await pt.afterThrow(vt,ht)}else{throw ct}}finally{await((mt=pt.after)===null||mt===void 0?void 0:mt.call(pt,vt,yt,ht))}}}else{ct.prototype[ut]=function(...ct){var ft,_t,mt;let ht,yt;const newProceed=(...ct)=>dt.apply(this,ct);const vt={methodName:ut,target:this,args:ct,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof pt==="function"){pt=pt()}try{(ft=pt.before)===null||ft===void 0?void 0:ft.call(pt,vt);if(pt.around){yt=pt.around(vt)}else{yt=dt.call(this,...vt.args)}vt.proceed=undefined;const ct=(_t=pt.afterReturn)===null||_t===void 0?void 0:_t.call(pt,vt,yt);yt=typeof ct==="undefined"?yt:ct;return yt}catch(ct){vt.proceed=undefined;ht=ct;if(pt.afterThrow){pt.afterThrow(vt,ht)}else{throw ct}}finally{(mt=pt.after)===null||mt===void 0?void 0:mt.call(pt,vt,yt,ht)}}}}};vt=dt([(0,ht.Provide)(),(0,ht.Scope)(mt.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],vt);ut.MidwayAspectService=vt},78842:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayConfigService=void 0;const _t=pt(16928);const mt=pt(6192);const ht=pt(65308);const yt=pt(79896);const vt=pt(39023);const St=pt(70275);const bt=pt(37482);const xt=pt(83486);const $t=pt(86314);const Et=pt(49757);const Ct=pt(63289);const Tt=vt.debuglog("midway:debug");let wt=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(ct){for(const ut of ct){if(typeof ut==="string"){if(/\.\w+$/.test(ut)){const ct=this.getConfigEnv(ut);const pt=this.getEnvSet(ct);pt.add(ut);if(this.aliasMap[ct]){this.getEnvSet(this.aliasMap[ct]).add(ut)}}else{const ct=(0,yt.statSync)(ut);if(ct.isDirectory()){const ct=(0,yt.readdirSync)(ut);this.add(ct.map((ct=>(0,_t.join)(ut,ct))))}}}else{for(const ct in ut){this.getEnvSet(ct).add(ut[ct]);if(this.aliasMap[ct]){this.getEnvSet(this.aliasMap[ct]).add(ut[ct])}}}}}addObject(ct,ut=false){if(this.isReady){ct=this.runWithFilter(ct);if(!ct){Tt("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:ct});if(ut){this.configuration=(0,xt.extend)(true,ct,this.configuration)}else{(0,xt.extend)(true,this.configuration,ct)}}else{this.externalObject.push(ct)}}getEnvSet(ct){if(!this.envDirMap.has(ct)){this.envDirMap.set(ct,new Set)}return this.envDirMap.get(ct)}getConfigEnv(ct){const ut=(0,_t.basename)(ct);const pt=ut.split(".");const dt=pt.pop();if(dt!=="js"&&dt!=="ts"){return dt}return pt.pop()}load(){if(this.isReady)return;const ct=this.getEnvSet("default");const ut=this.getEnvSet(this.environmentService.getCurrentEnvironment());const pt={};const dt=ct.size;for(const[ft,_t]of[...ct,...ut].entries()){let ct=this.loadConfig(_t);if(Ct.Types.isFunction(ct)){ct=ct.apply(null,[this.appInfo,pt])}if(!ct){continue}ct=this.runWithFilter(ct);if(!ct){Tt("[config]: Filter config and got undefined will be drop it");continue}if(typeof _t==="string"){Tt("[config]: Loaded config %s, %j",_t,ct)}else{Tt("[config]: Loaded config %j",ct)}this.configMergeOrder.push({env:ft<dt?"default":this.environmentService.getCurrentEnvironment(),extraPath:_t,value:ct});(0,xt.extend)(true,pt,ct)}if(this.externalObject.length){for(let ct of this.externalObject){if(ct){ct=this.runWithFilter(ct);if(!ct){Tt("[config]: Filter config and got undefined will be drop it");continue}Tt("[config]: Loaded external object %j",ct);(0,xt.extend)(true,pt,ct);this.configMergeOrder.push({env:"default",extraPath:"",value:ct})}}}this.configuration=pt;this.isReady=true}getConfiguration(ct){if(ct){return(0,ht.safelyGet)(ct,this.configuration)}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(ct){let ut=typeof ct==="string"?require(ct):ct;if(ut&&ut.__esModule){if(ut&&ut.default){if(Object.keys(ut).length>1){throw new $t.MidwayInvalidConfigError(`${ct} should not have both a default export and named export`)}ut=ut.default}}return ut}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(ct){this.configFilterList.push(ct)}runWithFilter(ct){for(const ut of this.configFilterList){Tt(`[config]: Filter config by filter = "${ut.name||"anonymous filter"}"`);ct=ut(ct);Tt("[config]: Filter config result = %j",ct)}return ct}getAppInfo(){return this.appInfo}};dt([(0,Et.Inject)(),ft("design:type",St.MidwayEnvironmentService)],wt.prototype,"environmentService",void 0);dt([(0,Et.Inject)(),ft("design:type",bt.MidwayInformationService)],wt.prototype,"informationService",void 0);dt([(0,Et.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],wt.prototype,"init",null);wt=dt([(0,Et.Provide)(),(0,Et.Scope)(mt.ScopeEnum.Singleton)],wt);ut.MidwayConfigService=wt},96367:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayDecoratorService=void 0;const _t=pt(49757);const mt=pt(6192);const ht=pt(70812);const yt=pt(86314);const vt=pt(39023);const St=pt(63289);const bt=vt.debuglog("midway:debug");let xt=class MidwayDecoratorService{constructor(ct){this.applicationContext=ct;this.propertyHandlerMap=new Map;this.methodDecoratorMap=new Map;this.parameterDecoratorMap=new Map;this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind((ct=>{const ut=(0,_t.getClassMetadata)(_t.INJECT_CUSTOM_METHOD,ct);if(ut){for(const pt of ut){const{propertyName:ut,key:dt,metadata:ft,options:_t}=pt;if(!_t||!_t.impl){continue}this.aspectService.interceptPrototypeMethod(ct,ut,(()=>{const pt=this.methodDecoratorMap.get(dt);if(!pt){throw new yt.MidwayCommonError(`Method Decorator "${dt}" handler not found, please register first.`)}return pt({target:ct,propertyName:ut,metadata:ft})}))}}const pt=(0,_t.getClassMetadata)(_t.INJECT_CUSTOM_PARAM,ct);if(pt){for(const ut of Object.keys(pt)){this.aspectService.interceptPrototypeMethod(ct,ut,(()=>({before:async dt=>{const ft=[...dt.args];for(const mt of pt[ut]){const{propertyName:ut,key:pt,metadata:ht,parameterIndex:vt,options:xt}=mt;let $t;if(xt&&xt.impl){$t=this.parameterDecoratorMap.get(pt);if(!$t){throw new yt.MidwayCommonError(`Parameter Decorator "${pt}" handler not found, please register first.`)}}else{$t=async({parameterIndex:ct,originArgs:ut})=>ut[ct]}const Et=(0,_t.getMethodParamTypes)(ct,ut);let Ct=false;try{ft[vt]=await $t({metadata:ht,propertyName:ut,parameterIndex:vt,target:ct,originArgs:ft,originParamType:Et[vt],instance:dt.target})}catch(ct){Ct=true;if((xt===null||xt===void 0?void 0:xt.throwError)===true){throw ct}else{bt(`[core]: Parameter decorator throw error and use origin args, ${ct.stack}`)}}if(Ct){continue}const Tt=[...this.parameterDecoratorPipes.get(pt)||[],...(xt===null||xt===void 0?void 0:xt.pipes)||[]];for(const ct of Tt){let ut;if("transform"in ct){ut=ct["transform"].bind(ct)}else if((0,St.isClass)(ct)){const pt=await this.applicationContext.getAsync(ct);ut=pt.transform.bind(pt)}else if(typeof ct==="function"){ut=ct}else{throw new yt.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}ft[vt]=await ut(ft[vt],{metaType:(0,_t.transformTypeFromTSDesign)(Et[vt]),metadata:ht,target:dt.target,methodName:dt.methodName})}}dt.args=ft}})))}}}));this.applicationContext.onObjectCreated(((ct,ut)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(ut.definition.handlerProps)){for(const pt of ut.definition.handlerProps){this.defineGetterPropertyValue(pt,ct,this.getHandler(pt.key))}}}));this.registerPropertyHandler(_t.APPLICATION_CONTEXT_KEY,((ct,ut)=>this.applicationContext))}registerPropertyHandler(ct,ut){bt(`[core]: Register property decorator key="${ct}"`);this.propertyHandlerMap.set(ct,ut)}registerMethodHandler(ct,ut){bt(`[core]: Register method decorator key="${ct}"`);this.methodDecoratorMap.set(ct,ut)}registerParameterHandler(ct,ut){bt(`[core]: Register parameter decorator key="${ct}"`);this.parameterDecoratorMap.set(ct,ut)}registerParameterPipes(ct,ut){if(!this.parameterDecoratorPipes.has(ct)){this.parameterDecoratorPipes.set(ct,[])}this.parameterDecoratorPipes.set(ct,this.parameterDecoratorPipes.get(ct).concat(ut))}defineGetterPropertyValue(ct,ut,pt){if(ct&&pt){if(ct.propertyName){Object.defineProperty(ut,ct.propertyName,{get:()=>{var dt;return pt(ct.propertyName,(dt=ct.metadata)!==null&&dt!==void 0?dt:{},ut)},configurable:true,enumerable:true})}}}getHandler(ct){if(this.propertyHandlerMap.has(ct)){return this.propertyHandlerMap.get(ct)}}};dt([(0,_t.Inject)(),ft("design:type",ht.MidwayAspectService)],xt.prototype,"aspectService",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],xt.prototype,"init",null);xt=dt([(0,_t.Provide)(),(0,_t.Scope)(mt.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],xt);ut.MidwayDecoratorService=xt},70275:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayEnvironmentService=void 0;const ft=pt(6192);const _t=pt(65308);const mt=pt(49757);let ht=class MidwayEnvironmentService{constructor(){this.moduleLoadType="commonjs"}getCurrentEnvironment(){if(!this.environment){this.environment=(0,_t.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(ct){this.environment=ct}isDevelopmentEnvironment(){return(0,_t.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(ct){this.moduleLoadType=ct}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};ht=dt([(0,mt.Provide)(),(0,mt.Scope)(ft.ScopeEnum.Singleton)],ht);ut.MidwayEnvironmentService=ht},33332:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayFrameworkService=void 0;const _t=pt(49757);const mt=pt(6192);const ht=pt(78842);const yt=pt(34888);const vt=pt(83872);const St=pt(28602);const bt=pt(96367);const xt=pt(70812);const $t=pt(43436);const Et=pt(39023);const Ct=pt(86314);const Tt=pt(2222);const wt=pt(70032);const At=Et.debuglog("midway:debug");let kt=class MidwayFrameworkService{constructor(ct,ut){this.applicationContext=ct;this.globalOptions=ut;this.globalFrameworkList=[]}async init(){var ct,ut;this.decoratorService.registerPropertyHandler(_t.CONFIG_KEY,((ct,ut)=>{var pt;if(ut.identifier===_t.ALL){return this.configService.getConfiguration()}else{return this.configService.getConfiguration((pt=ut.identifier)!==null&&pt!==void 0?pt:ct)}}));this.decoratorService.registerPropertyHandler(_t.LOGGER_KEY,((ct,ut)=>{var pt;return this.loggerService.getLogger((pt=ut.identifier)!==null&&pt!==void 0?pt:ct)}));this.decoratorService.registerPropertyHandler(_t.PIPELINE_IDENTIFIER,((ct,ut,pt)=>{var dt,ft;return new St.MidwayPipelineService((ft=(dt=pt[Tt.REQUEST_OBJ_CTX_KEY])===null||dt===void 0?void 0:dt.requestContext)!==null&&ft!==void 0?ft:this.applicationContext,ut.valves)}));this.decoratorService.registerPropertyHandler(_t.APPLICATION_KEY,((ct,ut)=>{if(ut.type){const ct=this.applicationManager.getApplication(ut.type);if(!ct){throw new Ct.MidwayCommonError(`Framework ${ut.type} not Found`)}return ct}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(_t.PLUGIN_KEY,((ct,ut)=>{var pt;return this.getMainApp()[(pt=ut.identifier)!==null&&pt!==void 0?pt:ct]}));this.decoratorService.registerPropertyHandler(_t.FACTORY_SERVICE_CLIENT_KEY,((ct,ut)=>{const pt=this.applicationContext.get(ut.serviceFactoryClz);const dt=ut.clientName||pt.getDefaultClientName();if(dt&&pt.has(dt)){return pt.get(dt)}else{if(!dt){throw new Ct.MidwayParameterError(`Please set clientName or options.defaultClientName for ${ut.serviceFactoryClz.name}).`)}else{throw new Ct.MidwayParameterError(`ClientName(${dt} not found in ${ut.serviceFactoryClz.name}).`)}}}));let pt=(0,_t.listModule)(_t.FRAMEWORK_KEY);pt=filterProtoFramework(pt);At(`[core]: Found Framework length = ${pt.length}`);if(pt.length){for(const ut of pt){if(!this.applicationContext.hasDefinition((0,_t.getProviderUUId)(ut))){At(`[core]: Found Framework "${ut.name}" but missing definition, skip initialize.`);continue}const pt=await this.applicationContext.getAsync(ut,[this.applicationContext]);if(pt.isEnable()){wt.MidwayInitializerPerformanceManager.frameworkInitializeStart(pt.getFrameworkName());await pt.initialize({applicationContext:this.applicationContext,namespace:pt.getNamespace(),...this.globalOptions});wt.MidwayInitializerPerformanceManager.frameworkInitializeEnd(pt.getFrameworkName());At(`[core]: Found Framework "${pt.getFrameworkName()}" and initialize.`)}else{At(`[core]: Found Framework "${pt.getFrameworkName()}" and delay initialize.`)}const dt=this.applicationContext.registry.getDefinition((0,_t.getProviderUUId)(ut));pt.setNamespace(dt===null||dt===void 0?void 0:dt.namespace);this.applicationManager.addFramework((ct=dt===null||dt===void 0?void 0:dt.namespace)!==null&&ct!==void 0?ct:pt.getFrameworkName(),pt);this.globalFrameworkList.push(pt)}let dt;const ft=this.applicationContext.getNamespaceList();for(const ct of ft){const ut=this.applicationManager.getApplication(ct);if(ut){dt=ct;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=(ut=this.applicationManager.getFramework(dt))!==null&&ut!==void 0?ut:this.globalFrameworkList[0];At(`[core]: Current main Framework is "${dt}".`)}await this.aspectService.loadAspect()}getMainApp(){var ct;return(ct=this.mainFramework)===null||ct===void 0?void 0:ct.getApplication()}getMainFramework(){return this.mainFramework}getFramework(ct){return this.applicationManager.getFramework(ct)}async runFramework(){const ct=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((ut,pt)=>ct.indexOf(ut.getNamespace())-ct.indexOf(pt.getNamespace())));for(const ct of this.globalFrameworkList){if(ct.isEnable()){wt.MidwayInitializerPerformanceManager.frameworkRunStart(ct.getFrameworkName());await ct.run();At(`[core]: Found Framework "${ct.getFrameworkName()}" and run.`);wt.MidwayInitializerPerformanceManager.frameworkRunEnd(ct.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((ct=>ct.stop())))}};dt([(0,_t.Inject)(),ft("design:type",ht.MidwayConfigService)],kt.prototype,"configService",void 0);dt([(0,_t.Inject)(),ft("design:type",yt.MidwayLoggerService)],kt.prototype,"loggerService",void 0);dt([(0,_t.Inject)(),ft("design:type",xt.MidwayAspectService)],kt.prototype,"aspectService",void 0);dt([(0,_t.Inject)(),ft("design:type",bt.MidwayDecoratorService)],kt.prototype,"decoratorService",void 0);dt([(0,_t.Inject)(),ft("design:type",$t.MidwayApplicationManager)],kt.prototype,"applicationManager",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],kt.prototype,"init",null);kt=dt([(0,_t.Provide)(),(0,_t.Scope)(mt.ScopeEnum.Singleton),ft("design:paramtypes",[Object,Object])],kt);ut.MidwayFrameworkService=kt;function filterProtoFramework(ct){const ut=[];for(const pt of ct){let ct=Object.getPrototypeOf(pt);while(ct.name&&ct.name!==vt.BaseFramework.name){ut.push(ct);ct=Object.getPrototypeOf(ct)}}return ct.filter((ct=>!ut.includes(ct)))}},658:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayHealthService=void 0;const _t=pt(49757);const mt=pt(6192);const ht=pt(78842);const yt=pt(65308);let vt=class MidwayHealthService{constructor(){this.healthCheckTimeout=1e3;this.healthCheckMethods=[]}async init(ct){const ut=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(ut);for(const ut of ct){if(ut.instance&&ut.instance["onHealthCheck"]){this.healthCheckMethods.push({item:ut.instance["onHealthCheck"].bind(ut.instance),meta:{namespace:ut.namespace}})}}}async getStatus(){const ct=await(0,yt.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((ct=>({item:ct.item(this.applicationContext),meta:ct.meta}))),timeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(ct,ut)=>{if(ct["status"]!==undefined){return{namespace:ut.namespace,...ct}}else{return{status:false,namespace:ut.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(ct,ut)=>({status:false,namespace:ut.namespace,reason:ct.message})});const ut=ct.find((ct=>!ct.status));return{status:!ut,namespace:ut===null||ut===void 0?void 0:ut.namespace,reason:ut===null||ut===void 0?void 0:ut.reason,results:ct}}setCheckTimeout(ct){this.healthCheckTimeout=ct}};dt([(0,_t.Inject)(),ft("design:type",ht.MidwayConfigService)],vt.prototype,"configService",void 0);dt([(0,_t.ApplicationContext)(),ft("design:type",Object)],vt.prototype,"applicationContext",void 0);vt=dt([(0,_t.Provide)(),(0,_t.Scope)(mt.ScopeEnum.Singleton)],vt);ut.MidwayHealthService=vt},37482:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayInformationService=void 0;const _t=pt(6192);const mt=pt(65308);const ht=pt(16928);const yt=pt(49757);const vt=pt(79896);let St=class MidwayInformationService{init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,ht.dirname)(this.baseDir)}const ct=(0,ht.join)(this.appDir,"package.json");if((0,vt.existsSync)(ct)){const ut=(0,vt.readFileSync)(ct,{encoding:"utf-8"});this.pkg=JSON.parse(ut)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,mt.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var ct;return((ct=this.pkg)===null||ct===void 0?void 0:ct["name"])||""}getRoot(){const ct=(0,mt.isDevelopmentEnvironment)((0,mt.getCurrentEnvironment)());return ct?this.getAppDir():this.getHome()}};dt([(0,yt.Inject)(),ft("design:type",String)],St.prototype,"appDir",void 0);dt([(0,yt.Inject)(),ft("design:type",String)],St.prototype,"baseDir",void 0);dt([(0,yt.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],St.prototype,"init",null);St=dt([(0,yt.Provide)(),(0,yt.Scope)(_t.ScopeEnum.Singleton)],St);ut.MidwayInformationService=St},13328:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayLifeCycleService=void 0;const _t=pt(6192);const mt=pt(49757);const ht=pt(24451);const yt=pt(33332);const vt=pt(78842);const St=pt(39023);const bt=pt(77306);const xt=pt(658);const $t=pt(70032);const Et=(0,St.debuglog)("midway:debug");let Ct=class MidwayLifeCycleService{constructor(ct){this.applicationContext=ct;this.lifecycleInstanceList=[]}async init(){await this.mockService.initSimulation();const ct=(0,mt.listModule)(mt.CONFIGURATION_KEY);Et(`[core]: Found Configuration length = ${ct.length}`);for(const ut of ct){if(ut.target instanceof ht.FunctionalConfiguration){ut.instance=ut.target}else{Et(`[core]: Lifecycle run ${ut.namespace} init`);ut.instance=await this.applicationContext.getAsync(ut.target)}ut.instance&&this.lifecycleInstanceList.push(ut)}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",(ct=>{if(ct){this.configService.addObject(ct)}}));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 ct=(0,mt.listModule)(mt.CONFIGURATION_KEY)||[];for(const ut of ct.reverse()){let ct;if(ut.target instanceof ht.FunctionalConfiguration){ct=ut.target}else{ct=await this.applicationContext.getAsync(ut.target)}await this.runContainerLifeCycle(ct,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(ct,ut,pt){if(Array.isArray(ct)){for(const dt of ct){if(typeof dt.instance[ut]==="function"){Et(`[core]: Lifecycle run ${dt.instance.constructor.name} ${ut}`);$t.MidwayInitializerPerformanceManager.lifecycleStart(dt.namespace,ut);const ct=await dt.instance[ut](this.applicationContext,this.frameworkService.getMainApp());if(pt){pt(ct)}$t.MidwayInitializerPerformanceManager.lifecycleEnd(dt.namespace,ut)}}}else{if(typeof ct[ut]==="function"){const dt=ct.constructor.name;Et(`[core]: Lifecycle run ${dt} ${ut}`);$t.MidwayInitializerPerformanceManager.lifecycleStart(dt,ut);const ft=await ct[ut](this.applicationContext,this.frameworkService.getMainApp());if(pt){pt(ft)}$t.MidwayInitializerPerformanceManager.lifecycleEnd(dt,ut)}}}async runObjectLifeCycle(ct,ut){for(const pt of ct){if(typeof pt.instance[ut]==="function"){Et(`[core]: Lifecycle run ${pt.instance.constructor.name} ${ut}`);return await this.applicationContext[ut](pt.instance[ut].bind(pt.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};dt([(0,mt.Inject)(),ft("design:type",yt.MidwayFrameworkService)],Ct.prototype,"frameworkService",void 0);dt([(0,mt.Inject)(),ft("design:type",vt.MidwayConfigService)],Ct.prototype,"configService",void 0);dt([(0,mt.Inject)(),ft("design:type",bt.MidwayMockService)],Ct.prototype,"mockService",void 0);dt([(0,mt.Inject)(),ft("design:type",xt.MidwayHealthService)],Ct.prototype,"healthService",void 0);dt([(0,mt.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],Ct.prototype,"init",null);Ct=dt([(0,mt.Provide)(),(0,mt.Scope)(_t.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],Ct);ut.MidwayLifeCycleService=Ct},34888:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayLoggerService=void 0;const _t=pt(49757);const mt=pt(78842);const ht=pt(64842);const yt=pt(6192);const vt=pt(82535);const St=pt(86314);let bt=class MidwayLoggerService extends ht.ServiceFactory{constructor(ct,ut={}){super();this.applicationContext=ct;this.globalOptions=ut;this.lazyLoggerConfigMap=new Map;this.aliasLoggerMap=new Map}init(){var ct;const ut=this.configService.getConfiguration("loggerFactory");this.loggerFactory=ut||this.globalOptions["loggerFactory"]||new vt.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new St.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const pt=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(pt,true);this.initClients(this.configService.getConfiguration("midwayLogger"));(ct=this.applicationContext)===null||ct===void 0?void 0:ct.registerObject("logger",this.getLogger("appLogger"))}createClient(ct,ut){if(ct.aliasName){this.aliasLoggerMap.set(ct.aliasName,ut)}if(!ct.lazyLoad){this.loggerFactory.createLogger(ut,ct)}else{delete ct["lazyLoad"];this.lazyLoggerConfigMap.set(ut,ct)}}getName(){return"logger"}createLogger(ct,ut){delete ut["aliasName"];return this.loggerFactory.createLogger(ct,ut)}getLogger(ct){if(this.aliasLoggerMap.has(ct)){ct=this.aliasLoggerMap.get(ct)}const ut=this.loggerFactory.getLogger(ct);if(ut){return ut}if(this.lazyLoggerConfigMap.has(ct)){this.createClient(this.lazyLoggerConfigMap.get(ct),ct);this.lazyLoggerConfigMap.delete(ct)}return this.loggerFactory.getLogger(ct)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(ct,ut,pt){return this.loggerFactory.createContextLogger(ct,ut,pt)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};dt([(0,_t.Inject)(),ft("design:type",mt.MidwayConfigService)],bt.prototype,"configService",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],bt.prototype,"init",null);bt=dt([(0,_t.Provide)(),(0,_t.Scope)(yt.ScopeEnum.Singleton),ft("design:paramtypes",[Object,Object])],bt);ut.MidwayLoggerService=bt},68220:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayMiddlewareService=void 0;const _t=pt(49757);const mt=pt(6192);const ht=pt(86314);const yt=pt(65308);const vt=pt(63289);const St=pt(39023);const bt=(0,St.debuglog)("midway:debug");let xt=class MidwayMiddlewareService{constructor(ct){this.applicationContext=ct}async compose(ct,ut,pt){var dt;if(!Array.isArray(ct)){throw new ht.MidwayParameterError("Middleware stack must be an array")}const ft=[];for(let pt of ct){if(vt.Types.isClass(pt)||typeof pt==="string"||(pt===null||pt===void 0?void 0:pt["middleware"])){let ct=(dt=pt===null||pt===void 0?void 0:pt["middleware"])!==null&&dt!==void 0?dt:pt;const _t=pt===null||pt===void 0?void 0:pt["options"];let mt=pt===null||pt===void 0?void 0:pt["name"];if(typeof ct==="string"&&!this.applicationContext.hasDefinition(ct)){throw new ht.MidwayCommonError(`Middleware definition of "${ct}" not found in midway container`)}const vt=await this.applicationContext.getAsync(ct);if(vt){mt=mt!==null&&mt!==void 0?mt:vt.constructor.name;ct=await vt.resolve(ut,_t);if(!ct){continue}if(!vt.match&&!vt.ignore){if(!ct.name){ct._name=mt}ft.push(ct)}else{const ut=(0,yt.pathMatching)({match:vt.match,ignore:vt.ignore,thisResolver:vt});pt=(pt,dt,ft)=>{if(!ut(pt))return dt();return ct(pt,dt,ft)};pt._name=mt;ft.push(pt)}}else{throw new ht.MidwayCommonError("Middleware must have resolve method!")}}else{ft.push(pt)}}const composeFn=(ct,ut)=>{const dt=(0,yt.isIncludeProperty)(ct,"body");let _t=-1;return dispatch(0);function dispatch(mt){if(mt<=_t)return Promise.reject(new ht.MidwayCommonError("next() called multiple times"));_t=mt;let yt=ft[mt];if(mt===ft.length)yt=ut;if(!yt)return Promise.resolve();const vt=`${pt?`${pt}.`:""}${_t} ${yt._name||yt.name||"anonymous"}`;const St=Date.now();bt(`[middleware]: in ${vt} +0`);try{if(dt){return Promise.resolve(yt(ct,dispatch.bind(null,mt+1),{index:_t})).then((ut=>{if(ut!==undefined&&ut!==ct["body"]){ct["body"]=ut}else if(ct["body"]!==undefined){ut=ct["body"]}bt(`[middleware]: out ${vt} +${Date.now()-St} with body`);return ut}))}else{return Promise.resolve(yt(ct,dispatch.bind(null,mt+1),{index:_t})).then((ct=>{bt(`[middleware]: out ${vt} +${Date.now()-St}`);return ct}))}}catch(ct){bt(`[middleware]: out ${vt} +${Date.now()-St} with err ${ct.message}`);return Promise.reject(ct)}}};if(pt){composeFn._name=pt}return composeFn}};xt=dt([(0,_t.Provide)(),(0,_t.Scope)(mt.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],xt);ut.MidwayMiddlewareService=xt},77306:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t;Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayMockService=void 0;const mt=pt(6192);const ht=pt(49757);const yt=pt(63289);let vt=_t=class MidwayMockService{constructor(ct){this.applicationContext=ct;this.mocks=new Map;this.contextMocks=new Map;this.cache=new Map;this.simulatorList=[]}async init(){if(_t.prepareMocks.length>0){for(const ct of _t.prepareMocks){this.mockProperty(ct.obj,ct.key,ct.value,ct.group)}_t.prepareMocks=[]}}static mockClassProperty(ct,ut,pt,dt="default"){this.mockProperty(ct.prototype,ut,pt,dt)}static mockProperty(ct,ut,pt,dt="default"){this.prepareMocks.push({obj:ct,key:ut,value:pt,group:dt})}mockClassProperty(ct,ut,pt,dt="default"){return this.mockProperty(ct.prototype,ut,pt,dt)}mockProperty(ct,ut,pt,dt="default"){const ft=ct.hasOwnProperty(ut);const _t={obj:ct,key:ut,descriptor:Object.getOwnPropertyDescriptor(ct,ut),hasOwnProperty:ft};if(!this.mocks.has(dt)){this.mocks.set(dt,[])}this.mocks.get(dt).push(_t);if(ft){delete ct[ut]}let mt=this.cache.get(dt);if(!mt){mt=new Map;this.cache.set(dt,mt)}let ht=mt.get(ct);if(!ht){ht=new Set;mt.set(ct,ht)}ht.add(ut);const yt=this.overridePropertyDescriptor(pt);Object.defineProperty(ct,ut,yt)}mockContext(ct,ut,pt,dt="default"){if(!this.contextMocks.has(dt)){this.contextMocks.set(dt,[])}this.contextMocks.get(dt).push({app:ct,key:ut,value:pt})}restore(ct="default"){this.restoreGroup(ct)}restoreAll(){const ct=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const ut of ct){this.restoreGroup(ut)}this.simulatorList=[]}restoreGroup(ct){const ut=this.mocks.get(ct)||[];for(let ct=ut.length-1;ct>=0;ct--){const pt=ut[ct];if(!pt.hasOwnProperty){delete pt.obj[pt.key]}else{Object.defineProperty(pt.obj,pt.key,pt.descriptor)}}this.mocks.delete(ct);this.contextMocks.delete(ct);this.cache.delete(ct);this.simulatorList=this.simulatorList.filter((ut=>ut["group"]!==ct))}isMocked(ct,ut,pt="default"){if((0,yt.isClass)(ct)){ct=ct.prototype}const dt=this.cache.get(pt);const ft=dt?dt.get(ct):undefined;return ft?ft.has(ut):false}applyContextMocks(ct,ut){for(const[,pt]of this.contextMocks){for(const dt of pt){if(dt.app===ct){const ct=this.overridePropertyDescriptor(dt.value);if(typeof dt.key==="string"){Object.defineProperty(ut,dt.key,ct)}else{dt.key(ut)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((ct,ut)=>ct+ut.length),0)}overridePropertyDescriptor(ct){const ut={configurable:true,enumerable:true};if(ct&&(ct.get||ct.set)){ut.get=ct.get;ut.set=ct.set}else{ut.value=ct;ut.writable=true}return ut}async initSimulation(ct="default"){const ut=(0,ht.listModule)(ht.MOCK_KEY);for(const pt of ut){const ut=await this.applicationContext.getAsync(pt);if(await ut.enableCondition()){ut["group"]=ct;this.simulatorList.push(ut)}}}async runSimulatorSetup(){var ct;for(const ut of this.simulatorList){await((ct=ut.setup)===null||ct===void 0?void 0:ct.call(ut))}}async runSimulatorTearDown(){var ct;for(let ut=this.simulatorList.length-1;ut>=0;ut--){const pt=this.simulatorList[ut];await((ct=pt.tearDown)===null||ct===void 0?void 0:ct.call(pt))}}async runSimulatorAppSetup(ct){var ut;for(const pt of this.simulatorList){await((ut=pt.appSetup)===null||ut===void 0?void 0:ut.call(pt,ct))}}async runSimulatorAppTearDown(ct){var ut;for(let pt=this.simulatorList.length-1;pt>=0;pt--){const dt=this.simulatorList[pt];await((ut=dt.appTearDown)===null||ut===void 0?void 0:ut.call(dt,ct))}}async runSimulatorContextSetup(ct,ut){var pt;for(const dt of this.simulatorList){await((pt=dt.contextSetup)===null||pt===void 0?void 0:pt.call(dt,ct,ut))}}async runSimulatorContextTearDown(ct,ut){var pt;for(let dt=this.simulatorList.length-1;dt>=0;dt--){const ft=this.simulatorList[dt];await((pt=ft===null||ft===void 0?void 0:ft.contextTearDown)===null||pt===void 0?void 0:pt.call(ft,ct,ut))}}};vt.prepareMocks=[];dt([(0,ht.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],vt.prototype,"init",null);dt([(0,ht.Destroy)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],vt.prototype,"restoreAll",null);vt=_t=dt([(0,ht.Provide)(),(0,ht.Scope)(mt.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],vt);ut.MidwayMockService=vt},28602:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayPipelineService=ut.PipelineContext=void 0;const dt=pt(49757);class PipelineContext{constructor(ct){this.info={current:null,currentName:null};this.data=new Map;this.args=ct}get(ct){return this.data.get(ct)}set(ct,ut){this.data.set(ct,ut)}keys(){const ct=[];const ut=this.data.keys();for(const pt of ut){ct.push(pt)}return ct}}ut.PipelineContext=PipelineContext;class MidwayPipelineService{constructor(ct,ut){this.applicationContext=ct;this.valves=ut}async parallel(ct){const ut=this.prepareParallelValves(ct);const pt=await Promise.all(ut);return this.packResult(pt,false)}async concat(ct){const ut=this.prepareParallelValves(ct);const pt=await Promise.all(ut);return this.packResult(pt,true)}async series(ct){const ut=this.mergeValves(ct.valves);const pt=new PipelineContext(ct.args);const dt={success:true,result:null};const ft={};const _t={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let mt=1;for(const ct of ut){_t.prev=_t.current;_t.prevName=getName(_t.prev);_t.current=ct;_t.currentName=getName(_t.current);if(mt<ut.length){_t.next=ut[mt];_t.nextName=getName(_t.next)}else{_t.next=undefined;_t.nextName=undefined}mt+=1;pt.info=_t;try{const ut=await this.applicationContext.getAsync(ct);const dt=await ut.invoke(pt);let mt=ct;if(ut.alias){mt=ut.alias}ft[mt]=dt;_t.prevValue=dt}catch(ut){dt.success=false;dt.error={valveName:typeof ct==="string"?ct:ct.name,message:ut.message,error:ut};return dt}}dt.result=ft;return dt}async concatSeries(ct){const ut=this.mergeValves(ct.valves);const pt=new PipelineContext(ct.args);const dt={success:true,result:null};const ft=[];const _t={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let mt=1;for(const ct of ut){_t.prev=_t.current;_t.prevName=getName(_t.prev);_t.current=ct;_t.currentName=getName(_t.current);if(mt<ut.length){_t.next=ut[mt];_t.nextName=getName(_t.next)}else{_t.next=undefined;_t.nextName=undefined}mt+=1;pt.info=_t;try{const ut=await this.applicationContext.getAsync(ct);const dt=await ut.invoke(pt);ft.push(dt);_t.prevValue=dt}catch(ut){dt.success=false;dt.error={valveName:typeof ct==="string"?ct:ct.name,message:ut.message,error:ut};return dt}}dt.result=ft;return dt}async waterfall(ct){const ut=await this.concatSeries(ct);if(ut.success){const ct=ut.result;ut.result=ct[ct.length-1]}return ut}mergeValves(ct){let ut=[];if(this.valves&&this.valves.length>0){ut=this.valves}let pt=[];if(ct){for(const dt of ct){if(ut.includes(dt)){pt.push(dt)}}}else{pt=ut}return pt}prepareParallelValves(ct){const ut=this.mergeValves(ct.valves);const pt=new PipelineContext(ct.args);return ut.map((async ct=>{const ut={valveName:ct,dataKey:ct,data:null};try{const dt=await this.applicationContext.getAsync(ct);if(dt.alias){ut.dataKey=dt.alias}ut.data=await dt.invoke(pt)}catch(ct){ut.error=ct}return ut}))}packResult(ct,ut=false){const pt={success:true,result:null};let dt;if(ut){dt=[]}else{dt={}}for(const ft of ct){if(ft.error){pt.success=false;pt.error={valveName:typeof ft.valveName==="string"?ft.valveName:ft.valveName.name,message:ft.error.message,error:ft.error};return pt}else{if(ut){dt.push(ft.data)}else{dt[ft.dataKey]=ft.data}}}pt.result=dt;return pt}}ut.MidwayPipelineService=MidwayPipelineService;function getName(ct){if(ct){if(typeof ct==="string"){return ct}else{return(0,dt.getProviderName)(ct)}}return null}},42592:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.WebRouterCollector=ut.MidwayServerlessFunctionService=void 0;const _t=pt(49757);const mt=pt(19985);const ht=pt(9288);const yt=pt(1845);const vt=pt(50539);const St=pt(6192);let bt=class MidwayServerlessFunctionService extends mt.MidwayWebRouterService{constructor(ct={}){super(Object.assign({},ct,{includeFunctionRouter:true}));this.options=ct}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const ct of this.routes.values()){for(const ut of ct){if(ut.requestMethod==="all"){ut.functionTriggerMetadata=ut.functionTriggerMetadata||{};ut.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const ct=(0,_t.listModule)(_t.FUNC_KEY);for(const ut of ct){this.collectFunctionRoute(ut)}}collectFunctionRoute(ct){var ut,pt,dt,ft,mt,ht,yt,vt,St,bt,xt,$t,Et,Ct,Tt,wt,At;const kt=(0,_t.getClassMetadata)(_t.FUNC_KEY,ct);const It=(0,_t.getProviderName)(ct);const Nt=(0,_t.getProviderUUId)(ct);const Pt="/";if(!this.routes.has(Pt)){this.routes.set(Pt,[]);this.routesPriority.push({prefix:Pt,priority:-999,middleware:[],routerOptions:{},controllerId:It,routerModule:ct})}for(const Ot of kt){if((ut=Ot["metadata"])===null||ut===void 0?void 0:ut["path"]){const ut=(0,_t.getPropertyDataFromClass)(_t.WEB_ROUTER_PARAM_KEY,ct,Ot["methodName"])||[];const xt=(0,_t.getPropertyMetadata)(_t.WEB_RESPONSE_KEY,ct,Ot["methodName"])||[];const $t={id:Nt,prefix:Pt,routerName:"",url:Ot["metadata"]["path"],requestMethod:(dt=(pt=Ot["metadata"])===null||pt===void 0?void 0:pt["method"])!==null&&dt!==void 0?dt:"get",method:Ot["methodName"],description:"",summary:"",handlerName:`${It}.${Ot["methodName"]}`,funcHandlerName:`${It}.${Ot["methodName"]}`,controllerId:It,middleware:((ft=Ot["metadata"])===null||ft===void 0?void 0:ft["middleware"])||[],controllerMiddleware:[],requestMetadata:ut,responseMetadata:xt};const Et=(0,_t.getPropertyMetadata)(_t.SERVERLESS_FUNC_KEY,ct,Ot["methodName"])||{};const Ct=(yt=(mt=Et["functionName"])!==null&&mt!==void 0?mt:(ht=Ot===null||Ot===void 0?void 0:Ot["metadata"])===null||ht===void 0?void 0:ht["functionName"])!==null&&yt!==void 0?yt:createFunctionName(ct,Ot["methodName"]);const Tt=(bt=(vt=Et["handlerName"])!==null&&vt!==void 0?vt:(St=Ot===null||Ot===void 0?void 0:Ot["metadata"])===null||St===void 0?void 0:St["handlerName"])!==null&&bt!==void 0?bt:$t.funcHandlerName;$t.functionName=Ct;$t.funcHandlerName=Tt;$t.functionTriggerName=Ot["type"];$t.functionTriggerMetadata=Ot["metadata"];$t.functionMetadata={functionName:Ct,...Et};this.checkDuplicateAndPush(Pt,$t)}else{const ut=(0,_t.getPropertyMetadata)(_t.SERVERLESS_FUNC_KEY,ct,Ot["methodName"])||{};const pt=(Et=(xt=ut["functionName"])!==null&&xt!==void 0?xt:($t=Ot===null||Ot===void 0?void 0:Ot["metadata"])===null||$t===void 0?void 0:$t["functionName"])!==null&&Et!==void 0?Et:createFunctionName(ct,Ot["methodName"]);const dt=(wt=(Ct=ut["handlerName"])!==null&&Ct!==void 0?Ct:(Tt=Ot===null||Ot===void 0?void 0:Ot["metadata"])===null||Tt===void 0?void 0:Tt["handlerName"])!==null&&wt!==void 0?wt:`${It}.${Ot["methodName"]}`;this.checkDuplicateAndPush(Pt,{id:Nt,prefix:Pt,routerName:"",url:"",requestMethod:"",method:Ot["methodName"],description:"",summary:"",handlerName:`${It}.${Ot["methodName"]}`,funcHandlerName:dt,controllerId:It,middleware:((At=Ot["metadata"])===null||At===void 0?void 0:At["middleware"])||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:pt,functionTriggerName:Ot["type"],functionTriggerMetadata:Ot["metadata"],functionMetadata:{functionName:pt,...ut}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(ct,ut,pt={}){var dt,ft;const _t="";if(!this.routes.has(_t)){this.routes.set(_t,[]);this.routesPriority.push({prefix:_t,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const mt=(dt=ut.functionName)!==null&&dt!==void 0?dt:pt.functionName;this.checkDuplicateAndPush(_t,{id:null,method:ct,url:ut.metadata["path"]||"",requestMethod:ut.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:ut.handlerName||pt.handlerName,controllerId:"",middleware:((ft=ut.metadata)===null||ft===void 0?void 0:ft.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:mt,functionTriggerName:ut.metadata.name,functionTriggerMetadata:ut.metadata,functionMetadata:{functionName:mt,...pt}})}};bt=dt([(0,_t.Provide)(),(0,_t.Scope)(St.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],bt);ut.MidwayServerlessFunctionService=bt;function createFunctionName(ct,ut){return(0,_t.getProviderName)(ct).replace(/[:#]/g,"-")+"-"+ut}class WebRouterCollector{constructor(ct="",ut={}){this.baseDir=ct;this.options=ut}async init(){if(!this.proxy){if(this.baseDir){const ct=new ht.MidwayContainer;(0,_t.bindContainer)(ct);ct.setFileDetector(new yt.CommonJSFileDetector({loadDir:this.baseDir}));await ct.ready()}if(this.options.includeFunctionRouter){if((0,vt.getCurrentMainFramework)()){this.proxy=await(0,vt.getCurrentMainFramework)().getApplicationContext().getAsync(bt,[this.options])}else{this.proxy=new bt(this.options)}}else{if((0,vt.getCurrentMainFramework)()){this.proxy=await(0,vt.getCurrentMainFramework)().getApplicationContext().getAsync(mt.MidwayWebRouterService,[this.options])}else{this.proxy=new mt.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()}}ut.WebRouterCollector=WebRouterCollector},19985:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayWebRouterService=void 0;const _t=pt(49757);const mt=pt(65308);const ht=pt(86314);const yt=pt(39023);const vt=pt(73861);const St=pt(63289);const bt=pt(6192);const xt=yt.debuglog("midway:debug");let $t=class MidwayWebRouterService{constructor(ct={}){this.options=ct;this.isReady=false;this.routes=new Map;this.routesPriority=[]}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const ct=(0,_t.listModule)(_t.CONTROLLER_KEY);for(const ut of ct){const ct=(0,_t.getClassMetadata)(_t.CONTROLLER_KEY,ut);this.addController(ut,ct,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((ct=>{const ut=this.routes.get(ct.prefix);if(ut.length>0){return true}else{this.routes.delete(ct.prefix);return false}}));for(const ct of this.routes.keys()){const ut=this.routes.get(ct);this.routes.set(ct,this.sortRouter(ut))}this.routesPriority=this.routesPriority.sort(((ct,ut)=>ut.prefix.length-ct.prefix.length))}addController(ct,ut,pt={},dt=false){var ft;if(pt&&typeof pt==="boolean"){dt=pt;pt=undefined}if(!pt){pt={}}const yt=(0,_t.getProviderName)(ct);xt(`[core]: Found Controller ${yt}.`);const vt=(0,_t.getProviderUUId)(ct);ut.routerOptions=ut.routerOptions||{};let St;const $t=ut.routerOptions.middleware;const Et=!!((ft=ut.routerOptions)===null||ft===void 0?void 0:ft.ignoreGlobalPrefix);let Ct=(0,mt.joinURLPath)(this.options.globalPrefix,ut.prefix||"/");const Tt=ut.prefix||"/";if(Et){Ct=Tt}if(/\*/.test(Ct)){throw new ht.MidwayCommonError(`Router prefix ${Ct} can't set string with *`)}if(!this.routes.has(Ct)){this.routes.set(Ct,[]);this.routesPriority.push({prefix:Ct,priority:Ct==="/"&&St===undefined?-999:0,middleware:$t,routerOptions:ut.routerOptions,controllerId:yt,routerModule:ct})}else{if($t&&$t.length>0){const ct=this.routesPriority.filter((ct=>ct.prefix===Ct))[0];throw new ht.MidwayDuplicateControllerOptionsError(Ct,yt,ct.controllerId)}}if(!this.routes.has(Tt)){this.routes.set(Tt,[]);this.routesPriority.push({prefix:Tt,priority:Tt==="/"&&St===undefined?-999:0,middleware:$t,routerOptions:ut.routerOptions,controllerId:yt,routerModule:ct})}const wt=(0,_t.getClassMetadata)(_t.WEB_ROUTER_KEY,ct);if(wt&&typeof wt[Symbol.iterator]==="function"){for(const ut of wt){const ft=(0,_t.getPropertyDataFromClass)(_t.WEB_ROUTER_PARAM_KEY,ct,ut.method)||[];const ht=(0,_t.getPropertyMetadata)(_t.WEB_RESPONSE_KEY,ct,ut.method)||[];const St={id:vt,prefix:ut.ignoreGlobalPrefix?Tt:Ct,routerName:ut.routerName||"",url:ut.path,requestMethod:ut.requestMethod,method:ut.method,description:ut.description||"",summary:ut.summary||"",handlerName:`${yt}.${ut.method}`,funcHandlerName:`${yt}.${ut.method}`,controllerId:yt,controllerClz:ct,middleware:ut.middleware||[],controllerMiddleware:$t||[],requestMetadata:ft,responseMetadata:ht};if(dt){St.functionName=yt+"-"+ut.method;St.functionTriggerName=bt.ServerlessTriggerType.HTTP;St.functionTriggerMetadata={path:(0,mt.joinURLPath)(Ct,ut.path.toString()),method:ut.requestMethod};St.functionMetadata={functionName:St.functionName}}if(pt.resourceFilter&&!pt.resourceFilter(St)){continue}this.checkDuplicateAndPush(St.prefix,St)}}}addRouter(ct,ut){const pt=ut.prefix||"";ut.requestMethod=(ut.requestMethod||"GET").toUpperCase();if(!this.routes.has(pt)){this.routes.set(pt,[]);this.routesPriority.push({prefix:pt,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(pt,Object.assign(ut,{method:ct}));this.sortPrefixAndRouter()}sortRouter(ct){return ct.map((ct=>{const ut=ct.url.toString();const pt=St.Types.isRegExp(ct.url)?ut.split("\\/"):ut.split("/");let dt=0;for(const ct of pt){if(ct===""||ct.includes(":")||ct.includes("*")){dt+=0}else{dt+=1}}let ft=2;const _t=ut.includes(":")?ut.replace(/:.+$/,""):"";if(_t){ft=1}if(ut.includes("*")){ft=0}return{...ct,_pureRouter:ut.replace(/\**$/,"").replace(/:\w+/,"123"),_level:ut.split("/").length-1,_paramString:_t,_category:ft,_weight:dt}})).sort(((ct,ut)=>{if(ct._category!==ut._category){return ut._category-ct._category}if(ct._weight!==ut._weight){return ut._weight-ct._weight}if(ct._level===ut._level){if(ut._pureRouter===ct._pureRouter){return ct.url.toString().length-ut.url.toString().length}return ut._pureRouter.length-ct._pureRouter.length}return ut._level-ct._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(ct={}){if(!this.isReady){await this.analyze();this.isReady=true}let ut=[];for(const ct of this.routesPriority){ut=ut.concat(this.routes.get(ct.prefix))}if(ct.compileUrlPattern){for(const ct of ut){if(ct.fullUrlFlattenString){ct.fullUrlCompiledRegexp=vt.PathToRegexpUtil.toRegexp(ct.fullUrlFlattenString)}}}return ut}async getMatchedRouterInfo(ct,ut){const pt=await this.getFlattenRouterTable({compileUrlPattern:true});let dt;for(const ft of pt){if(ft.fullUrlCompiledRegexp){const pt=ft["requestMethod"].toUpperCase();if(("ALL"===pt||ut.toUpperCase()===pt)&&ft.fullUrlCompiledRegexp.test(ct)){dt=ft;break}}}return dt}checkDuplicateAndPush(ct,ut){const pt=this.routes.get(ct);const dt=pt.filter((ct=>ut.url&&ut.requestMethod&&ct.url===ut.url&&ct.requestMethod===ut.requestMethod));if(dt&&dt.length){throw new ht.MidwayDuplicateRouteError(`${ut.requestMethod} ${ut.url}`,`${dt[0].handlerName}`,`${ut.handlerName}`)}if(!ut.fullUrlFlattenString&&ut.url&&typeof ut.url==="string"){ut.fullUrl=(0,mt.joinURLPath)(ct,ut.url);if(/\*$/.test(ut.fullUrl)){ut.fullUrlFlattenString=ut.fullUrl.replace("*","(.*)")}else{ut.fullUrlFlattenString=ut.fullUrl}}pt.push(ut)}};$t=dt([(0,_t.Provide)(),(0,_t.Scope)(bt.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],$t);ut.MidwayWebRouterService=$t},29222:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.prepareGlobalApplicationContext=ut.prepareGlobalApplicationContextAsync=ut.destroyGlobalApplicationContext=ut.initializeGlobalApplicationContext=void 0;const dt=pt(46123);const ft=pt(42193);const _t=pt(49757);const mt=pt(39023);const ht=pt(42592);const yt=pt(16928);const vt=pt(658);const St=pt(70032);const bt=mt.debuglog("midway:debug");let xt=1;function printStepDebugInfo(ct){bt(`\n\nStep ${xt++}: ${ct}\n`)}async function initializeGlobalApplicationContext(ct){St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const ut=await prepareGlobalApplicationContextAsync(ct);printStepDebugInfo("Init logger");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const pt=await ut.getAsync(dt.MidwayLoggerService,[ut,ct]);if(pt.getLogger("appLogger")){ut.registerObject("logger",pt.getLogger("appLogger"))}St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await ut.getAsync(dt.MidwayMockService,[ut]);printStepDebugInfo("Init framework");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await ut.getAsync(dt.MidwayFrameworkService,[ut,ct]);St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await ut.getAsync(dt.MidwayLifeCycleService,[ut]);St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init preload modules");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const ft=(0,_t.listPreloadModule)();for(const ct of ft){await ut.getAsync(ct)}St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return ut}ut.initializeGlobalApplicationContext=initializeGlobalApplicationContext;async function destroyGlobalApplicationContext(ct){const ut=await ct.getAsync(dt.MidwayLoggerService);const pt=ut.getCurrentLoggerFactory();const ft=await ct.getAsync(dt.MidwayLifeCycleService);await ft.stop();await ct.stop();(0,_t.clearBindContainer)();pt.close();St.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined}ut.destroyGlobalApplicationContext=destroyGlobalApplicationContext;async function prepareGlobalApplicationContextAsync(ct){var ut,pt,xt,$t,Et;printStepDebugInfo("Ready to create applicationContext");bt('[core]: start "initializeGlobalApplicationContext"');bt(`[core]: bootstrap options = ${mt.inspect(ct)}`);const Ct=(ut=ct.appDir)!==null&&ut!==void 0?ut:"";const Tt=(pt=ct.baseDir)!==null&&pt!==void 0?pt:"";St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const wt=(xt=ct.applicationContext)!==null&&xt!==void 0?xt:new dt.MidwayContainer;bt("[core]: delegate module map from decoratorManager");(0,_t.bindContainer)(wt);global["MIDWAY_APPLICATION_CONTEXT"]=wt;wt.registerObject("baseDir",Tt);wt.registerObject("appDir",Ct);St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);bt("[core]: set default file detector");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!ct.moduleLoadType){ct.moduleLoadType="commonjs"}if(ct.moduleDetector!==false){bt("[core]: set module load type = %s",ct.moduleLoadType);if(!ct.imports){ct.imports=[await(0,dt.loadModule)((0,yt.join)(Tt,`configuration${(0,dt.isTypeScriptEnvironment)()?".ts":".js"}`),{loadMode:ct.moduleLoadType,safeLoad:true})]}if(ct.moduleDetector===undefined){if(ct.moduleLoadType==="esm"){wt.setFileDetector(new dt.ESModuleFileDetector({loadDir:Tt,ignore:($t=ct.ignore)!==null&&$t!==void 0?$t:[]}));ct.moduleLoadType="esm"}else{wt.setFileDetector(new dt.CommonJSFileDetector({loadDir:Tt,ignore:(Et=ct.ignore)!==null&&Et!==void 0?Et:[]}))}}}St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");wt.bindClass(dt.MidwayEnvironmentService);wt.bindClass(dt.MidwayInformationService);wt.bindClass(dt.MidwayAspectService);wt.bindClass(dt.MidwayDecoratorService);wt.bindClass(dt.MidwayConfigService);wt.bindClass(dt.MidwayLoggerService);wt.bindClass(dt.MidwayApplicationManager);wt.bindClass(dt.MidwayFrameworkService);wt.bindClass(dt.MidwayMiddlewareService);wt.bindClass(dt.MidwayLifeCycleService);wt.bindClass(dt.MidwayMockService);wt.bindClass(dt.MidwayWebRouterService);wt.bindClass(ht.MidwayServerlessFunctionService);wt.bindClass(vt.MidwayHealthService);wt.bindClass(dt.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(ct.preloadModules&&ct.preloadModules.length){for(const ut of ct.preloadModules){wt.bindClass(ut)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const At=wt.get(dt.MidwayEnvironmentService);At.setModuleLoadType(ct.moduleLoadType);const kt=wt.get(dt.MidwayConfigService);kt.add([{default:ft.default}]);wt.get(dt.MidwayAspectService,[wt]);wt.get(dt.MidwayDecoratorService,[wt]);printStepDebugInfo("Load imports(component) and user code configuration module");wt.load([].concat(ct.imports).concat(ct.configurationModule));printStepDebugInfo("Run applicationContext ready method");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);await wt.ready();St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(ct.globalConfig){if(Array.isArray(ct.globalConfig)){kt.add(ct.globalConfig)}else{kt.addObject(ct.globalConfig)}}printStepDebugInfo("Load config file");kt.load();bt("[core]: Current config = %j",kt.getConfiguration());St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);wt.get(dt.MidwayMiddlewareService,[wt]);return wt}ut.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;function prepareGlobalApplicationContext(ct){var ut,pt,xt,$t;printStepDebugInfo("Ready to create applicationContext");bt('[core]: start "initializeGlobalApplicationContext"');bt(`[core]: bootstrap options = ${mt.inspect(ct)}`);const Et=(ut=ct.appDir)!==null&&ut!==void 0?ut:"";const Ct=(pt=ct.baseDir)!==null&&pt!==void 0?pt:"";St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Tt=(xt=ct.applicationContext)!==null&&xt!==void 0?xt:new dt.MidwayContainer;bt("[core]: delegate module map from decoratorManager");(0,_t.bindContainer)(Tt);global["MIDWAY_APPLICATION_CONTEXT"]=Tt;Tt.registerObject("baseDir",Ct);Tt.registerObject("appDir",Et);St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);printStepDebugInfo("Ready module detector");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);if(!ct.moduleLoadType){ct.moduleLoadType="commonjs"}if(ct.moduleDetector!==false){if(ct.moduleDetector===undefined){Tt.setFileDetector(new dt.CommonJSFileDetector({ignore:($t=ct.ignore)!==null&&$t!==void 0?$t:[]}))}else if(ct.moduleDetector){Tt.setFileDetector(ct.moduleDetector)}}St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");Tt.bindClass(dt.MidwayEnvironmentService);Tt.bindClass(dt.MidwayInformationService);Tt.bindClass(dt.MidwayAspectService);Tt.bindClass(dt.MidwayDecoratorService);Tt.bindClass(dt.MidwayConfigService);Tt.bindClass(dt.MidwayLoggerService);Tt.bindClass(dt.MidwayApplicationManager);Tt.bindClass(dt.MidwayFrameworkService);Tt.bindClass(dt.MidwayMiddlewareService);Tt.bindClass(dt.MidwayLifeCycleService);Tt.bindClass(dt.MidwayMockService);Tt.bindClass(dt.MidwayWebRouterService);Tt.bindClass(ht.MidwayServerlessFunctionService);Tt.bindClass(vt.MidwayHealthService);Tt.bindClass(dt.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(ct.preloadModules&&ct.preloadModules.length){for(const ut of ct.preloadModules){Tt.bindClass(ut)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const wt=Tt.get(dt.MidwayEnvironmentService);wt.setModuleLoadType(ct.moduleLoadType);const At=Tt.get(dt.MidwayConfigService);At.add([{default:ft.default}]);Tt.get(dt.MidwayAspectService,[Tt]);Tt.get(dt.MidwayDecoratorService,[Tt]);printStepDebugInfo("Load imports(component) and user code configuration module");if(!ct.imports){ct.imports=[(0,dt.safeRequire)((0,yt.join)(ct.baseDir,"configuration"))]}Tt.load([].concat(ct.imports).concat(ct.configurationModule));printStepDebugInfo("Run applicationContext ready method");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Tt.ready();St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(ct.globalConfig){if(Array.isArray(ct.globalConfig)){At.add(ct.globalConfig)}else{At.addObject(ct.globalConfig)}}printStepDebugInfo("Load config file");At.load();bt("[core]: Current config = %j",At.getConfiguration());St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Tt.get(dt.MidwayMiddlewareService,[Tt]);return Tt}ut.prepareGlobalApplicationContext=prepareGlobalApplicationContext},90406:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.pascalCase=ut.camelCase=void 0;const pt=/[\p{Lu}]/u;const dt=/[\p{Ll}]/u;const ft=/([\p{Alpha}\p{N}_]|$)/u;const _t=/[_.\- ]+/;const mt=new RegExp("^"+_t.source);const ht=new RegExp(_t.source+ft.source,"gu");const yt=new RegExp("\\d+"+ft.source,"gu");const preserveCamelCase=(ct,ut,ft)=>{let _t=false;let mt=false;let ht=false;for(let yt=0;yt<ct.length;yt++){const vt=ct[yt];if(_t&&pt.test(vt)){ct=ct.slice(0,yt)+"-"+ct.slice(yt);_t=false;ht=mt;mt=true;yt++}else if(mt&&ht&&dt.test(vt)){ct=ct.slice(0,yt-1)+"-"+ct.slice(yt-1);ht=mt;mt=false;_t=true}else{_t=ut(vt)===vt&&ft(vt)!==vt;ht=mt;mt=ft(vt)===vt&&ut(vt)!==vt}}return ct};const postProcess=(ct,ut)=>{ht.lastIndex=0;yt.lastIndex=0;return ct.replace(ht,((ct,pt)=>ut(pt))).replace(yt,(ct=>ut(ct)))};function camelCaseOrigin(ct,ut){ut={pascalCase:false,...ut};ct=ct.trim();if(ct.length===0){return""}const toLowerCase=ct=>ct.toLowerCase();const toUpperCase=ct=>ct.toUpperCase();if(ct.length===1){if(_t.test(ct)){return""}return ut.pascalCase?toUpperCase(ct):toLowerCase(ct)}const pt=ct!==toLowerCase(ct);if(pt){ct=preserveCamelCase(ct,toLowerCase,toUpperCase)}ct=ct.replace(mt,"");ct=toLowerCase(ct);if(ut.pascalCase){ct=toUpperCase(ct.charAt(0))+ct.slice(1)}return postProcess(ct,toUpperCase)}function camelCase(ct){return camelCaseOrigin(ct,{pascalCase:false})}ut.camelCase=camelCase;function pascalCase(ct){return camelCaseOrigin(ct,{pascalCase:true})}ut.pascalCase=pascalCase},50539:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.getCurrentAsyncContextManager=ut.getCurrentMainApp=ut.getCurrentMainFramework=ut.getCurrentApplicationContext=void 0;const dt=pt(2222);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];ut.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];ut.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const ct=(0,ut.getCurrentMainFramework)();if(ct){return ct.getApplication()}return undefined};ut.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,ut.getCurrentApplicationContext)().get(dt.ASYNC_CONTEXT_MANAGER_KEY);ut.getCurrentAsyncContextManager=getCurrentAsyncContextManager},83486:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.extend=void 0;const dt=pt(63289);function extend(...ct){let ut,pt,ft,_t,mt;let ht=ct[0];let yt=1;const vt=ct.length;let St=false;if(typeof ht==="boolean"){St=ht;ht=ct[1]||{};yt=2}else if(typeof ht!=="object"&&typeof ht!=="function"||ht==null){ht={}}for(;yt<vt;++yt){ut=ct[yt];if(ut==null)continue;for(pt in ut){if(pt==="__proto__")continue;ft=ht[pt];_t=ut[pt];if(ht===_t)continue;if(St&&_t&&dt.Types.isPlainObject(_t)){mt=ft&&dt.Types.isPlainObject(ft)?ft:{};ht[pt]=extend(St,mt,_t)}else if(typeof _t!=="undefined"){ht[pt]=_t}}}return ht}ut.extend=extend},2764:(ct,ut)=>{"use strict";
1
+ (()=>{var __webpack_modules__={53196:ct=>{function webpackEmptyAsyncContext(ct){return Promise.resolve().then((()=>{var ut=new Error("Cannot find module '"+ct+"'");ut.code="MODULE_NOT_FOUND";throw ut}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=53196;ct.exports=webpackEmptyAsyncContext},38818:(ct,ut,pt)=>{const{Bootstrap:dt}=pt(84575);dt.configure({imports:pt(15545),moduleDetector:false}).run()},14071:function(ct,ut,pt){"use strict";var dt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});const ft=dt(pt(22078));const _t=pt(28234);const{logLevel:mt=""}=(0,ft.default)(process.argv.slice(2));ut["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:mt||"warn"},coreLogger:{level:mt||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},i18n:{defaultLocale:"zh",localeTable:{en:{default:_t.backendMessages.en},zh:{default:_t.backendMessages.zh}},writeCookie:false}}},91921:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut["default"]={}},12799:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var yt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.MainConfiguration=void 0;const vt=pt(46123);const St=mt(pt(47453));const bt=mt(pt(99375));const xt=mt(pt(65295));const $t=mt(pt(2865));const Et=mt(pt(49179));const Ct=mt(pt(62487));const Tt=mt(pt(96955));const wt=mt(pt(87735));const At=mt(pt(16928));const kt=mt(pt(79896));const It=yt(pt(76982));const Nt=pt(79896);const Pt=pt(24434);const Ot=yt(pt(99819));const Dt=yt(pt(44400));const Ft=yt(pt(77036));const Mt=pt(76289);const Rt=pt(60449);const Lt=pt(54633);const Bt=pt(59416);const Vt=pt(61142);const jt=pt(64754);const Ut=pt(10778);const Jt=pt(49969);const zt=pt(67872);const Wt=pt(4145);const qt=mt(pt(14071));const Ht=mt(pt(91921));const Kt=pt(39538);const Gt=pt(21739);const Xt=mt(pt(68255));const Qt={DEFAULT_PORT:Number(Kt.uri.getUrlPort(Rt.KEYS.LOCAL_SERVICE_URL_DEV)),MAX_SUB_PORT_RETRIES:20};let Yt=class MainConfiguration{constructor(){this.appConfig=null;this.subServer=null;this._websitePath=null}get websitePath(){if(!this._websitePath){const ct=this.app.getEnv();this._websitePath=At.resolve(__dirname,ct===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL?"../../../website":"./website")}return this._websitePath}get apiUrl(){const ct=this.app.getEnv();return ct===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL?Rt.KEYS.REMOTE_SERVICE_URL_DEV:Rt.KEYS.REMOTE_SERVICE_URL_PROD}getVersion(){const ct=this.app.getEnv();if(ct===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const ct=At.join(__dirname,"../../cli/package.json");const ut=JSON.parse((0,Nt.readFileSync)(ct,"utf8"));return ut.version}return process.env.COMP_HUB_VERSION||"unknown"}createProxyConfig(ct){const ut=new Pt.EventEmitter;const pt={...ct,on:{...ct.on,error:ct=>{this.logger.error("Proxy Error:",ct.message);ut.emit("error",ct)},proxyRes:()=>ut.emit("proxyRes"),proxyReq:ct=>{const pt=`${ct.protocol}//${ct.host}${ct.path}`;this.logger.debug("[Proxy] →",pt);ut.emit("proxyReq",ct)},proxyReqWs:(...ct)=>ut.emit("proxyReqWs",...ct)}};const dt=ct.pathRewrite;const ft=Object.keys(dt??{});if(ft.length>0){const[ct]=ft;pt.pathRewrite=ut=>{let pt=ut.replace(Rt.KEYS.PROXY_PATH_PREFIX,"");pt=pt.replace(new RegExp(ct),dt[ct]);return pt}}else{pt.pathRewrite=ct=>ct.replace(Rt.KEYS.PROXY_PATH_PREFIX,"")}return{proxy:(0,Mt.createProxyMiddleware)(pt),opt:pt,event:ut}}createProxyMap(ct){const ut={};for(const[pt,dt]of Object.entries(ct)){ut[pt]=this.createProxyConfig(dt)}return ut}setupProxy(){const ct=this.app.getAttr(Rt.KEYS.COMPHUB_CONFIG_KEY);if(jt.ProxyController.proxys){for(const ct of Object.values(jt.ProxyController.proxys)){ct.event.removeAllListeners()}}jt.ProxyController.proxys={};if(!ct.proxy)return;jt.ProxyController.proxys=this.createProxyMap(ct.proxy)}async buildConfig(ct){const ut=this.app.getEnv();const pt=ct.cwd||process.cwd();this.logger.info("cwd:",pt);this.logger.info("env:",ut);const dt={port:ct.port||Qt.DEFAULT_PORT,allowDebug:ct.allowDebug??false,api:ct.api||this.apiUrl,dir:ct.dir||"",cwd:pt,proxy:ct.proxy};const ft=At.join(this.websitePath,Rt.KEYS.WEBSITE_PATH_MAIN);const _t=At.join(pt,dt.dir||"").replace(/[\\/]$/,"");const mt=At.join(pt,Rt.KEYS.PREBUILD_MODULE_DIR);const ht=At.join(pt,"node_modules");await kt.promises.mkdir(mt,{recursive:true});const yt={websitePath:ft,prebuildModulePath:mt,cwd:pt,port:dt.port,srcPath:_t,remoteServer:dt.api,version:this.getVersion(),allowDebug:dt.allowDebug,proxy:dt.proxy,projectHash:It.default.createHash("sha256").update(pt).digest("hex").slice(0,8)};Ut.remoteInstance.defaults.baseURL=yt.remoteServer;if(ut===Rt.KEYS.LOCAL_MIDWAY_ENV_PROD){yt.port=await(0,Ft.default)({port:Ft.default.makeRange(yt.port,yt.port+100)})}this.appConfig=yt;const vt={dirs:{default:{prefix:`/${Rt.KEYS.WEBSITE_PATH_MAIN}`,dir:ft},[Rt.KEYS.MODULE_LOAD_PREFIX]:{prefix:Rt.KEYS.MODULE_LOAD_PREFIX,dir:mt,maxAge:0},[Rt.KEYS.NODE_MODULES_LOAD_PREFIX]:{prefix:Rt.KEYS.NODE_MODULES_LOAD_PREFIX,dir:ht,maxAge:0},[Rt.KEYS.COMP_PREVIEW_PREFIX_LOCAL]:{prefix:Rt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,dir:yt.srcPath,maxAge:0}}};try{await kt.promises.access(ft,kt.constants.F_OK)}catch(ct){this.logger.warn("websitePathMain 不存在:请先构建前端项目",(0,Jt.getErrorMessage)(ct));await kt.promises.mkdir(ft,{recursive:true})}if(ut===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await kt.promises.writeFile(At.join(__dirname,".comphubConfig.json"),JSON.stringify(yt,null,2))}return{koa:{port:yt.port},staticFile:vt,httpProxy:{strategy:{[Rt.KEYS.REMOTE_SERVICE_PREFIX]:{match:new RegExp(`^/${Rt.KEYS.REMOTE_SERVICE_PREFIX}/(.*)$`),target:`${yt.remoteServer}/$1`}}}}}async startSubPort(){const ct=this.app.getEnv();const ut=this.app.getAttr(Rt.KEYS.COMPHUB_CONFIG_KEY);const{port:pt,remoteServer:dt}=ut;let ft=await(0,Ft.default)({port:Ft.default.makeRange(pt,pt+100)});const _t=new Ot.default;_t.use((async(ct,ft)=>{if(ct.path.startsWith(Rt.KEYS.COMP_PREVIEW_PREFIX_LOCAL)){const{srcPath:pt}=ut;const dt=ct.path[0];const ft=ct.path.replace(Rt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,"");const _t=await Kt.locate.resolveBuildPath(ft,{baseDir:pt});if(_t){const ut=_t.replace(pt,"");const mt=Gt.textKit.replaceSlashWithSpecifiedSeparator(ut,dt);if(ft!==mt){const ut=mt.replace(ft,"");ct.redirect(ct.path+ut);return}}}const _t=[{prefix:`/${Rt.KEYS.REMOTE_SERVICE_PREFIX}`,target:dt,rewrite:{[`^/${Rt.KEYS.REMOTE_SERVICE_PREFIX}`]:""}},{prefix:`/${Rt.KEYS.LOCAL_SERVICE_PREFIX}`,target:`${Rt.KEYS.IFRAME_HOST}:${pt}`,rewrite:{[`^/${Rt.KEYS.LOCAL_SERVICE_PREFIX}`]:""}},{prefix:Rt.KEYS.MODULE_LOAD_PREFIX,target:`${Rt.KEYS.IFRAME_HOST}:${pt}`,rewrite:{}},{prefix:Rt.KEYS.NODE_MODULES_LOAD_PREFIX,target:`${Rt.KEYS.IFRAME_HOST}:${pt}`,rewrite:{}},{prefix:Rt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,target:`${Rt.KEYS.IFRAME_HOST}:${pt}`,rewrite:{}}];for(const ut of _t){if(ct.path.startsWith(ut.prefix)){await(0,zt.createKoaProxy)(ct,ut.target,ut.rewrite);return}}await ft()}));_t.use((0,Dt.default)(this.websitePath,{index:false}));_t.use((async ct=>{try{const ut=(()=>{if(ct.path.startsWith(`${Rt.KEYS.IFRAME_ITEM_WEBSITE_PATH}/`)){return Rt.KEYS.IFRAME_ITEM_WEBSITE_PATH}if(ct.path.startsWith(`${Rt.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}/`)){return Rt.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}return""})();const pt=At.join(this.websitePath,ut,"index.html");const dt=await kt.promises.readFile(pt,"utf-8");const _t=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify({subPort:ft})};<\/script>`;const mt=dt.replace("\x3c!--GLOBAL_CONFIG--\x3e",_t);ct.type="text/html; charset=utf-8";ct.status=200;ct.body=mt}catch(ut){this.logger.error("读取 index.html 失败:",ut);ct.status=500;ct.body="服务器内部错误"}}));await new Promise(((pt,dt)=>{let mt=0;const ht=_t.listen(ft,(()=>{this.subServer=ht;this.app.setAttr(Rt.KEYS.COMPHUB_CONFIG_KEY,{...ut,subPort:ft});if(process.send){process.send({type:"subPort",subPort:ft})}if(ct===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info(`子端口 ${ft} 已启动`)}pt()}));ht.on("error",(ct=>{if(ct.code==="EADDRINUSE"&&mt<Qt.MAX_SUB_PORT_RETRIES){mt++;this.logger.error(`子端口 ${ft} 被占用,正在尝试端口 ${++ft}`);ht.close();ht.listen(ft)}else{dt(ct)}}))}))}async printAccessInfo(ct){const ut=await ct.getAsync(St.Framework);const pt=ut.getServer();const dt=pt.address();const ft=this.app.getEnv();const _t=this.app.getAttr(Rt.KEYS.COMPHUB_CONFIG_KEY);this.logger.info("cwd:",_t.cwd);this.logger.info("env:",ft);this.logger.info("port:",_t.port);if(_t.subPort)this.logger.info("subPort:",_t.subPort);if(dt&&typeof dt!=="string"){const ct=dt.port;this.logger.info("Local Address:",`http://localhost:${ct}`);if(ft===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const ut=Kt.network.getLocalIPv4();if(ut)this.logger.info("Network Address:",`http://${ut}:${ct}`);this.logger.info("Swagger UI:",`http://localhost:${ct}/swagger-ui/index.html`)}}}async onConfigLoad(){const ct=await(0,Wt.waitForIpcConfig)();const ut=await this.buildConfig(ct);const pt=this.app.getEnv();if(pt===Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await kt.promises.writeFile(At.join(__dirname,".start.json"),JSON.stringify(ut,null,2))}return ut}async onReady(){this.app.setAttr(Rt.KEYS.COMPHUB_CONFIG_KEY,this.appConfig);this.app.useMiddleware([Vt.ReportMiddleware]);this.app.useFilter([Bt.BadRequestErrorFilter,Lt.DefaultErrorFilter]);process.on("disconnect",(()=>{this.logger.info("Master process exited, shutting down...");if(this.subServer){this.subServer.close()}process.exit(0)}))}async onServerReady(ct){this.setupProxy();await this.startSubPort();await this.printAccessInfo(ct)}async onStop(){if(this.subServer){await new Promise((ct=>{this.subServer.close((()=>ct()))}));this.logger.info("子服务已关闭")}}};ut.MainConfiguration=Yt;_t([(0,vt.Logger)("coreLogger"),ht("design:type",Object)],Yt.prototype,"logger",void 0);_t([(0,vt.App)(),ht("design:type",Object)],Yt.prototype,"app",void 0);ut.MainConfiguration=Yt=_t([(0,vt.Configuration)({imports:[St,bt,$t,Ct,Tt,wt,Xt,{component:xt,enabledEnvironment:[Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL]},{component:Et,enabledEnvironment:[Rt.KEYS.LOCAL_MIDWAY_ENV_LOCAL]}],importConfigs:[{default:qt,local:Ht}]})],Yt)},64754:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t;Object.defineProperty(ut,"__esModule",{value:true});ut.ProxyController=void 0;const mt=pt(46123);const ht=pt(60449);const yt=ht.KEYS.PROXY_PATH_PREFIX;let vt=_t=class ProxyController{async proxy(){const ct=this.ctx.path.replace(yt,"");let ut=null;for(const[pt,dt]of Object.entries(_t.proxys)){const ft=new RegExp(pt);if(ft.test(ct)||ct.startsWith(pt)){ut=dt;break}}if(!ut){this.ctx.status=404;this.ctx.body={message:"Proxy not found"};return}const{proxy:pt,event:dt}=ut;await new Promise(((ct,ut)=>{pt(this.ctx.req,this.ctx.res);dt.on("error",ut);dt.on("proxyRes",ct)}))}};ut.ProxyController=vt;dt([(0,mt.Inject)(),ft("design:type",Object)],vt.prototype,"ctx",void 0);dt([(0,mt.All)("/*"),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],vt.prototype,"proxy",null);ut.ProxyController=vt=_t=dt([(0,mt.Controller)(yt,{ignoreGlobalPrefix:true})],vt)},17076:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SpaController=void 0;const yt=pt(46123);const vt=mt(pt(79896));const St=pt(16928);const bt=pt(49179);const xt=pt(63366);const $t=pt(60449);let Et=class SpaController{async index(){this.ctx.redirect(`/${$t.KEYS.WEBSITE_PATH_MAIN}/`)}async spa(){const ct=this.configService.comphubConfig();const{websitePath:ut}=ct;const pt=(0,St.resolve)(ut,"index.html");let dt=await vt.promises.readFile(pt,"utf-8");const ft=this.configService.getGlobalConfig();const{projectHash:_t}=ft;if(_t){dt=dt.replace(/<base[^>]*>/gi,"");dt=dt.replace("\x3c!--BASE_HREF--\x3e",`<base href="/${_t}/main/">`)}const mt=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify(ft)};<\/script>`;dt=dt.replace("\x3c!--GLOBAL_CONFIG--\x3e",mt);return dt}async getGlobalConfig(){return this.configService.getGlobalConfig()}};ut.SpaController=Et;_t([(0,yt.Inject)(),ht("design:type",Object)],Et.prototype,"ctx",void 0);_t([(0,yt.App)(),ht("design:type",Object)],Et.prototype,"app",void 0);_t([(0,yt.Inject)(),ht("design:type",xt.ConfigService)],Et.prototype,"configService",void 0);_t([(0,yt.Get)("/"),ht("design:type",Function),ht("design:paramtypes",[]),ht("design:returntype",Promise)],Et.prototype,"index",null);_t([(0,yt.Get)(`/${$t.KEYS.WEBSITE_PATH_MAIN}/*`),ht("design:type",Function),ht("design:paramtypes",[]),ht("design:returntype",Promise)],Et.prototype,"spa",null);_t([(0,yt.Get)($t.KEYS.GLOBAL_CONFIG_PATH),ht("design:type",Function),ht("design:paramtypes",[]),ht("design:returntype",Promise)],Et.prototype,"getGlobalConfig",null);ut.SpaController=Et=_t([(0,bt.ApiExcludeController)(),(0,yt.Controller)("/",{ignoreGlobalPrefix:true})],Et)},78805:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__param||function(ct,ut){return function(pt,dt){ut(pt,dt,ct)}};Object.defineProperty(ut,"__esModule",{value:true});ut.CompController=void 0;const mt=pt(46123);const ht=pt(48795);const yt=pt(63366);const vt=pt(49179);const St=pt(8131);const bt=pt(101);const xt=pt(19465);const $t=pt(93597);const Et=pt(6586);const Ct=(0,$t.createNoData)(vt.ApiProperty);let Tt=class CompController{async dir(ct){const ut=await this.compService.getCompDir(ct.compPath);return $t.resUtil.success(ut)}async file(ct){const{filePath:ut}=ct;const pt=await this.compService.getCompFile(ut);return $t.resUtil.success({content:pt})}async check(ct){const ut=await this.compService.checkCompConfig(ct.compPath);return $t.resUtil.success(ut)}async updateVersion(ct){const{compPath:ut,version:pt}=ct;await this.compService.updateCompVersion(ut,pt);return $t.resUtil.noData()}async generateCompJson(ct){const{compPath:ut}=ct;await this.compService.generateCompJson(ut);return $t.resUtil.noData()}async dep(ct){const{compPath:ut}=ct;const pt=await this.compService.getCompDep(ut);return $t.resUtil.success({thirdParty:pt})}async checkCompRepeat(ct){await Et.remoteApi.v1Token.tokencontrollerApproachexpire();const ut=await this.compService.checkCompRepeat(ct);return $t.resUtil.success(ut)}async submit(ct){await Et.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.submitComp(ct);return $t.resUtil.noData()}async update(ct){await Et.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.updateComp(ct);return $t.resUtil.noData()}async download(ct){const ut=await this.compService.downloadComp(ct);if(ut?.isRepeat){return $t.resUtil.success({isRepeat:true})}return $t.resUtil.success({isRepeat:false})}async localCompsByIds(ct){const{compIds:ut}=ct;const pt=await this.compService.getLocalCompsByIds(ut);return $t.resUtil.success({compInfos:pt})}async compFilesOssSignedUrl(ct){const ut=await this.compService.getCompFilesOssSignedUrl(ct);return $t.resUtil.success(ut)}async packageJson(){const ct=await this.compService.getPackageJsonContent();return $t.resUtil.success({packageJson:ct})}async compFileHash(ct){const ut=await this.compService.getCompFileHash(ct);return $t.resUtil.success(ut)}async localComps(ct){const ut=await this.compService.getLocalComps(ct);return $t.resUtil.success(ut)}async openCompPathInVscode(ct){await this.compService.openCompPathInVscode(ct);return $t.resUtil.noData()}async localCompDetailByPathHash(ct){const ut=await this.compService.getLocalCompDetailByPathHash(ct);return $t.resUtil.success(ut)}async writeFile(ct){await this.compService.writeCompFile(ct);return $t.resUtil.noData()}};ut.CompController=Tt;dt([(0,mt.App)(),ft("design:type",Object)],Tt.prototype,"app",void 0);dt([(0,mt.Inject)(),ft("design:type",ht.CompService)],Tt.prototype,"compService",void 0);dt([(0,mt.Inject)(),ft("design:type",yt.ConfigService)],Tt.prototype,"configService",void 0);dt([(0,vt.ApiOperation)({summary:"获取组件目录"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompFileVO)}),(0,mt.Post)("/dir"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompDirDTO]),ft("design:returntype",Promise)],Tt.prototype,"dir",null);dt([(0,vt.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompFileContentVO)}),(0,mt.Post)("/file"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompFileDTO]),ft("design:returntype",Promise)],Tt.prototype,"file",null);dt([(0,vt.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompCheckVO)}),(0,mt.Post)("/check"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompCheckDTO]),ft("design:returntype",Promise)],Tt.prototype,"check",null);dt([(0,vt.ApiOperation)({summary:"更新组件版本号"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/updateVersion"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.UpdateVersionDTO]),ft("design:returntype",Promise)],Tt.prototype,"updateVersion",null);dt([(0,vt.ApiOperation)({summary:"生成组件指纹文件"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/generateCompJson"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.GenerateCompJsonDTO]),ft("design:returntype",Promise)],Tt.prototype,"generateCompJson",null);dt([(0,vt.ApiOperation)({summary:"获取组件依赖关系"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.ImportScanResultVO)}),(0,mt.Post)("/dep"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.DepDTO]),ft("design:returntype",Promise)],Tt.prototype,"dep",null);dt([(0,vt.ApiOperation)({summary:"检查组件是否重复"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompSimilarListVO)}),(0,mt.Post)("/checkCompRepeat",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CheckCompRepeatDTO]),ft("design:returntype",Promise)],Tt.prototype,"checkCompRepeat",null);dt([(0,vt.ApiOperation)({summary:"提交组件"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/submit",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.SubmitCompDTO]),ft("design:returntype",Promise)],Tt.prototype,"submit",null);dt([(0,vt.ApiOperation)({summary:"更新组件"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/update",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.UpdateCompDTO]),ft("design:returntype",Promise)],Tt.prototype,"update",null);dt([(0,vt.ApiOperation)({summary:"下载组件"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.DownloadCompVO)}),(0,mt.Post)("/download",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.DownloadCompDTO]),ft("design:returntype",Promise)],Tt.prototype,"download",null);dt([(0,vt.ApiOperation)({summary:"通过ids在本地查询组件"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.LocalCompsByIdsVO)}),(0,mt.Post)("/localCompsByIds"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.LocalCompsByIdsDTO]),ft("design:returntype",Promise)],Tt.prototype,"localCompsByIds",null);dt([(0,vt.ApiOperation)({summary:"获取组件文件夹下所有文件的oss签名访问地址"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompFilesOssSignedUrlVO)}),(0,mt.Post)("/compFilesOssSignedUrl",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompFilesOssSignedUrlDTO]),ft("design:returntype",Promise)],Tt.prototype,"compFilesOssSignedUrl",null);dt([(0,vt.ApiOperation)({summary:"获取package.json"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.PackageJsonVO)}),(0,mt.Post)("/packageJson"),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],Tt.prototype,"packageJson",null);dt([(0,vt.ApiOperation)({summary:"获取组件文件hash"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.CompFileHashVO)}),(0,mt.Post)("/compFileHash"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompFileHashDTO]),ft("design:returntype",Promise)],Tt.prototype,"compFileHash",null);dt([(0,vt.ApiOperation)({summary:"获取本地组件列表,分页查询"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,(0,$t.createListWrapper)(vt.ApiProperty,bt.LocalCompsVO))}),(0,mt.Post)("/localComps",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.LocalCompsDTO]),ft("design:returntype",Promise)],Tt.prototype,"localComps",null);dt([(0,vt.ApiOperation)({summary:"通过组件路径打开在vscode中打开所在文件夹"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/openCompPathInVscode"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.OpenCompPathInVscodeDTO]),ft("design:returntype",Promise)],Tt.prototype,"openCompPathInVscode",null);dt([(0,vt.ApiOperation)({summary:"通过组件完整文件路径hash获取组件信息"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:(0,$t.createSuccessWrapper)(vt.ApiProperty,bt.LocalCompDetailVO)}),(0,mt.Post)("/localCompDetailByPathHash"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.LocalCompDetailByPathHashDTO]),ft("design:returntype",Promise)],Tt.prototype,"localCompDetailByPathHash",null);dt([(0,vt.ApiOperation)({summary:"写入文件到组件目录"}),(0,vt.ApiResponse)({status:200,description:"返回结果",type:Ct}),(0,mt.Post)("/writeFile"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[St.CompWriteFileDTO]),ft("design:returntype",Promise)],Tt.prototype,"writeFile",null);ut.CompController=Tt=dt([(0,vt.ApiTags)(["v1-comp"]),(0,mt.Controller)("/v1/comp")],Tt)},91308:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__param||function(ct,ut){return function(pt,dt){ut(pt,dt,ct)}};Object.defineProperty(ut,"__esModule",{value:true});ut.ModuleController=void 0;const mt=pt(46123);const ht=pt(49179);const yt=pt(85984);const vt=pt(19428);const St=pt(71692);const bt=pt(61275);const xt=pt(93597);const $t=(0,xt.createNoData)(ht.ApiProperty);let Et=class ModuleController{async preBuild(ct){const{deps:ut}=ct;let pt=null;await this.queueService.enqueue((async()=>{pt=await this.moduleService.preBuild(ut)}));return xt.resUtil.success(pt)}async preBuildSize(){const ct=await this.moduleService.preBuildSize();return xt.resUtil.success({size:ct})}async clearPreBuild(){await this.moduleService.clearPreBuild();return xt.resUtil.noData()}};ut.ModuleController=Et;dt([(0,mt.Inject)(),ft("design:type",yt.ModuleService)],Et.prototype,"moduleService",void 0);dt([(0,mt.Inject)(),ft("design:type",bt.QueueService)],Et.prototype,"queueService",void 0);dt([(0,ht.ApiOperation)({summary:"模块预构建"}),(0,ht.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(ht.ApiProperty,St.PreBuildVO)}),(0,mt.Post)("/preBuild"),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[vt.PreBuildDTO]),ft("design:returntype",Promise)],Et.prototype,"preBuild",null);dt([(0,ht.ApiOperation)({summary:"获取预构建模块文件总大小"}),(0,ht.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(ht.ApiProperty,St.PreBuildSizeVO)}),(0,mt.Post)("/preBuildSize"),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],Et.prototype,"preBuildSize",null);dt([(0,ht.ApiOperation)({summary:"清除预构建模块文件"}),(0,ht.ApiResponse)({status:200,description:"返回结果",type:$t}),(0,mt.Post)("/clearPreBuild"),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],Et.prototype,"clearPreBuild",null);ut.ModuleController=Et=dt([(0,ht.ApiTags)(["v1-module"]),(0,mt.Controller)("/v1/module")],Et)},5387:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__param||function(ct,ut){return function(pt,dt){ut(pt,dt,ct)}};Object.defineProperty(ut,"__esModule",{value:true});ut.OssController=void 0;const mt=pt(46123);const ht=pt(49179);const yt=pt(93597);const vt=pt(56415);const St=pt(75049);const bt=pt(80799);const xt=pt(19465);let $t=class OssController{async fileSignUrl(ct){const{objectId:ut}=ct;const pt=await this.ossService.getDownloadSts();const dt=await this.ossService.getFilePreviewUrl(pt,ut);return yt.resUtil.success({signUrl:dt})}};ut.OssController=$t;dt([(0,mt.App)(),ft("design:type",Object)],$t.prototype,"app",void 0);dt([(0,mt.Inject)(),ft("design:type",bt.OssService)],$t.prototype,"ossService",void 0);dt([(0,ht.ApiOperation)({summary:"获取文件访问地址",description:"获取文件访问地址"}),(0,ht.ApiResponse)({status:200,description:"返回结果",type:(0,yt.createSuccessWrapper)(ht.ApiProperty,St.SignedUrlVO)}),(0,mt.Post)("/fileSignUrl",{middleware:[xt.TokenMiddleware]}),_t(0,(0,mt.Body)()),ft("design:type",Function),ft("design:paramtypes",[vt.SignedUrlDTO]),ft("design:returntype",Promise)],$t.prototype,"fileSignUrl",null);ut.OssController=$t=dt([(0,ht.ApiTags)(["v1-oss"]),(0,mt.Controller)("/v1/oss")],$t)},6444:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__param||function(ct,ut){return function(pt,dt){ut(pt,dt,ct)}};Object.defineProperty(ut,"__esModule",{value:true});ut.PreprocessingController=void 0;const mt=pt(49179);const ht=pt(46123);const yt=pt(90218);const vt=pt(18922);const St=pt(5578);const bt=pt(93597);let xt=class PreprocessingController{async preprocess(ct){const ut=await this.preprocessingService.preprocessCode(ct);return bt.resUtil.success({preprocessedCode:ut})}};ut.PreprocessingController=xt;dt([(0,ht.Inject)(),ft("design:type",St.PreprocessingService)],xt.prototype,"preprocessingService",void 0);dt([(0,mt.ApiOperation)({summary:"css预处理",description:"预处理css代码"}),(0,mt.ApiResponse)({status:200,description:"返回结果",type:(0,bt.createSuccessWrapper)(mt.ApiProperty,vt.PreprocessedCodeVO)}),(0,ht.Post)("/preprocess"),_t(0,(0,ht.Body)()),ft("design:type",Function),ft("design:paramtypes",[yt.PreprocessingDTO]),ft("design:returntype",Promise)],xt.prototype,"preprocess",null);ut.PreprocessingController=xt=dt([(0,mt.ApiTags)(["v1-preprocessing"]),(0,ht.Controller)("/v1/preprocessing")],xt)},20346:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__param||function(ct,ut){return function(pt,dt){ut(pt,dt,ct)}};Object.defineProperty(ut,"__esModule",{value:true});ut.VuefinderController=void 0;const mt=pt(46123);const ht=pt(5808);const yt=pt(49179);const vt=pt(23444);let St=class VuefinderController{async list(ct){const ut=await this.vuefinderService.list(ct);return ut}};ut.VuefinderController=St;dt([(0,mt.App)(),ft("design:type",Object)],St.prototype,"app",void 0);dt([(0,mt.Inject)(),ft("design:type",ht.VuefinderService)],St.prototype,"vuefinderService",void 0);dt([(0,yt.ApiOperation)({summary:"list"}),(0,mt.Get)("/list"),_t(0,(0,mt.Query)()),ft("design:type",Function),ft("design:paramtypes",[vt.VueFinderIndexDTO]),ft("design:returntype",Promise)],St.prototype,"list",null);ut.VuefinderController=St=dt([(0,yt.ApiTags)(["v1-vuefinder"]),(0,mt.Controller)("/v1/vuefinder")],St)},60149:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.BasePageDTO=void 0;const _t=pt(49179);const mt=pt(99375);class BasePageDTO{}ut.BasePageDTO=BasePageDTO;dt([(0,_t.ApiProperty)({example:1,description:"当前页码",required:false}),(0,mt.Rule)(mt.RuleType.number().min(1)),ft("design:type",Number)],BasePageDTO.prototype,"page",void 0);dt([(0,_t.ApiProperty)({example:10,description:"每页数量",required:false}),(0,mt.Rule)(mt.RuleType.number().min(1).max(50)),ft("design:type",Number)],BasePageDTO.prototype,"pageSize",void 0);dt([(0,mt.Rule)(mt.RuleType.string().allow("").max(50).pattern(/\{\s*\$\w+:/i,{invert:true}).trim()),(0,_t.ApiProperty)({example:"小明",description:"关键词",required:false}),ft("design:type",String)],BasePageDTO.prototype,"keyword",void 0)},8131:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.CompWriteFileDTO=ut.LocalCompDetailByPathHashDTO=ut.OpenCompPathInVscodeDTO=ut.LocalCompsDTO=ut.CompFilesOssSignedUrlDTO=ut.DownloadCompDTO=ut.UpdateCompDTO=ut.SubmitCompDTO=ut.CompFileDTO=ut.UpdateVersionDTO=ut.CompFileHashDTO=ut.CheckCompRepeatDTO=ut.LocalCompsByIdsDTO=ut.DepDTO=ut.GenerateCompJsonDTO=ut.CompCheckDTO=ut.CompDirDTO=void 0;const _t=pt(49179);const mt=pt(99375);const ht=pt(60449);const yt=pt(60149);class CompPathDTO{}dt([(0,_t.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompPathDTO.prototype,"compPath",void 0);class CompIdDTO{}dt([(0,_t.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompIdDTO.prototype,"compId",void 0);class CompDirDTO extends CompPathDTO{}ut.CompDirDTO=CompDirDTO;class CompCheckDTO extends CompPathDTO{}ut.CompCheckDTO=CompCheckDTO;class GenerateCompJsonDTO extends CompPathDTO{}ut.GenerateCompJsonDTO=GenerateCompJsonDTO;class DepDTO extends CompPathDTO{}ut.DepDTO=DepDTO;class LocalCompsByIdsDTO{}ut.LocalCompsByIdsDTO=LocalCompsByIdsDTO;dt([(0,_t.ApiProperty)({type:[String],required:true,description:"组件id列表",example:["123","456"]}),(0,mt.Rule)(mt.RuleType.array().required().items(mt.RuleType.string())),ft("design:type",Array)],LocalCompsByIdsDTO.prototype,"compIds",void 0);class CheckCompRepeatDTO extends CompPathDTO{}ut.CheckCompRepeatDTO=CheckCompRepeatDTO;dt([(0,_t.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,mt.Rule)(mt.RuleType.string()),ft("design:type",String)],CheckCompRepeatDTO.prototype,"teamId",void 0);class CompFileHashDTO extends CompPathDTO{}ut.CompFileHashDTO=CompFileHashDTO;class UpdateVersionDTO extends CompPathDTO{}ut.UpdateVersionDTO=UpdateVersionDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],UpdateVersionDTO.prototype,"version",void 0);class CompFileDTO{}ut.CompFileDTO=CompFileDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompFileDTO.prototype,"filePath",void 0);class PreviewItemDTO{}dt([(0,_t.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),(0,mt.Rule)(mt.RuleType.array().required().items(mt.RuleType.string())),ft("design:type",Array)],PreviewItemDTO.prototype,"miniPath",void 0);dt([(0,_t.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),(0,mt.Rule)(mt.RuleType.array().optional().items(mt.RuleType.string())),ft("design:type",Array)],PreviewItemDTO.prototype,"fullPath",void 0);dt([(0,_t.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),(0,mt.Rule)(mt.RuleType.string()),ft("design:type",String)],PreviewItemDTO.prototype,"desc",void 0);class ParentDTO{}dt([(0,_t.ApiProperty)({description:"父库名称",required:true,example:"vue"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],ParentDTO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],ParentDTO.prototype,"version",void 0);class DepItemDTO{}dt([(0,_t.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],DepItemDTO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],DepItemDTO.prototype,"version",void 0);dt([(0,_t.ApiProperty)({type:ParentDTO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),(0,mt.Rule)(mt.RuleType.object().optional()),ft("design:type",ParentDTO)],DepItemDTO.prototype,"parent",void 0);class SubmitCompDTO{}ut.SubmitCompDTO=SubmitCompDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],SubmitCompDTO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],SubmitCompDTO.prototype,"compPath",void 0);dt([(0,_t.ApiProperty)({type:[DepItemDTO],required:true,description:"组件依赖"}),(0,mt.Rule)(mt.RuleType.array().required()),ft("design:type",Array)],SubmitCompDTO.prototype,"dep",void 0);dt([(0,_t.ApiProperty)({type:[PreviewItemDTO],required:true,description:"组件预览数据"}),(0,mt.Rule)(mt.RuleType.array().required()),ft("design:type",Array)],SubmitCompDTO.prototype,"previewConfigs",void 0);dt([(0,_t.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],SubmitCompDTO.prototype,"desc",void 0);dt([(0,_t.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),(0,mt.Rule)(mt.RuleType.string().empty("").default("")),ft("design:type",String)],SubmitCompDTO.prototype,"bgColor",void 0);dt([(0,_t.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,mt.Rule)(mt.RuleType.string()),ft("design:type",String)],SubmitCompDTO.prototype,"teamId",void 0);dt([(0,_t.ApiProperty)({required:false,description:"组件标签",example:["hooks","图表"],type:[String]}),(0,mt.Rule)(mt.RuleType.array().items(mt.RuleType.string())),ft("design:type",Array)],SubmitCompDTO.prototype,"tags",void 0);class UpdateCompDTO extends SubmitCompDTO{}ut.UpdateCompDTO=UpdateCompDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],UpdateCompDTO.prototype,"compId",void 0);dt([(0,_t.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,mt.Rule)(mt.RuleType.string()),ft("design:type",String)],UpdateCompDTO.prototype,"teamId",void 0);dt([(0,_t.ApiProperty)({required:false,description:"组件升级描述",example:"升级组件描述"}),(0,mt.Rule)(mt.RuleType.string().allow("").max(200)),ft("design:type",String)],UpdateCompDTO.prototype,"upgradeDesc",void 0);class DownloadCompDTO extends CompIdDTO{}ut.DownloadCompDTO=DownloadCompDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],DownloadCompDTO.prototype,"savePath",void 0);dt([(0,_t.ApiProperty)({required:false,description:"是否覆盖",example:true}),(0,mt.Rule)(mt.RuleType.boolean().default(false)),ft("design:type",Boolean)],DownloadCompDTO.prototype,"isCover",void 0);dt([(0,_t.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],DownloadCompDTO.prototype,"compName",void 0);dt([(0,_t.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],DownloadCompDTO.prototype,"version",void 0);class CompFilesOssSignedUrlDTO{}ut.CompFilesOssSignedUrlDTO=CompFilesOssSignedUrlDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"version",void 0);dt([(0,_t.ApiProperty)({required:true,description:"对象存储id",example:"123"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"objectId",void 0);dt([(0,_t.ApiProperty)({type:[String],required:true,description:"组件文件路径",example:"MyComp/index.vue"}),(0,mt.Rule)(mt.RuleType.array().required().items(mt.RuleType.string())),ft("design:type",Array)],CompFilesOssSignedUrlDTO.prototype,"files",void 0);class LocalCompsDTO extends yt.BasePageDTO{}ut.LocalCompsDTO=LocalCompsDTO;class OpenCompPathInVscodeDTO{}ut.OpenCompPathInVscodeDTO=OpenCompPathInVscodeDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],OpenCompPathInVscodeDTO.prototype,"folderPath",void 0);dt([(0,_t.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],OpenCompPathInVscodeDTO.prototype,"relativeFilePath",void 0);class LocalCompDetailByPathHashDTO{}ut.LocalCompDetailByPathHashDTO=LocalCompDetailByPathHashDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件完整文件路径hash",example:"1234567890"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],LocalCompDetailByPathHashDTO.prototype,"fullPathHash",void 0);class CompWriteFileDTO{}ut.CompWriteFileDTO=CompWriteFileDTO;dt([(0,_t.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompWriteFileDTO.prototype,"compPath",void 0);dt([(0,_t.ApiProperty)({required:true,description:"文件名",example:ht.KEYS.COMP_SCREENSHOT_MINI_FILENAME}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompWriteFileDTO.prototype,"filename",void 0);dt([(0,_t.ApiProperty)({required:true,description:"文件内容(base64,不含前缀)",example:"iVBORw0KGgo..."}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],CompWriteFileDTO.prototype,"content",void 0)},19428:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.PreBuildDTO=void 0;const _t=pt(49179);const mt=pt(99375);class PreBuildDTO{}ut.PreBuildDTO=PreBuildDTO;dt([(0,_t.ApiProperty)({type:[String],required:true,description:"组件依赖",example:["axios","md5"]}),(0,mt.Rule)(mt.RuleType.array().required().items(mt.RuleType.string())),ft("design:type",Array)],PreBuildDTO.prototype,"deps",void 0)},56415:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SignedUrlDTO=void 0;const _t=pt(49179);const mt=pt(99375);class SignedUrlDTO{}ut.SignedUrlDTO=SignedUrlDTO;dt([(0,mt.Rule)(mt.RuleType.string().required().error(new Error("对象id不能为空"))),(0,_t.ApiProperty)({example:"",description:"对象id",required:true}),ft("design:type",String)],SignedUrlDTO.prototype,"objectId",void 0)},90218:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.PreprocessingDTO=void 0;const _t=pt(49179);const mt=pt(99375);const ht=pt(34985);class PreprocessingDTO{}ut.PreprocessingDTO=PreprocessingDTO;dt([(0,_t.ApiProperty)({description:"css代码",required:true,example:"body { color: red; }"}),(0,mt.Rule)(mt.RuleType.string().required()),ft("design:type",String)],PreprocessingDTO.prototype,"cssCode",void 0);dt([(0,_t.ApiProperty)({enum:ht.PrecompilerEnum,example:ht.PrecompilerEnum.SASS,description:"预编译器类型",required:false}),(0,mt.Rule)(mt.RuleType.string().valid(...Object.values(ht.PrecompilerEnum))),ft("design:type",String)],PreprocessingDTO.prototype,"precompilerType",void 0)},23444:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.VueFinderIndexDTO=void 0;const _t=pt(49179);const mt=pt(99375);class VueFinderIndexDTO{}ut.VueFinderIndexDTO=VueFinderIndexDTO;dt([(0,_t.ApiProperty)({required:false,description:"文件路径"}),(0,mt.Rule)(mt.RuleType.string()),ft("design:type",String)],VueFinderIndexDTO.prototype,"path",void 0)},59416:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.BadRequestErrorFilter=void 0;const ft=pt(46123);const _t=pt(93597);const mt=pt(60449);let ht=class BadRequestErrorFilter{async catch(ct,ut){const pt=ut.app.getEnv();if(pt===mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ut.logger.error("BadRequestErrorFilter==>",ct)}return _t.resUtil.error(ct.message,ct.status)}};ut.BadRequestErrorFilter=ht;ut.BadRequestErrorFilter=ht=dt([(0,ft.Catch)(ft.httpError.BadRequestError)],ht)},54633:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.DefaultErrorFilter=void 0;const ft=pt(46123);const _t=pt(60449);let mt=class DefaultErrorFilter{async catch(ct,ut){const pt=ut.app.getEnv();try{const ut=JSON.parse(ct.message);return{...ut}}catch(ct){if(pt===_t.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ut.logger.error("解析错误信息失败==>",ct.message,"\n")}}finally{if(pt===_t.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ut.logger.error("原始错误==>",ct)}}ut.status=ct.status??500;return{code:ct.status??500,message:ct.message??"未知错误"}}};ut.DefaultErrorFilter=mt;ut.DefaultErrorFilter=mt=dt([(0,ft.Catch)()],mt)},15545:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=void 0;var _t=pt(12799);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.MainConfiguration}});ft(pt(14071),ut);ft(pt(91921),ut);ft(pt(64754),ut);ft(pt(17076),ut);ft(pt(78805),ut);ft(pt(91308),ut);ft(pt(5387),ut);ft(pt(6444),ut);ft(pt(20346),ut);ft(pt(60149),ut);ft(pt(8131),ut);ft(pt(19428),ut);ft(pt(56415),ut);ft(pt(34985),ut);ft(pt(90218),ut);ft(pt(23444),ut);ft(pt(59416),ut);ft(pt(54633),ut);ft(pt(9711),ut);ft(pt(53951),ut);ft(pt(77523),ut);ft(pt(61142),ut);ft(pt(19465),ut);ft(pt(95637),ut);ft(pt(48795),ut);ft(pt(63366),ut);ft(pt(23086),ut);ft(pt(85984),ut);ft(pt(80799),ut);ft(pt(5578),ut);ft(pt(61275),ut);ft(pt(19452),ut);ft(pt(5808),ut);ft(pt(66593),ut);ft(pt(58953),ut);ft(pt(10778),ut);ft(pt(101),ut);ft(pt(71692),ut);ft(pt(75049),ut);ft(pt(18922),ut)},9711:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},53951:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},34985:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.PrecompilerEnum=void 0;var pt;(function(ct){ct["LESS"]="less";ct["SASS"]="sass";ct["SCSS"]="scss"})(pt||(ut.PrecompilerEnum=pt={}))},77523:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},61142:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.ReportMiddleware=void 0;const ft=pt(46123);let _t=class ReportMiddleware{resolve(){return async(ct,ut)=>{const pt=Date.now();const dt=await ut();const ft=ct.url;ct.logger.debug(`请求 ${ft} 耗时 = ${Date.now()-pt}ms`);return dt}}static getName(){return"report"}};ut.ReportMiddleware=_t;ut.ReportMiddleware=_t=dt([(0,ft.Middleware)()],_t)},19465:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.TokenMiddleware=void 0;const ft=pt(46123);const _t=pt(10778);let mt=class TokenMiddleware{resolve(){return async(ct,ut)=>{(0,_t.setHeader)(ct.header);await ut()}}static getName(){return"token"}};ut.TokenMiddleware=mt;ut.TokenMiddleware=mt=dt([(0,ft.Middleware)()],mt)},95637:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.CommandService=void 0;const mt=pt(46123);const ht=_t(pt(79896));const yt=pt(63366);const vt=pt(94798);const St=_t(pt(16928));const bt=pt(68255);let xt=class CommandService{async revealInVSCode(ct,ut,pt=1,dt=1){const{cwd:ft}=this.configService.comphubConfig();if(!ct||!ht.default.existsSync(ct)||!ht.default.statSync(ct).isDirectory()){throw new mt.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist"))}const _t=St.default.resolve(ct,ut);if(!ht.default.existsSync(_t)||ht.default.statSync(_t).isDirectory()){throw new mt.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist"))}(0,vt.launchIDE)({file:ft});(0,vt.launchIDE)({file:_t,line:pt,column:dt})}};ut.CommandService=xt;dt([(0,mt.Inject)(),ft("design:type",yt.ConfigService)],xt.prototype,"configService",void 0);dt([(0,mt.Inject)(),ft("design:type",Object)],xt.prototype,"ctx",void 0);dt([(0,mt.Inject)(),ft("design:type",bt.MidwayI18nService)],xt.prototype,"i18nService",void 0);ut.CommandService=xt=dt([(0,mt.Provide)()],xt)},48795:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.CompService=void 0;const yt=pt(46123);const vt=mt(pt(16928));const St=mt(pt(79896));const bt=pt(63366);const xt=pt(23086);const $t=pt(80799);const Et=mt(pt(70857));const Ct=mt(pt(83929));const Tt=pt(39538);const wt=pt(84464);const At=pt(95637);const kt=pt(60449);const It=pt(21739);const Nt=pt(6586);const Pt=pt(68255);let Ot=class CompService{getCompFullPath(ct){const{srcPath:ut}=this.configService.comphubConfig();ct=ct.replace(kt.KEYS.FILE_MANAGER_DIRNAME,"");const pt=vt.join(ut,ct);return pt}checkCompEntryIndex(ct){const ut=vt.join(ct,kt.KEYS.COMP_USE_ENTRY_FILE);if(!St.existsSync(ut)){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[kt.KEYS.COMP_USE_ENTRY_FILE]}))}}checkCompJson(ct){const ut=this.getCompFullPath(ct);const pt=vt.join(ut,kt.KEYS.COMP_CONFIG_FILENAME);if(!St.existsSync(pt)){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.configFileNotExist"))}}checkCompJsonFormat(ct){const ut=Object.keys(ct);const pt=kt.ARRAY.COMP_DEFAULT_FIELD.every((ct=>!ct.required||ut.includes(ct.name)));if(!pt)return false;return It.versionKit.validateVersion(ct.version)}async updateCompJson(ct,ut){const pt=this.getCompFullPath(ct);const dt=vt.join(pt,kt.KEYS.COMP_CONFIG_FILENAME);const ft=await this.getCompFile(dt);const _t=ut(JSON.parse(ft));await St.promises.writeFile(dt,JSON.stringify(_t,null,4))}async readCompVersion(ct){const ut=vt.join(ct,kt.KEYS.COMP_CONFIG_FILENAME);const pt=await this.getCompFile(ut);const dt=JSON.parse(pt);return dt.version}initCompJson(){return kt.ARRAY.COMP_DEFAULT_FIELD.reduce(((ct,ut)=>{const pt={};if(ut.required){pt[ut.name]=ut.default}return{...ct,...pt}}),{})}async uploadCompFolderToOss({compFullPath:ct,version:ut,ossData:pt}){const{files:dt}=await Tt.fileTree.generateTree(ct);const ft=dt.map((({absolutePath:ut,size:pt})=>{const dt=ut.replace(ct,"");return{filePath:dt,fileFullPath:ut,size:pt??0}}));ft.sort(((ct,ut)=>ut.size-ct.size));for(let ct=0;ct<ft.length;ct++){const{filePath:dt,fileFullPath:_t}=ft[ct];const mt=vt.join(pt.key,ut,dt);const ht={...pt,key:mt.replace(new RegExp(It.textKit.escapeRegExp(vt.sep),"g"),"/")};const yt=St.createReadStream(_t);await this.ossService.uploadFileToOss(ht,yt)}}async getCompHash(ct){const ut=await Tt.digest.getFileHashList(ct);const pt=ut.map((ct=>`${ct.relativePath}-${ct.hash}`)).join(";");return Tt.digest.getStringHash(pt)}async getCompFeatures(ct){const ut=await Tt.digest.getFileHashAndSsdeepList(ct);const pt=ut.map((ct=>{const ut=(0,wt.omit)(ct,["relativePath"]);return{...ut,path:ct.relativePath}}));const dt=await Tt.digest.getRelativeDirList(ct);const ft=JSON.stringify(dt);const _t=Tt.digest.getStringFuzzyHash(ft);const mt=await this.getCompHash(ct);return{fileHashList:pt,compHash:mt,dirHash:Tt.digest.getStringHash(ft),dirSsdeep:Tt.digest.getSsdeepStruct(_t)}}async getCompFileList(ct){const{files:ut}=await Tt.fileTree.generateTree(ct,{withStats:true,calculateSize:true});const pt=ut.map((({name:ut,size:pt,absolutePath:dt})=>({name:ut,size:pt??0,path:dt.replace(ct,"").replace(new RegExp(It.textKit.escapeRegExp(vt.sep),"g"),"/")})));return pt}checkCompFileSize(ct){if(ct>kt.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSizeExceeded",{args:[Math.floor(kt.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE/1024/1024).toString()]}))}}checkCompFileNum(ct){if(ct>kt.KEYS.COMP_SUBMIT_MAX_FILE_COUNT){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitFileCountExceeded",{args:[kt.KEYS.COMP_SUBMIT_MAX_FILE_COUNT.toString()]}))}}checkCompSingleFileSize(ct){const ut=kt.KEYS.COMP_SUBMIT_MAX_SINGLE_FILE_SIZE;const pt=Math.floor(ut/1024/1024);for(const dt of ct){if(dt.size>ut){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSingleFileSizeExceeded",{args:[dt.path,pt.toString()]}))}}}async findCompJsonPath(ct){const{files:ut}=await Tt.fileTree.generateTree(ct,{ignore:["node_modules"]});this.ctx.logger.debug("项目文件数量:",ut.length);const pt=ut.filter((({absolutePath:ct})=>ct.endsWith(kt.KEYS.COMP_CONFIG_FILENAME)));return pt}async getAllLocalCompIds(){const{srcPath:ct}=this.configService.comphubConfig();const ut=await this.findCompJsonPath(ct);this.ctx.logger.debug("组件文件数量:",ut.length);const pt=ut.map((async({absolutePath:ct})=>{const ut=await St.promises.readFile(ct,"utf8");const pt=JSON.parse(ut);const dt=this.checkCompJsonFormat(pt);const ft=vt.dirname(ct);return{compjson:pt,isCompHub:dt,compPath:ft,pathHash:Tt.digest.getStringHash(ft)}}));const dt=await Promise.all(pt);return dt.filter((ct=>ct.isCompHub&&ct.compjson.__id__))}async getCompDir(ct){const{srcPath:ut}=this.configService.comphubConfig();const pt=vt.join(ct.replace(kt.KEYS.FILE_MANAGER_DIRNAME,`${ut}${vt.sep}`));const{tree:dt,files:ft}=await Tt.fileTree.generateTree(pt,{sortBy:"type"});const _handleTree=ct=>{const ut={name:ct.name,path:ct.absolutePath,type:ct.type};if(ct.children&&ct.children.length>0){ut.children=ct.children.map((ct=>_handleTree(ct)))}return ut};return{tree:_handleTree(dt),files:ft.map((ct=>ct.absolutePath))}}async getCompFile(ct){const ut=await St.promises.readFile(ct,"utf-8");return ut}async checkCompConfig(ct){const ut=vt.basename(ct);const pt=this.getCompFullPath(ct);try{this.checkCompEntryIndex(pt)}catch(ct){this.ctx.logger.error("检查组件入口文件index.vue失败",ct);return{errorMsg:"组件入口文件index.vue不存在"}}const dt=vt.join(ut,kt.KEYS.COMP_USE_ENTRY_FILE);try{this.checkCompJson(ct)}catch(ct){this.ctx.logger.error("检查组件配置文件comp.json失败",ct);return{entryIndexPath:dt,errorMsg:"组件配置文件comp.json不存在"}}const ft=vt.join(ut,kt.KEYS.COMP_CONFIG_FILENAME);try{const ut=vt.join(this.getCompFullPath(ct),kt.KEYS.COMP_CONFIG_FILENAME);const pt=await this.getCompFile(ut);const _t=this.checkCompJsonFormat(JSON.parse(pt));if(!_t){return{entryIndexPath:dt,compJsonPath:ft,errorMsg:"comp.json文件格式错误"}}}catch(ct){this.ctx.logger.error("读取组件配置文件comp.json失败",ct);return{entryIndexPath:dt,compJsonPath:ft,errorMsg:"读取comp.json文件失败"}}return{entryIndexPath:dt,compJsonPath:ft,errorMsg:""}}async updateCompVersion(ct,ut){const pt=It.versionKit.validateVersion(ut);if(!pt){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidVersionFormat"))}const dt=this.getCompFullPath(ct);const ft=vt.join(dt,kt.KEYS.COMP_CONFIG_FILENAME);const _t=await this.getCompFile(ft);const mt=JSON.parse(_t);mt.version=ut;const ht=JSON.stringify(mt,null,2);await St.promises.writeFile(ft,ht)}async generateCompJson(ct){const ut=this.getCompFullPath(ct);const pt=vt.basename(ut);const dt=this.initCompJson();dt.name=pt;await St.promises.writeFile(vt.join(ut,kt.KEYS.COMP_CONFIG_FILENAME),JSON.stringify(dt,null,4))}async getCompDep(ct){const{cwd:ut}=this.configService.comphubConfig();const pt=this.getCompFullPath(ct);const dt=await this.depsService.getModuleEntry(pt,ut);return dt}async getCompFileHash(ct){const{compPath:ut}=ct;const pt=this.getCompFullPath(ut);const dt=await this.getCompFeatures(pt);return{compHash:dt.compHash}}async checkCompRepeat(ct){const{compPath:ut,teamId:pt}=ct;const dt=this.getCompFullPath(ut);const ft=await this.getCompFeatures(dt);const _t=await Nt.remoteApi.v1Comp.compcontrollerCheckcompexistbyhash(ft,{headers:{"team-id":pt}});return _t.data}async submitComp(ct){let ut="";let pt={};try{const{compPath:dt,dep:ft,previewConfigs:_t,desc:mt,bgColor:ht,name:yt,teamId:vt,tags:St}=ct;pt={"team-id":vt};this.checkCompJson(dt);const bt=this.getCompFullPath(dt);const xt=await this.getCompFeatures(bt);this.checkCompEntryIndex(bt);const $t=await this.readCompVersion(bt);const Et=await this.getCompFileList(bt);const Ct=Et.reduce(((ct,ut)=>ct+ut.size),0);this.checkCompFileNum(Et.length);this.checkCompFileSize(Ct);this.checkCompSingleFileSize(Et);const Tt={name:yt,dep:ft,previewConfigs:_t,desc:mt,version:$t,size:Ct,files:Et,bgColor:ht,compFeatures:xt,tags:St};const wt=await Nt.remoteApi.v1Comp.compcontrollerUpload(Tt,{headers:pt});const At=wt.data._id;ut=At;await this.updateCompJson(dt,(ct=>({...ct,name:yt,__id__:At})));const{data:{componentDir:kt}}=await Nt.remoteApi.v1Oss.osscontrollerCompossdir();const It=await Nt.remoteApi.v1Oss.osscontrollerPutpolicy({type:kt});const Pt={compFullPath:bt,version:$t,ossData:It.data};await this.uploadCompFolderToOss(Pt);const{key:Ot}=It.data;const Dt={compId:At,objectId:`${kt}${Ot}`};await Nt.remoteApi.v1Comp.compcontrollerUpdateobjectid(Dt)}catch(ct){if(ut){await Nt.remoteApi.v1Comp.compcontrollerDeletefailedcomp({compId:ut},{headers:pt})}if(ct instanceof yt.httpError.BadRequestError){throw new yt.httpError.BadRequestError(ct)}throw new Error(ct.message)}}async updateComp(ct){const{compId:ut,compPath:pt,dep:dt,previewConfigs:ft,desc:_t,bgColor:mt,name:ht,upgradeDesc:yt,teamId:bt,tags:xt}=ct;const $t=this.getCompFullPath(pt);const Et=await this.getCompFeatures($t);this.checkCompEntryIndex($t);const Ct=await Nt.remoteApi.v1Comp.compcontrollerCompdetail({compId:ut});const{objectId:Tt,version:wt}=Ct.data;const At=await this.readCompVersion($t);const It=await this.getCompFileList($t);const Pt=It.reduce(((ct,ut)=>ct+ut.size),0);this.checkCompFileNum(It.length);this.checkCompFileSize(Pt);this.checkCompSingleFileSize(It);const Ot={compId:ut,name:ht,dep:dt,previewConfigs:ft,desc:_t,version:At,size:Pt,files:It,bgColor:mt,compFeatures:Et,upgradeDesc:yt,tags:xt};const Dt=await Nt.remoteApi.v1Comp.compcontrollerUpdate(Ot,{headers:{"team-id":bt}});const{isFileChange:Ft}=Dt.data;if(!Ft&&wt===At){const ct=vt.join($t,kt.KEYS.COMP_SCREENSHOT_MINI_FILENAME);if(St.existsSync(ct)){const ut=await Nt.remoteApi.v1Oss.osscontrollerCompossdir();const pt=await Nt.remoteApi.v1Oss.osscontrollerPutpolicy({type:ut.data.componentDir});const dt=Tt.replace(pt.data.dir,"");const ft=vt.join(dt,At,kt.KEYS.COMP_SCREENSHOT_MINI_FILENAME).replace(/\\/g,"/");const _t=St.createReadStream(ct);const mt={...pt.data,key:ft};await this.ossService.uploadFileToOss(mt,_t,true)}return}const Mt=await Nt.remoteApi.v1Oss.osscontrollerCompossdir();const{componentDir:Rt}=Mt.data;const Lt=await Nt.remoteApi.v1Oss.osscontrollerPutpolicy({type:Rt});const Bt=Tt.replace(Lt.data.dir,"");const Vt={...Lt.data,key:Bt};const jt={compFullPath:$t,version:At,ossData:Vt};await this.uploadCompFolderToOss(jt);await this.updateCompJson(pt,(ct=>({...ct,name:ht,__id__:ut})))}async downloadComp(ct){const{compId:ut,savePath:pt,isCover:dt,compName:ft,version:_t}=ct;const{srcPath:mt}=this.configService.comphubConfig();const ht=kt.KEYS.FILE_MANAGER_DIRNAME;const bt=pt.replace(ht,"").replace(/[/\\]/g,vt.sep);const xt=vt.join(mt,bt,ft);if(!dt&&St.existsSync(xt)){return{isRepeat:true}}const $t=Et.tmpdir();const wt=vt.join($t,kt.KEYS.COMP_TEMP_DIR);this.ctx.logger.debug("组件下载到临时目录",wt);const At=await Nt.remoteApi.v1Comp.compcontrollerCompdetail({compId:ut,version:_t});if(!At?.data){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compNotExist"))}const{files:It,objectId:Pt,name:Ot}=At.data;let Dt=[];const Ft=vt.join(wt,Pt,_t);if(St.existsSync(Ft)){const{files:ct}=await Tt.fileTree.generateTree(Ft);Dt=ct}await Nt.remoteApi.v1Comp.compcontrollerUpdatecompdownloadcount({compId:ut,version:_t});if(It.length===Dt.length){const ct=Dt.find((({absolutePath:ct})=>ct.replace(Ft,"").startsWith(`${vt.sep}${kt.KEYS.COMP_CONFIG_FILENAME}`)));if(ct){const ut=await St.promises.readFile(ct.absolutePath,"utf8");const pt=JSON.parse(ut);const{name:dt}=pt;if(Ot===dt){await Ct.copy(Ft,xt);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接使用缓存文件");return}}}const Mt=It.map((ct=>{const ut=vt.join(Pt,_t,ct.path);return{path:ut.replace(/[/\\]/g,"/")}}));const Rt=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath(Rt,Mt,wt);const Lt=vt.join(wt,Pt,_t);await Ct.copy(Lt,xt)}async getLocalCompsByIds(ct){const{srcPath:ut}=this.configService.comphubConfig();const pt=await this.findCompJsonPath(ut);this.ctx.logger.debug("组件文件数量:",pt.length);const dt=pt.map((async({absolutePath:ct})=>{const ut=await St.promises.readFile(ct,"utf8");const pt=JSON.parse(ut);return{...pt,path:vt.dirname(ct)}}));const ft=await Promise.all(dt);const _t=ft.filter((ut=>ct.includes(ut.__id__)));if(!_t){return[]}const mt=kt.KEYS.FILE_MANAGER_DIRNAME;const ht=new RegExp(It.textKit.escapeRegExp(vt.sep),"g");const yt=_t.map((ct=>{const pt=ct.path.replace(ut,"").replace(ht,"/").slice(1);return{id:ct.__id__,path:mt+pt,fullPath:ct.path,fullPathHash:Tt.digest.getStringHash(ct.path),basename:vt.basename(ct.path)}}));return yt}async getCompFilesOssSignedUrl(ct){const{version:ut,objectId:pt,files:dt}=ct;const ft=await this.ossService.getDownloadSts();const _t=dt.map((async ct=>{const dt=vt.join(pt,ut,ct);const _t=await this.ossService.getFilePreviewUrl(ft,dt.replace(/[/\\]/g,"/"));return{path:ct,signedUrl:_t}}));const mt=await Promise.all(_t);return{signedUrls:mt}}async getPackageJsonContent(){const ct=this.configService.comphubConfig();const ut=vt.join(ct.cwd,"package.json");return await Tt.fileSys.readJsonFile(ut)}async getLocalComps(ct){const{page:ut=1,pageSize:pt=10}=ct;const{srcPath:dt}=this.configService.comphubConfig();const ft=await this.getAllLocalCompIds();const _t=ft.map((ct=>({id:ct.compjson.__id__,pathHash:ct.pathHash})));_t.sort(((ct,ut)=>ct.id.localeCompare(ut.id)));const mt=[...new Set(_t.map((ct=>ct.id)))];const ht=await Nt.remoteApi.v1Comp.compcontrollerExistcompsbyids({compIds:mt});const{ids:St=[]}=ht.data;const bt=_t.filter((ct=>St.includes(ct.id)));const xt=bt.length;const $t=bt.slice((ut-1)*pt,ut*pt);const Et=new Map(ft.map((ct=>[`${ct.compjson.__id__}_${ct.pathHash}`,ct])));const Ct=await Nt.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:$t.map((ct=>ct.id))});const{rows:wt=[]}=Ct.data;const At=new Map(wt.map((ct=>[ct._id,ct])));const Pt=new RegExp(It.textKit.escapeRegExp(vt.sep),"g");const Ot=kt.KEYS.FILE_MANAGER_DIRNAME;const Dt=$t.map((async({id:ct,pathHash:ut})=>{const pt=Et.get(`${ct}_${ut}`);const ft=At.get(ct);if(!ft||!pt){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithIdNotExist",{args:[ct]}))}const _t=pt.compPath.replace(dt,"").replace(Pt,"/").slice(1);return{_id:Tt.digest.getStringHash(pt.compPath),name:ft.name,compId:ct,version:pt.compjson.version,path:Ot+_t,previewConfigs:ft.previewConfigs,bgColor:ft.bgColor,fullPath:pt.compPath}}));const Ft=await Promise.all(Dt);return{total:xt,page:ut,pageSize:pt,rows:Ft}}async getLocalCompDetailByPathHash(ct){const{fullPathHash:ut}=ct;const pt=await this.getAllLocalCompIds();const dt=pt.find((ct=>ct.pathHash===ut));if(!dt){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithPathNotExist",{args:[ut]}))}const{srcPath:ft}=this.configService.comphubConfig();const{__id__:_t,version:mt}=dt.compjson;const ht=await Nt.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:[_t]});const{rows:St=[]}=ht.data;const bt=St[0];const xt=new RegExp(It.textKit.escapeRegExp(vt.sep),"g");const $t=kt.KEYS.FILE_MANAGER_DIRNAME;const Et=dt.compPath.replace(ft,"").replace(xt,"/").slice(1);return{_id:ut,name:bt.name,compId:_t,version:mt,path:$t+Et,previewConfigs:bt.previewConfigs,bgColor:bt.bgColor,fullPath:dt.compPath}}async openCompPathInVscode(ct){const{folderPath:ut,relativeFilePath:pt}=ct;await this.commandService.revealInVSCode(ut,pt)}async writeCompFile(ct){const{compPath:ut,filename:pt,content:dt}=ct;const ft=this.getCompFullPath(ut);const _t=vt.join(ft,pt);St.writeFileSync(_t,Buffer.from(dt,"base64"))}};ut.CompService=Ot;_t([(0,yt.App)(),ht("design:type",Object)],Ot.prototype,"app",void 0);_t([(0,yt.Inject)(),ht("design:type",bt.ConfigService)],Ot.prototype,"configService",void 0);_t([(0,yt.Inject)(),ht("design:type",$t.OssService)],Ot.prototype,"ossService",void 0);_t([(0,yt.Inject)(),ht("design:type",At.CommandService)],Ot.prototype,"commandService",void 0);_t([(0,yt.Inject)(),ht("design:type",xt.DepsService)],Ot.prototype,"depsService",void 0);_t([(0,yt.Inject)(),ht("design:type",Object)],Ot.prototype,"ctx",void 0);_t([(0,yt.Inject)(),ht("design:type",Pt.MidwayI18nService)],Ot.prototype,"i18nService",void 0);ut.CompService=Ot=_t([(0,yt.Provide)()],Ot)},63366:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.ConfigService=void 0;const yt=pt(46123);const vt=pt(60449);const St=mt(pt(16928));let bt=class ConfigService{comphubConfig(){const ct=this.app.getAttr(vt.KEYS.COMPHUB_CONFIG_KEY);return ct}getGlobalConfig(){const ct=this.comphubConfig();const{cwd:ut,srcPath:pt,version:dt,allowDebug:ft,subPort:_t,projectHash:mt}=ct;return{cwd:ut,srcPath:pt,sep:St.sep,version:dt,allowDebug:ft,subPort:_t,projectHash:mt}}};ut.ConfigService=bt;_t([(0,yt.App)(),ht("design:type",Object)],bt.prototype,"app",void 0);ut.ConfigService=bt=_t([(0,yt.Provide)()],bt)},23086:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.DepsService=void 0;const yt=pt(46123);const vt=mt(pt(16928));const St=mt(pt(79896));const bt=pt(64713);const xt=pt(39538);const $t=pt(60449);const Et=pt(63366);const Ct=pt(58953);let Tt=class DepsService{async getModuleEntry(ct,ut){const pt=await xt.fileSys.readJsonFile(vt.join(ut,"package.json"));if(!pt){console.error("未找到 package.json 文件");return[]}const dt=xt.resolver.findDependencyVersion(pt,"vue");const ft=await xt.depGraph.detectImports(ct,{pathAliases:["@"]});ft.vue={version:dt};const _t={};for(const[ct]of Object.entries(ft)){const dt=xt.resolver.findDependencyVersion(pt,ct);const ft={version:dt};const mt=await xt.resolver.findOwningPackage(ct,ut);if(mt){ft.version=mt.version;if(!dt){ft.parent={name:mt.name,version:mt.version}}}_t[ct]=ft}return Object.entries(_t).map((([ct,ut])=>({name:ct,version:ut.version,...ut.parent&&{parent:ut.parent}})))}async precompileModule(ct,ut,pt){const dt=await xt.fileSys.readJsonFile(vt.join(pt,"package.json"));if(!dt){console.error("未找到 package.json 文件");return{entryNameToFile:{}}}const{entryPoints:ft,skippedModules:_t}=(0,Ct.buildEntryPoints)(ut,dt,pt);await St.promises.mkdir(ct,{recursive:true});const mt={};for(const[ct,ut]of Object.entries(ft)){if(xt.resolver.isModuleInstalled(ct,pt)){mt[ct]=ut}}const ht={};for(const ct of _t){ht[ct]=ct}const yt=vt.join(ct,$t.KEYS.META_FILE_NAME);const Et=await xt.fileSys.readJsonFile(yt);const{filteredEntryPoints:Tt,cachedMappings:wt}=(0,Ct.filterCachedModules)(mt,Et);Object.assign(ht,wt);if(Object.keys(Tt).length===0){return{entryNameToFile:ht}}const At={entryPoints:Tt,bundle:true,format:"esm",splitting:true,outdir:ct,entryNames:"[name]-[hash]",chunkNames:"chunk-[hash]",outExtension:{".js":".js"},metafile:true,write:true,target:"esnext",sourcemap:false,external:["vue"],absWorkingDir:pt,nodePaths:[vt.join(pt,"node_modules")]};const kt=await(0,bt.build)(At);const{optimized:It,entryNameToFile:Nt}=(0,Ct.analyzeBuildOutputs)(kt,Tt,ct);const Pt={...Et,...It};await(0,Ct.saveBuildMetadata)(yt,Pt);return{entryNameToFile:{...ht,...Nt}}}};ut.DepsService=Tt;_t([(0,yt.App)(),ht("design:type",Object)],Tt.prototype,"app",void 0);_t([(0,yt.Inject)(),ht("design:type",Et.ConfigService)],Tt.prototype,"configService",void 0);ut.DepsService=Tt=_t([(0,yt.Provide)()],Tt)},85984:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.ModuleService=void 0;const yt=pt(46123);const vt=pt(63366);const St=pt(23086);const bt=mt(pt(16928));const xt=pt(39538);const $t=mt(pt(79896));const Et=pt(60449);let Ct=class ModuleService{async getPreBuildModuleDir(){const{cwd:ct}=this.configService.comphubConfig();const ut=bt.join(ct,Et.KEYS.PREBUILD_MODULE_DIR);await $t.promises.mkdir(ut,{recursive:true});return ut}async preBuild(ct){const ut=await this.getPreBuildModuleDir();const{cwd:pt}=this.configService.comphubConfig();return await this.depsService.precompileModule(ut,ct,pt)}async preBuildSize(){const ct=await this.getPreBuildModuleDir();return await xt.fileSys.dirSize(ct)}async clearPreBuild(){const ct=await this.getPreBuildModuleDir();await $t.promises.rm(ct,{recursive:true,force:true})}};ut.ModuleService=Ct;_t([(0,yt.Inject)(),ht("design:type",vt.ConfigService)],Ct.prototype,"configService",void 0);_t([(0,yt.Inject)(),ht("design:type",St.DepsService)],Ct.prototype,"depsService",void 0);_t([(0,yt.App)(),ht("design:type",Object)],Ct.prototype,"app",void 0);ut.ModuleService=Ct=_t([(0,yt.Provide)()],Ct)},80799:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var yt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.OssService=void 0;const vt=pt(46123);const St=yt(pt(51515));const bt=yt(pt(12593));const xt=yt(pt(18451));const $t=mt(pt(16928));const Et=mt(pt(79896));const Ct=pt(96955);const Tt=pt(6586);const wt=yt(pt(26506));const At=yt(pt(23046));const kt=pt(45853);const It=pt(60449);const Nt=pt(68255);let Pt=class OssService{createOssClient(ct){const ut={endpoint:It.KEYS.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...ct};return new xt.default(ut)}getContentTypeWithCharset(ct){const ut=$t.extname(ct).toLowerCase();const pt={".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 pt[ut]}createOssFormData(ct,ut,pt=false){const dt=new St.default;const ft=ct.dir+ct.key;dt.append("success_action_status","200");dt.append("policy",ct.policy);dt.append("x-oss-signature",ct.signature);dt.append("x-oss-signature-version",ct.x_oss_signature_version);dt.append("x-oss-credential",ct.x_oss_credential);dt.append("x-oss-date",ct.x_oss_date);dt.append("key",ft);dt.append("x-oss-security-token",ct.security_token);dt.append("x-oss-forbid-overwrite",pt?"false":"true");dt.append("Cache-Control","public, max-age=31536000");const _t={};const mt=ut.path?.toString();if(mt){const ct=this.getContentTypeWithCharset(mt);if(ct){_t.contentType=ct}}dt.append("file",ut,_t);return{host:ct.host,filePath:ft,formData:dt}}async getDownloadSts(){const ct=await this.cache.get(It.KEYS.CACHE_KEY_STS_TOKEN);if(ct){return ct}const ut=await Tt.remoteApi.v1Oss.osscontrollerGetsts();const pt=new Date(ut.data.Expiration).getTime()-1*60*1e3;await this.cache.set(It.KEYS.CACHE_KEY_STS_EXPIRE_TIME,pt);const dt=pt-Date.now();this.ctx.logger.debug("STS过期时间",(0,At.default)(pt).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(It.KEYS.CACHE_KEY_STS_TOKEN,ut.data,dt);return ut.data}async uploadFileToOss(ct,ut,pt=false){const{host:dt,formData:ft}=this.createOssFormData(ct,ut,pt);const _t=await bt.default.post(dt,ft,{headers:{...ft.getHeaders()}}).catch((async ct=>{const ut=ct.response.data;const pt=await(0,kt.parseStringPromise)(ut);if(pt?.Error){throw new vt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[pt.Error.Message]}))}throw new vt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[ct.message||ct]}))}));if(_t.status!==200){throw new vt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[_t.data]}))}}async downloadFileToPath(ct,ut,pt){const dt=this.createOssClient({region:ct.region,accessKeyId:ct.AccessKeyId,accessKeySecret:ct.AccessKeySecret,stsToken:ct.SecurityToken,bucket:ct.bucket,refreshSTSToken:async()=>{const ct=await this.getDownloadSts();return{accessKeyId:ct.AccessKeyId,accessKeySecret:ct.AccessKeySecret,stsToken:ct.SecurityToken}}});const ft=ut.map((async ct=>{const{path:ut}=ct;const ft=$t.join(pt,ut);const _t=$t.dirname(ft);if(!Et.existsSync(_t)){Et.mkdirSync(_t,{recursive:true})}return await dt.get(ut,ft)}));return await Promise.all(ft)}async getFilePreviewUrl(ct,ut){const pt=(0,wt.default)(ut);const dt=await this.cache.get(It.KEYS.CACHE_KEY_STS_EXPIRE_TIME);const ft=await this.cache.get(pt);const _t=Math.floor((Number(dt)-Date.now())/1e3);this.ctx.logger.debug("文件地址过期时间:",_t,"秒",Math.floor(_t/60),"分钟");if(ft&&_t>0){return ft}const mt=this.createOssClient({region:ct.region,accessKeyId:ct.AccessKeyId,accessKeySecret:ct.AccessKeySecret,stsToken:ct.SecurityToken,bucket:ct.bucket,refreshSTSToken:async()=>{const ct=await this.getDownloadSts();return{accessKeyId:ct.AccessKeyId,accessKeySecret:ct.AccessKeySecret,stsToken:ct.SecurityToken}}});this.ctx.logger.debug("文件地址过期时间:",_t,"秒",Math.floor(_t/60),"分钟");const ht=mt.signatureUrl(ut,{expires:_t});await this.cache.set(pt,ht,_t*1e3);this.ctx.logger.debug("缓存预览URL",ut);return ht}};ut.OssService=Pt;_t([(0,vt.Inject)(),ht("design:type",Object)],Pt.prototype,"ctx",void 0);_t([(0,vt.InjectClient)(Ct.CachingFactory,"default"),ht("design:type",Object)],Pt.prototype,"cache",void 0);_t([(0,vt.Inject)(),ht("design:type",Nt.MidwayI18nService)],Pt.prototype,"i18nService",void 0);ut.OssService=Pt=_t([(0,vt.Provide)()],Pt)},5578:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.PreprocessingService=void 0;const _t=pt(46123);const mt=pt(34985);const ht=pt(71015);const yt=ft(pt(60505));let vt=class PreprocessingService{async preprocessCode(ct){const{cssCode:ut,precompilerType:pt}=ct;if(pt===mt.PrecompilerEnum.SASS||pt===mt.PrecompilerEnum.SCSS){const ct=(0,ht.compileString)(ut);return ct.css}else if(pt===mt.PrecompilerEnum.LESS){const ct=await yt.default.render(ut);return ct.css}return ut}};ut.PreprocessingService=vt;ut.PreprocessingService=vt=dt([(0,_t.Provide)()],vt)},61275:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.QueueService=void 0;const ft=pt(46123);let _t=class QueueService{constructor(){this.queue=[];this.isProcessing=false}async processQueue(){if(this.isProcessing||this.queue.length===0){return}this.isProcessing=true;const ct=this.queue.shift();if(ct){await ct()}this.isProcessing=false;this.processQueue()}async enqueue(ct){return new Promise((ut=>{this.queue.push((async()=>{try{await ct()}finally{ut()}}));this.processQueue()}))}};ut.QueueService=_t;ut.QueueService=_t=dt([(0,ft.Provide)(),(0,ft.Scope)(ft.ScopeEnum.Singleton)],_t)},19452:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var yt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.TerminalService=void 0;const vt=pt(46123);const St=pt(35317);const bt=pt(63366);const xt=mt(pt(95892));const $t=pt(73024);const Et=pt(51455);const Ct=pt(39538);const Tt=yt(pt(44644));let wt=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(ct){if(!ct||ct.length===0)return"";try{new TextDecoder("utf-8",{fatal:true}).decode(ct);return xt.decode(ct,"utf-8")}catch{return xt.decode(ct,"gbk")}}async folderExists(ct){try{await(0,Et.access)(ct,$t.constants.F_OK|$t.constants.R_OK);return true}catch{return false}}async shutdown(ct=5e3){const ut=this.subprocess;if(!ut||ut.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((pt=>{let dt=false;const done=()=>{if(!dt){dt=true;pt(0)}};ut.once("exit",done);(0,Tt.default)(ut.pid,"SIGTERM",(ct=>{if(ct){this.ctx.emit("output",{err:ct.message})}}));const ft=setTimeout((()=>{(0,Tt.default)(ut.pid,"SIGKILL",(ct=>{if(ct){this.ctx.emit("output",{err:ct.message})}done()}))}),ct);ut.once("exit",(()=>clearTimeout(ft)))}))}async execCmd({cwd:ct,oldCwd:ut,command:pt}){if(!await this.folderExists(ct)){this.ctx.emit("output",{err:`${ct} 路径不存在`});this.ctx.emit("output",{cwd:ut});return}this.cwd=ct;if(!pt.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(pt==="^C"){await this.shutdown();return}this.subprocess=(0,St.spawn)(pt,{shell:true,cwd:ct,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",(ct=>{this.ctx.emit("output",{stdout:this.smartDecode(ct)})}));this.subprocess.stderr?.on("data",(ct=>{this.ctx.emit("output",{stderr:this.smartDecode(ct)})}));this.subprocess.on("close",(()=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:pt})}));this.subprocess.on("error",(ct=>{this.ctx.emit("output",{err:ct.message})}))}async cmdTab({cwd:ct,lastWord:ut}){let pt=await Ct.fileSys.readDirFiles(ct);if(ut){pt=pt.filter((ct=>ct.name.startsWith(ut)))}if(pt.length===0){return}this.tabIndex=(this.tabIndex+1)%pt.length;const dt=pt[this.tabIndex];this.ctx.emit("output",{tab:dt.name})}};ut.TerminalService=wt;_t([(0,vt.Inject)(),ht("design:type",bt.ConfigService)],wt.prototype,"configService",void 0);_t([(0,vt.Inject)(),ht("design:type",Object)],wt.prototype,"ctx",void 0);ut.TerminalService=wt=_t([(0,vt.Provide)()],wt)},5808:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var mt=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();var ht=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.VuefinderService=void 0;const yt=pt(46123);const vt=mt(pt(16928));const St=mt(pt(79896));const bt=pt(63366);const xt=mt(pt(93900));const $t=pt(60449);let Et=class VuefinderService{async list({path:ct}){const ut=this.configService.comphubConfig();const{srcPath:pt}=ut;const dt=ct?.replace($t.KEYS.FILE_MANAGER_DIRNAME,"")||"";let ft=vt.join(pt,dt);const _t=await St.promises.access(ft).then((()=>true)).catch((()=>false));if(!_t){ft=pt;ct=$t.KEYS.FILE_MANAGER_DIRNAME}const mt=await St.promises.readdir(ft);const ht=mt.map((async ut=>{const pt=vt.join(ft,ut);const dt=await St.promises.stat(pt);const _t=dt.isDirectory();const mt=ct===$t.KEYS.FILE_MANAGER_DIRNAME?`${ct}${ut}`:`${ct}/${ut}`;return{type:_t?"dir":"file",path:mt,file_size:dt.size,visibility:"public",last_modified:Math.floor(dt.mtimeMs/1e3),basename:ut,extension:_t?"":vt.extname(ut).slice(1),mime_type:xt.lookup(ut)||""}}));const yt=await Promise.all(ht);yt.sort(((ct,ut)=>{if(ct.type==="dir"&&ut.type==="file"){return-1}else if(ct.type==="file"&&ut.type==="dir"){return 1}else{return 0}}));return{storages:mt,dirname:ct,files:yt}}};ut.VuefinderService=Et;_t([(0,yt.App)(),ht("design:type",Object)],Et.prototype,"app",void 0);_t([(0,yt.Inject)(),ht("design:type",bt.ConfigService)],Et.prototype,"configService",void 0);ut.VuefinderService=Et=_t([(0,yt.Provide)()],Et)},66593:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.TerminalSocketController=void 0;const _t=pt(46123);const mt=pt(19452);let ht=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(ct){this.terminalService.execCmd(ct)}async onTab(ct){this.terminalService.cmdTab(ct)}};ut.TerminalSocketController=ht;dt([(0,_t.Inject)(),ft("design:type",Object)],ht.prototype,"ctx",void 0);dt([(0,_t.Inject)(),ft("design:type",mt.TerminalService)],ht.prototype,"terminalService",void 0);dt([(0,_t.OnWSConnection)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],ht.prototype,"onConnection",null);dt([(0,_t.OnWSDisConnection)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],ht.prototype,"onDisConnection",null);dt([(0,_t.OnWSMessage)("command"),ft("design:type",Function),ft("design:paramtypes",[Object]),ft("design:returntype",Promise)],ht.prototype,"onCommand",null);dt([(0,_t.OnWSMessage)("tab"),ft("design:type",Function),ft("design:paramtypes",[Object]),ft("design:returntype",Promise)],ht.prototype,"onTab",null);ut.TerminalSocketController=ht=dt([(0,_t.WSController)("/terminal")],ht)},58953:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__setModuleDefault||(Object.create?function(ct,ut){Object.defineProperty(ct,"default",{enumerable:true,value:ut})}:function(ct,ut){ct["default"]=ut});var _t=this&&this.__importStar||function(){var ownKeys=function(ct){ownKeys=Object.getOwnPropertyNames||function(ct){var ut=[];for(var pt in ct)if(Object.prototype.hasOwnProperty.call(ct,pt))ut[ut.length]=pt;return ut};return ownKeys(ct)};return function(ct){if(ct&&ct.__esModule)return ct;var ut={};if(ct!=null)for(var pt=ownKeys(ct),_t=0;_t<pt.length;_t++)if(pt[_t]!=="default")dt(ut,ct,pt[_t]);ft(ut,ct);return ut}}();Object.defineProperty(ut,"__esModule",{value:true});ut.analyzeBuildOutputs=analyzeBuildOutputs;ut.saveBuildMetadata=saveBuildMetadata;ut.filterCachedModules=filterCachedModules;ut.buildEntryPoints=buildEntryPoints;const mt=_t(pt(16928));const ht=_t(pt(79896));const yt=pt(39538);const vt=pt(21739);const St=pt(60449);function resolveModuleEntry(ct,ut){if(ct!=="vue")return ct;const pt=vt.versionKit.getMajorVersion(ut);return pt==="3"?St.KEYS.VUE_ESM_BUNDLER:ct}function extractModuleName(ct){const ut=ct.slice(0,-12);return mt.basename(ut)}function matchEntryKey(ct,ut){return ct.find((ct=>{const pt=ct.split("/");const dt=pt.length===1?pt[0]:pt[pt.length-1];return ut===dt}))}function analyzeBuildOutputs(ct,ut,pt){const dt={};const ft={};const _t=Object.keys(ut);const vt=ct.metafile?.outputs??{};for(const[ct,ut]of Object.entries(vt)){if(!ut.entryPoint)continue;const vt=mt.basename(ct);const St=extractModuleName(ct);const bt=matchEntryKey(_t,St);if(!bt)continue;ft[bt]=vt;const xt=mt.join(pt,vt);const $t=ht.readFileSync(xt,"utf-8");const Et=yt.digest.getStringHash($t).slice(0,8);dt[bt]={src:ut.entryPoint,file:vt,fileHash:Et,needsInterop:false}}return{optimized:dt,entryNameToFile:ft}}async function saveBuildMetadata(ct,ut){await ht.promises.writeFile(ct,JSON.stringify(ut,null,2))}function filterCachedModules(ct,ut){if(!ut){return{filteredEntryPoints:ct,cachedMappings:{}}}const pt={};const dt={};for(const[ft,_t]of Object.entries(ct)){if(ut[ft]){dt[ft]=ut[ft].file}else{pt[ft]=_t}}return{filteredEntryPoints:pt,cachedMappings:dt}}function buildEntryPoints(ct,ut,pt){const dt={};const ft=[];for(const _t of ct){if(yt.resolver.shouldSkipByExtension(_t)){ft.push(_t);continue}const ct=yt.resolver.findDependencyVersion(ut,_t);if(!ct){const ct=yt.resolver.findOwningPackage(_t,pt);if(!ct)continue}dt[_t]=resolveModuleEntry(_t,ct)}return{entryPoints:dt,skippedModules:ft}}},49969:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.getErrorMessage=getErrorMessage;function getErrorMessage(ct){if(ct instanceof Error)return ct.message;if(typeof ct==="string")return ct;return String(ct)}},4145:function(ct,ut,pt){"use strict";var dt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.waitForIpcConfig=waitForIpcConfig;const ft=dt(pt(16928));const _t=pt(60449);function parseCwdArg(ct){for(let ut=0;ut<ct.length;ut++){if(ct[ut]==="--cwd"&&ut+1<ct.length){return ct[ut+1]}if(ct[ut].startsWith("--cwd=")){return ct[ut].replace("--cwd=","")}}return undefined}function waitForIpcConfig(){const ct=parseCwdArg(process.argv);if(ct){return Promise.resolve({type:"config",port:0,cwd:ft.default.resolve(ct),allowDebug:process.env.MIDWAY_SERVER_ENV===_t.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}if(process.send){return new Promise(((ct,ut)=>{const pt=setTimeout((()=>{ut(new Error("No IPC config received within 10s. MidwayJS must be started by master via fork."))}),1e4);process.once("message",(ut=>{if(ut?.type==="config"){clearTimeout(pt);ct(ut)}}))}))}return Promise.resolve({type:"config",port:0,cwd:process.cwd(),allowDebug:process.env.MIDWAY_SERVER_ENV===_t.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}},10778:function(ct,ut,pt){"use strict";var dt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.remoteInstance=ut.setHeader=void 0;const ft=pt(63536);const _t=pt(60449);const mt=dt(pt(65692));const ht=(0,ft.initInstance)(_t.KEYS.REMOTE_SERVICE_PREFIX,{timeout:1e4,httpsAgent:new mt.default.Agent({rejectUnauthorized:false})});ut.remoteInstance=ht;let yt=null;const setHeader=ct=>{yt=ct};ut.setHeader=setHeader;ht.interceptors.request.use((ct=>{ct.headers[_t.KEYS.AUTHORIZATION_HEADER_NAME]=yt[_t.KEYS.AUTHORIZATION_HEADER_NAME];ct.headers[_t.KEYS.CSRF_TOKEN_HEADER_NAME]=yt[_t.KEYS.CSRF_TOKEN_HEADER_NAME];ct.headers[_t.KEYS.ACCEPT_LANGUAGE_HEADER_NAME]=yt[_t.KEYS.ACCEPT_LANGUAGE_HEADER_NAME.toLowerCase()];ct.headers["cookie"]=yt.cookie;return ct}),(ct=>Promise.reject(ct)));ht.interceptors.response.use((async ct=>{if(ct.data.code!==0){throw new Error(JSON.stringify(ct.data))}return ct.data}),(ct=>Promise.reject(ct)))},67872:function(ct,ut,pt){"use strict";var dt=this&&this.__importDefault||function(ct){return ct&&ct.__esModule?ct:{default:ct}};Object.defineProperty(ut,"__esModule",{value:true});ut.createKoaProxy=createKoaProxy;const ft=dt(pt(58611));const _t=pt(76289);const mt=new ft.default.Agent({keepAlive:true,keepAliveMsecs:3e4,maxSockets:50,maxFreeSockets:10});const ht=new Map;function getOrCreateSubProxy(ct,ut){const pt=`${ct}|${JSON.stringify(ut)}`;if(!ht.has(pt)){ht.set(pt,(0,_t.createProxyMiddleware)({target:ct,changeOrigin:true,secure:false,agent:mt,pathRewrite:ut,on:{error:ct=>{}}}))}return ht.get(pt)}async function createKoaProxy(ct,ut,pt){const dt=getOrCreateSubProxy(ut,pt);return new Promise(((ut,pt)=>{ct.res.on("finish",ut);ct.res.on("close",ut);ct.res.on("error",pt);dt(ct.req,ct.res,(ct=>{if(ct)pt(ct);else ut()}))}))}},101:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.PackageJsonVO=ut.LocalCompDetailVO=ut.LocalCompsVO=ut.CompFileHashVO=ut.CompSimilarListVO=ut.CompFilesOssSignedUrlVO=ut.DownloadCompVO=ut.LocalCompsByIdsVO=ut.ImportScanResultVO=ut.CompCheckVO=ut.CompFileContentVO=ut.CompFileVO=ut.CompSimilarListItemVO=ut.FileNode=void 0;const _t=pt(49179);const mt=pt(60449);class FileNode{}ut.FileNode=FileNode;dt([(0,_t.ApiProperty)({description:"目录/文件名称",example:"index.vue",required:true}),ft("design:type",String)],FileNode.prototype,"name",void 0);dt([(0,_t.ApiProperty)({description:"目录/文件路径",example:"/src/components/MyComp/index.vue",required:true}),ft("design:type",String)],FileNode.prototype,"path",void 0);dt([(0,_t.ApiProperty)({description:"目录/文件类型",example:"file",required:true,enum:mt.ENUM.FileType}),ft("design:type",String)],FileNode.prototype,"type",void 0);dt([(0,_t.ApiProperty)({description:"子节点",type:[FileNode]}),ft("design:type",Array)],FileNode.prototype,"children",void 0);class CompSimilarListItemVO{}ut.CompSimilarListItemVO=CompSimilarListItemVO;dt([(0,_t.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),ft("design:type",String)],CompSimilarListItemVO.prototype,"_id",void 0);dt([(0,_t.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),ft("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);class CompFileVO{}ut.CompFileVO=CompFileVO;dt([(0,_t.ApiProperty)({type:FileNode,description:"组件文件树",required:true}),ft("design:type",FileNode)],CompFileVO.prototype,"tree",void 0);dt([(0,_t.ApiProperty)({type:[String],description:"组件文件列表",required:true}),ft("design:type",Array)],CompFileVO.prototype,"files",void 0);class CompFileContentVO{}ut.CompFileContentVO=CompFileContentVO;dt([(0,_t.ApiProperty)({description:"组件文件内容",example:"let a=123;",required:true}),ft("design:type",String)],CompFileContentVO.prototype,"content",void 0);class CompCheckVO{}ut.CompCheckVO=CompCheckVO;dt([(0,_t.ApiProperty)({description:"组件入口文件路径",required:false}),ft("design:type",String)],CompCheckVO.prototype,"entryIndexPath",void 0);dt([(0,_t.ApiProperty)({description:"组件配置文件路径",required:false}),ft("design:type",String)],CompCheckVO.prototype,"compJsonPath",void 0);dt([(0,_t.ApiProperty)({description:"异常结果内容",required:true}),ft("design:type",String)],CompCheckVO.prototype,"errorMsg",void 0);class ParentVO{}dt([(0,_t.ApiProperty)({description:"父库名称",required:true,example:"vue"}),ft("design:type",String)],ParentVO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),ft("design:type",String)],ParentVO.prototype,"version",void 0);class ImportDetailVO{}dt([(0,_t.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),ft("design:type",String)],ImportDetailVO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),ft("design:type",String)],ImportDetailVO.prototype,"version",void 0);dt([(0,_t.ApiProperty)({type:ParentVO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),ft("design:type",ParentVO)],ImportDetailVO.prototype,"parent",void 0);class ImportScanResultVO{}ut.ImportScanResultVO=ImportScanResultVO;dt([(0,_t.ApiProperty)({type:[ImportDetailVO],required:true,description:"第三方库导入详情"}),ft("design:type",Array)],ImportScanResultVO.prototype,"thirdParty",void 0);class CompInfoVO{}dt([(0,_t.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),ft("design:type",String)],CompInfoVO.prototype,"id",void 0);dt([(0,_t.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),ft("design:type",String)],CompInfoVO.prototype,"path",void 0);dt([(0,_t.ApiProperty)({description:"组件文件名称",example:"base-table",required:true}),ft("design:type",String)],CompInfoVO.prototype,"basename",void 0);dt([(0,_t.ApiProperty)({description:"组件文件完整路径",example:"/src/components/MyComp/index.vue",required:true}),ft("design:type",String)],CompInfoVO.prototype,"fullPath",void 0);dt([(0,_t.ApiProperty)({description:"组件文件完整路径哈希值",example:"123",required:true}),ft("design:type",String)],CompInfoVO.prototype,"fullPathHash",void 0);class LocalCompsByIdsVO{}ut.LocalCompsByIdsVO=LocalCompsByIdsVO;dt([(0,_t.ApiProperty)({type:[CompInfoVO],required:true}),ft("design:type",Array)],LocalCompsByIdsVO.prototype,"compInfos",void 0);class DownloadCompVO{}ut.DownloadCompVO=DownloadCompVO;dt([(0,_t.ApiProperty)({description:"组件是否重复",example:true,required:true}),ft("design:type",Boolean)],DownloadCompVO.prototype,"isRepeat",void 0);class SignedUrlItem{}dt([(0,_t.ApiProperty)({description:"文件路径",example:"/src/components/MyComp/index.vue",required:true}),ft("design:type",String)],SignedUrlItem.prototype,"path",void 0);dt([(0,_t.ApiProperty)({description:"文件oss签名访问地址",example:"https://comp-hub.oss-cn-beijing.aliyuncs.com/src/components/MyComp/index.vue?x-oss-security-token=...",required:true}),ft("design:type",String)],SignedUrlItem.prototype,"signedUrl",void 0);class CompFilesOssSignedUrlVO{}ut.CompFilesOssSignedUrlVO=CompFilesOssSignedUrlVO;dt([(0,_t.ApiProperty)({description:"文件oss签名访问地址列表",type:[SignedUrlItem],required:true}),ft("design:type",Array)],CompFilesOssSignedUrlVO.prototype,"signedUrls",void 0);class CompSimilarListVO{}ut.CompSimilarListVO=CompSimilarListVO;dt([(0,_t.ApiProperty)({type:[CompSimilarListItemVO],description:"相似组件列表",required:true}),ft("design:type",Array)],CompSimilarListVO.prototype,"similarList",void 0);class CompFileHashVO{}ut.CompFileHashVO=CompFileHashVO;dt([(0,_t.ApiProperty)({example:"123",description:"组件哈希值",required:true}),ft("design:type",String)],CompFileHashVO.prototype,"compHash",void 0);class PreviewItem{}dt([(0,_t.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"预览配置项主键ID(自动生成)",required:false}),ft("design:type",String)],PreviewItem.prototype,"_id",void 0);dt([(0,_t.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),ft("design:type",Array)],PreviewItem.prototype,"miniPath",void 0);dt([(0,_t.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),ft("design:type",Array)],PreviewItem.prototype,"fullPath",void 0);dt([(0,_t.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),ft("design:type",String)],PreviewItem.prototype,"desc",void 0);class LocalCompsVO{}ut.LocalCompsVO=LocalCompsVO;dt([(0,_t.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"内容id,这里用路径哈希值",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"_id",void 0);dt([(0,_t.ApiProperty)({type:String,example:"qin-table",description:"组件名称",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"name",void 0);dt([(0,_t.ApiProperty)({type:String,example:"123456",description:"组件ID",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"compId",void 0);dt([(0,_t.ApiProperty)({type:String,example:"1.0.0",description:"组件版本",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"version",void 0);dt([(0,_t.ApiProperty)({type:[PreviewItem],required:true}),ft("design:type",Array)],LocalCompsVO.prototype,"previewConfigs",void 0);dt([(0,_t.ApiProperty)({type:String,example:"local://components/QinTable",description:"组件文件路径",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"path",void 0);dt([(0,_t.ApiProperty)({type:String,example:"D:/src/components/QinTable/index.vue",description:"组件文件完整路径",required:true}),ft("design:type",String)],LocalCompsVO.prototype,"fullPath",void 0);dt([(0,_t.ApiProperty)({type:String,example:"#f0f0f0",description:"组件背景颜色",required:false}),ft("design:type",String)],LocalCompsVO.prototype,"bgColor",void 0);class LocalCompDetailVO extends LocalCompsVO{}ut.LocalCompDetailVO=LocalCompDetailVO;class PackageJsonVO{}ut.PackageJsonVO=PackageJsonVO;dt([(0,_t.ApiProperty)({type:Object,description:"组件package.json文件内容",required:true}),ft("design:type",Object)],PackageJsonVO.prototype,"packageJson",void 0)},71692:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.PreBuildSizeVO=ut.PreBuildVO=void 0;const _t=pt(49179);class PreBuildVO{}ut.PreBuildVO=PreBuildVO;dt([(0,_t.ApiProperty)({description:"预构建模块对应文件",required:true,example:{vue:"vue-hash.js"}}),ft("design:type",Object)],PreBuildVO.prototype,"entryNameToFile",void 0);class PreBuildSizeVO{}ut.PreBuildSizeVO=PreBuildSizeVO;dt([(0,_t.ApiProperty)({description:"预构建模块文件总大小",required:true,example:1024}),ft("design:type",Number)],PreBuildSizeVO.prototype,"size",void 0)},75049:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SignedUrlVO=void 0;const _t=pt(49179);class SignedUrlVO{}ut.SignedUrlVO=SignedUrlVO;dt([(0,_t.ApiProperty)({example:"xxxx",description:"带签名的访问地址",required:true}),ft("design:type",String)],SignedUrlVO.prototype,"signUrl",void 0)},18922:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.PreprocessedCodeVO=void 0;const _t=pt(49179);class PreprocessedCodeVO{}ut.PreprocessedCodeVO=PreprocessedCodeVO;dt([(0,_t.ApiProperty)({description:"预处理后的css代码",required:true}),ft("design:type",String)],PreprocessedCodeVO.prototype,"preprocessedCode",void 0)},15798:(ct,ut)=>{"use strict";const pt={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};ut.parse=function(ct,...dt){const ft=typeof dt[0]==="object"&&dt[0];const _t=dt.length>1||!ft?dt[0]:undefined;const mt=dt.length>1&&dt[1]||ft||{};const ht=JSON.parse(ct,_t);if(mt.protoAction==="ignore"){return ht}if(!ht||typeof ht!=="object"){return ht}if(!ct.match(pt.suspectRx)){return ht}ut.scan(ht,mt);return ht};ut.scan=function(ct,ut={}){let pt=[ct];while(pt.length){const ct=pt;pt=[];for(const dt of ct){if(Object.prototype.hasOwnProperty.call(dt,"__proto__")){if(ut.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete dt.__proto__}for(const ct in dt){const ut=dt[ct];if(ut&&typeof ut==="object"){pt.push(dt[ct])}}}}};ut.safeParse=function(ct,pt){try{return ut.parse(ct,pt)}catch(ct){return null}}},35522:(ct,ut,pt)=>{"use strict";const dt=pt(99583);const ft=pt(43700);const _t=pt(66621);const mt=pt(69322);const ht={};ct.exports=function(ct,ut,pt={}){dt(ct&&typeof ct==="object","Invalid defaults value: must be an object");dt(!ut||ut===true||typeof ut==="object","Invalid source value: must be true, falsy or an object");dt(typeof pt==="object","Invalid options: must be an object");if(!ut){return null}if(pt.shallow){return ht.applyToDefaultsWithShallow(ct,ut,pt)}const mt=ft(ct);if(ut===true){return mt}const yt=pt.nullOverride!==undefined?pt.nullOverride:false;return _t(mt,ut,{nullOverride:yt,mergeArrays:false})};ht.applyToDefaultsWithShallow=function(ct,ut,pt){const yt=pt.shallow;dt(Array.isArray(yt),"Invalid keys");const vt=new Map;const St=ut===true?null:new Set;for(let pt of yt){pt=Array.isArray(pt)?pt:pt.split(".");const dt=mt(ct,pt);if(dt&&typeof dt==="object"){vt.set(dt,St&&mt(ut,pt)||dt)}else if(St){St.add(pt)}}const bt=ft(ct,{},vt);if(!St){return bt}for(const ct of St){ht.reachCopy(bt,ut,ct)}const xt=pt.nullOverride!==undefined?pt.nullOverride:false;return _t(bt,ut,{nullOverride:xt,mergeArrays:false})};ht.reachCopy=function(ct,ut,pt){for(const ct of pt){if(!(ct in ut)){return}const pt=ut[ct];if(typeof pt!=="object"||pt===null){return}ut=pt}const dt=ut;let ft=ct;for(let ct=0;ct<pt.length-1;++ct){const ut=pt[ct];if(typeof ft[ut]!=="object"){ft[ut]={}}ft=ft[ut]}ft[pt[pt.length-1]]=dt}},99583:(ct,ut,pt)=>{"use strict";const dt=pt(16443);const ft={};ct.exports=function(ct,...ut){if(ct){return}if(ut.length===1&&ut[0]instanceof Error){throw ut[0]}throw new dt(ut)}},43700:(ct,ut,pt)=>{"use strict";const dt=pt(69322);const ft=pt(99704);const _t=pt(87492);const mt={needsProtoHack:new Set([ft.set,ft.map,ft.weakSet,ft.weakMap])};ct.exports=mt.clone=function(ct,ut={},pt=null){if(typeof ct!=="object"||ct===null){return ct}let dt=mt.clone;let ht=pt;if(ut.shallow){if(ut.shallow!==true){return mt.cloneWithShallow(ct,ut)}dt=ct=>ct}else if(ht){const ut=ht.get(ct);if(ut){return ut}}else{ht=new Map}const yt=ft.getInternalProto(ct);if(yt===ft.buffer){return Buffer&&Buffer.from(ct)}if(yt===ft.date){return new Date(ct.getTime())}if(yt===ft.regex){return new RegExp(ct)}const vt=mt.base(ct,yt,ut);if(vt===ct){return ct}if(ht){ht.set(ct,vt)}if(yt===ft.set){for(const pt of ct){vt.add(dt(pt,ut,ht))}}else if(yt===ft.map){for(const[pt,ft]of ct){vt.set(pt,dt(ft,ut,ht))}}const St=_t.keys(ct,ut);for(const pt of St){if(pt==="__proto__"){continue}if(yt===ft.array&&pt==="length"){vt.length=ct.length;continue}const _t=Object.getOwnPropertyDescriptor(ct,pt);if(_t){if(_t.get||_t.set){Object.defineProperty(vt,pt,_t)}else if(_t.enumerable){vt[pt]=dt(ct[pt],ut,ht)}else{Object.defineProperty(vt,pt,{enumerable:false,writable:true,configurable:true,value:dt(ct[pt],ut,ht)})}}else{Object.defineProperty(vt,pt,{enumerable:true,writable:true,configurable:true,value:dt(ct[pt],ut,ht)})}}return vt};mt.cloneWithShallow=function(ct,ut){const pt=ut.shallow;ut=Object.assign({},ut);ut.shallow=false;const ft=new Map;for(const ut of pt){const pt=dt(ct,ut);if(typeof pt==="object"||typeof pt==="function"){ft.set(pt,pt)}}return mt.clone(ct,ut,ft)};mt.base=function(ct,ut,pt){if(pt.prototype===false){if(mt.needsProtoHack.has(ut)){return new ut.constructor}return ut===ft.array?[]:{}}const dt=Object.getPrototypeOf(ct);if(dt&&dt.isImmutable){return ct}if(ut===ft.array){const ct=[];if(dt!==ut){Object.setPrototypeOf(ct,dt)}return ct}if(mt.needsProtoHack.has(ut)){const ct=new dt.constructor;if(dt!==ut){Object.setPrototypeOf(ct,dt)}return ct}return Object.create(dt)}},35879:(ct,ut,pt)=>{"use strict";const dt=pt(99704);const ft={mismatched:null};ct.exports=function(ct,ut,pt){pt=Object.assign({prototype:true},pt);return!!ft.isDeepEqual(ct,ut,pt,[])};ft.isDeepEqual=function(ct,ut,pt,_t){if(ct===ut){return ct!==0||1/ct===1/ut}const mt=typeof ct;if(mt!==typeof ut){return false}if(ct===null||ut===null){return false}if(mt==="function"){if(!pt.deepFunction||ct.toString()!==ut.toString()){return false}}else if(mt!=="object"){return ct!==ct&&ut!==ut}const ht=ft.getSharedType(ct,ut,!!pt.prototype);switch(ht){case dt.buffer:return Buffer&&Buffer.prototype.equals.call(ct,ut);case dt.promise:return ct===ut;case dt.regex:return ct.toString()===ut.toString();case ft.mismatched:return false}for(let pt=_t.length-1;pt>=0;--pt){if(_t[pt].isSame(ct,ut)){return true}}_t.push(new ft.SeenEntry(ct,ut));try{return!!ft.isDeepEqualObj(ht,ct,ut,pt,_t)}finally{_t.pop()}};ft.getSharedType=function(ct,ut,pt){if(pt){if(Object.getPrototypeOf(ct)!==Object.getPrototypeOf(ut)){return ft.mismatched}return dt.getInternalProto(ct)}const _t=dt.getInternalProto(ct);if(_t!==dt.getInternalProto(ut)){return ft.mismatched}return _t};ft.valueOf=function(ct){const ut=ct.valueOf;if(ut===undefined){return ct}try{return ut.call(ct)}catch(ct){return ct}};ft.hasOwnEnumerableProperty=function(ct,ut){return Object.prototype.propertyIsEnumerable.call(ct,ut)};ft.isSetSimpleEqual=function(ct,ut){for(const pt of Set.prototype.values.call(ct)){if(!Set.prototype.has.call(ut,pt)){return false}}return true};ft.isDeepEqualObj=function(ct,ut,pt,_t,mt){const{isDeepEqual:ht,valueOf:yt,hasOwnEnumerableProperty:vt}=ft;const{keys:St,getOwnPropertySymbols:bt}=Object;if(ct===dt.array){if(_t.part){for(const ct of ut){for(const ut of pt){if(ht(ct,ut,_t,mt)){return true}}}}else{if(ut.length!==pt.length){return false}for(let ct=0;ct<ut.length;++ct){if(!ht(ut[ct],pt[ct],_t,mt)){return false}}return true}}else if(ct===dt.set){if(ut.size!==pt.size){return false}if(!ft.isSetSimpleEqual(ut,pt)){const ct=new Set(Set.prototype.values.call(pt));for(const pt of Set.prototype.values.call(ut)){if(ct.delete(pt)){continue}let ut=false;for(const dt of ct){if(ht(pt,dt,_t,mt)){ct.delete(dt);ut=true;break}}if(!ut){return false}}}}else if(ct===dt.map){if(ut.size!==pt.size){return false}for(const[ct,dt]of Map.prototype.entries.call(ut)){if(dt===undefined&&!Map.prototype.has.call(pt,ct)){return false}if(!ht(dt,Map.prototype.get.call(pt,ct),_t,mt)){return false}}}else if(ct===dt.error){if(ut.name!==pt.name||ut.message!==pt.message){return false}}const xt=yt(ut);const $t=yt(pt);if((ut!==xt||pt!==$t)&&!ht(xt,$t,_t,mt)){return false}const Et=St(ut);if(!_t.part&&Et.length!==St(pt).length&&!_t.skip){return false}let Ct=0;for(const ct of Et){if(_t.skip&&_t.skip.includes(ct)){if(pt[ct]===undefined){++Ct}continue}if(!vt(pt,ct)){return false}if(!ht(ut[ct],pt[ct],_t,mt)){return false}}if(!_t.part&&Et.length-Ct!==St(pt).length){return false}if(_t.symbols!==false){const ct=bt(ut);const dt=new Set(bt(pt));for(const ft of ct){if(!_t.skip||!_t.skip.includes(ft)){if(vt(ut,ft)){if(!vt(pt,ft)){return false}if(!ht(ut[ft],pt[ft],_t,mt)){return false}}else if(vt(pt,ft)){return false}}dt.delete(ft)}for(const ct of dt){if(vt(pt,ct)){return false}}}return true};ft.SeenEntry=class{constructor(ct,ut){this.obj=ct;this.ref=ut}isSame(ct,ut){return this.obj===ct&&this.ref===ut}}},16443:(ct,ut,pt)=>{"use strict";const dt=pt(72912);const ft={};ct.exports=class extends Error{constructor(ct){const pt=ct.filter((ct=>ct!=="")).map((ct=>typeof ct==="string"?ct:ct instanceof Error?ct.message:dt(ct)));super(pt.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,ut.assert)}}}},57391:ct=>{"use strict";const ut={};ct.exports=function(ct){if(!ct){return""}let pt="";for(let dt=0;dt<ct.length;++dt){const ft=ct.charCodeAt(dt);if(ut.isSafe(ft)){pt+=ct[dt]}else{pt+=ut.escapeHtmlChar(ft)}}return pt};ut.escapeHtmlChar=function(ct){const pt=ut.namedHtml.get(ct);if(pt){return pt}if(ct>=256){return"&#"+ct+";"}const dt=ct.toString(16).padStart(2,"0");return`&#x${dt};`};ut.isSafe=function(ct){return ut.safeCharCodes.has(ct)};ut.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]);ut.safeCharCodes=function(){const ct=new Set;for(let ut=32;ut<123;++ut){if(ut>=97||ut>=65&&ut<=90||ut>=48&&ut<=57||ut===32||ut===46||ut===44||ut===45||ut===58||ut===95){ct.add(ut)}}return ct}()},43935:ct=>{"use strict";const ut={};ct.exports=function(ct){return ct.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},85363:ct=>{"use strict";const ut={};ct.exports=function(){}},66621:(ct,ut,pt)=>{"use strict";const dt=pt(99583);const ft=pt(43700);const _t=pt(87492);const mt={};ct.exports=mt.merge=function(ct,ut,pt){dt(ct&&typeof ct==="object","Invalid target value: must be an object");dt(ut===null||ut===undefined||typeof ut==="object","Invalid source value: must be null, undefined, or an object");if(!ut){return ct}pt=Object.assign({nullOverride:true,mergeArrays:true},pt);if(Array.isArray(ut)){dt(Array.isArray(ct),"Cannot merge array onto an object");if(!pt.mergeArrays){ct.length=0}for(let dt=0;dt<ut.length;++dt){ct.push(ft(ut[dt],{symbols:pt.symbols}))}return ct}const ht=_t.keys(ut,pt);for(let dt=0;dt<ht.length;++dt){const _t=ht[dt];if(_t==="__proto__"||!Object.prototype.propertyIsEnumerable.call(ut,_t)){continue}const yt=ut[_t];if(yt&&typeof yt==="object"){if(ct[_t]===yt){continue}if(!ct[_t]||typeof ct[_t]!=="object"||Array.isArray(ct[_t])!==Array.isArray(yt)||yt instanceof Date||Buffer&&Buffer.isBuffer(yt)||yt instanceof RegExp){ct[_t]=ft(yt,{symbols:pt.symbols})}else{mt.merge(ct[_t],yt,pt)}}else{if(yt!==null&&yt!==undefined){ct[_t]=yt}else if(pt.nullOverride){ct[_t]=yt}}}return ct}},69322:(ct,ut,pt)=>{"use strict";const dt=pt(99583);const ft={};ct.exports=function(ct,ut,pt){if(ut===false||ut===null||ut===undefined){return ct}pt=pt||{};if(typeof pt==="string"){pt={separator:pt}}const _t=Array.isArray(ut);dt(!_t||!pt.separator,"Separator option is not valid for array-based chain");const mt=_t?ut:ut.split(pt.separator||".");let ht=ct;for(let ct=0;ct<mt.length;++ct){let _t=mt[ct];const yt=pt.iterables&&ft.iterables(ht);if(Array.isArray(ht)||yt==="set"){const ct=Number(_t);if(Number.isInteger(ct)){_t=ct<0?ht.length+ct:ct}}if(!ht||typeof ht==="function"&&pt.functions===false||!yt&&ht[_t]===undefined){dt(!pt.strict||ct+1===mt.length,"Missing segment",_t,"in reach path ",ut);dt(typeof ht==="object"||pt.functions===true||typeof ht!=="function","Invalid segment",_t,"in reach path ",ut);ht=pt.default;break}if(!yt){ht=ht[_t]}else if(yt==="set"){ht=[...ht][_t]}else{ht=ht.get(_t)}}return ht};ft.iterables=function(ct){if(ct instanceof Set){return"set"}if(ct instanceof Map){return"map"}}},72912:ct=>{"use strict";const ut={};ct.exports=function(...ct){try{return JSON.stringify(...ct)}catch(ct){return"[Cannot display object: "+ct.message+"]"}}},99704:(ct,ut)=>{"use strict";const pt={};ut=ct.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};pt.typeMap=new Map([["[object Error]",ut.error],["[object Map]",ut.map],["[object Promise]",ut.promise],["[object Set]",ut.set],["[object WeakMap]",ut.weakMap],["[object WeakSet]",ut.weakSet]]);ut.getInternalProto=function(ct){if(Array.isArray(ct)){return ut.array}if(Buffer&&ct instanceof Buffer){return ut.buffer}if(ct instanceof Date){return ut.date}if(ct instanceof RegExp){return ut.regex}if(ct instanceof Error){return ut.error}const dt=Object.prototype.toString.call(ct);return pt.typeMap.get(dt)||ut.generic}},87492:(ct,ut)=>{"use strict";const pt={};ut.keys=function(ct,ut={}){return ut.symbols!==false?Reflect.ownKeys(ct):Object.getOwnPropertyNames(ct)}},75663:(ct,ut,pt)=>{"use strict";const dt=pt(99583);const ft={};ut.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(ct,ut){ut=ut||{};const pt=[].concat(ut.before||[]);const ft=[].concat(ut.after||[]);const _t=ut.group||"?";const mt=ut.sort||0;dt(!pt.includes(_t),`Item cannot come before itself: ${_t}`);dt(!pt.includes("?"),"Item cannot come before unassociated items");dt(!ft.includes(_t),`Item cannot come after itself: ${_t}`);dt(!ft.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(ct)){ct=[ct]}for(const ut of ct){const ct={seq:this._items.length,sort:mt,before:pt,after:ft,group:_t,node:ut};this._items.push(ct)}if(!ut.manual){const ct=this._sort();dt(ct,"item",_t!=="?"?`added into group ${_t}`:"","created a dependencies error")}return this.nodes}merge(ct){if(!Array.isArray(ct)){ct=[ct]}for(const ut of ct){if(ut){for(const ct of ut._items){this._items.push(Object.assign({},ct))}}}this._items.sort(ft.mergeSort);for(let ct=0;ct<this._items.length;++ct){this._items[ct].seq=ct}const ut=this._sort();dt(ut,"merge created a dependencies error");return this.nodes}sort(){const ct=this._sort();dt(ct,"sort created a dependencies error");return this.nodes}_sort(){const ct={};const ut=Object.create(null);const pt=Object.create(null);for(const dt of this._items){const ft=dt.seq;const _t=dt.group;pt[_t]=pt[_t]||[];pt[_t].push(ft);ct[ft]=dt.before;for(const ct of dt.after){ut[ct]=ut[ct]||[];ut[ct].push(ft)}}for(const ut in ct){const dt=[];for(const ft in ct[ut]){const _t=ct[ut][ft];pt[_t]=pt[_t]||[];dt.push(...pt[_t])}ct[ut]=dt}for(const dt in ut){if(pt[dt]){for(const ft of pt[dt]){ct[ft].push(...ut[dt])}}}const dt={};for(const ut in ct){const pt=ct[ut];for(const ct of pt){dt[ct]=dt[ct]||[];dt[ct].push(ut)}}const ft={};const _t=[];for(let ct=0;ct<this._items.length;++ct){let ut=ct;if(dt[ct]){ut=null;for(let ct=0;ct<this._items.length;++ct){if(ft[ct]===true){continue}if(!dt[ct]){dt[ct]=[]}const pt=dt[ct].length;let _t=0;for(let ut=0;ut<pt;++ut){if(ft[dt[ct][ut]]){++_t}}if(_t===pt){ut=ct;break}}}if(ut!==null){ft[ut]=true;_t.push(ut)}}if(_t.length!==this._items.length){return false}const mt={};for(const ct of this._items){mt[ct.seq]=ct}this._items=[];this.nodes=[];for(const ct of _t){const ut=mt[ct];this.nodes.push(ut.node);this._items.push(ut)}return true}};ft.mergeSort=(ct,ut)=>ct.sort===ut.sort?0:ct.sort<ut.sort?-1:1},46284:function(ct,ut,pt){ct=pt.nmd(ct);(function(ut,dt){if(true){dt(ct,pt(35073),pt(17239));ct.exports=def(ct)}else{}function def(ct){return"default"in ct.exports?ct.exports.default:ct.exports}})(this,(function(ct,ut,pt){"use strict";var dt=Object.create;var ft=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var ht=Object.getPrototypeOf;var yt=Object.prototype.hasOwnProperty;var __commonJS=(ct,ut)=>function __require(){return ut||(0,ct[mt(ct)[0]])((ut={exports:{}}).exports,ut),ut.exports};var __export=(ct,ut)=>{for(var pt in ut)ft(ct,pt,{get:ut[pt],enumerable:true})};var __copyProps=(ct,ut,pt,dt)=>{if(ut&&typeof ut==="object"||typeof ut==="function"){for(let ht of mt(ut))if(!yt.call(ct,ht)&&ht!==pt)ft(ct,ht,{get:()=>ut[ht],enumerable:!(dt=_t(ut,ht))||dt.enumerable})}return ct};var __toESM=(ct,ut,pt)=>(pt=ct!=null?dt(ht(ct)):{},__copyProps(ut||!ct||!ct.__esModule?ft(pt,"default",{value:ct,enumerable:true}):pt,ct));var __toCommonJS=ct=>__copyProps(ft({},"__esModule",{value:true}),ct);var vt=__commonJS({"umd:@jridgewell/sourcemap-codec"(ct,pt){pt.exports=ut}});var St=__commonJS({"umd:@jridgewell/trace-mapping"(ct,ut){ut.exports=pt}});var bt={};__export(bt,{GenMapping:()=>Nt,addMapping:()=>addMapping,addSegment:()=>addSegment,allMappings:()=>allMappings,fromMap:()=>fromMap,maybeAddMapping:()=>maybeAddMapping,maybeAddSegment:()=>maybeAddSegment,setIgnore:()=>setIgnore,setSourceContent:()=>setSourceContent,toDecodedMap:()=>toDecodedMap,toEncodedMap:()=>toEncodedMap});ct.exports=__toCommonJS(bt);var xt=class{constructor(){this._indexes={__proto__:null};this.array=[]}};function cast(ct){return ct}function get(ct,ut){return cast(ct)._indexes[ut]}function put(ct,ut){const pt=get(ct,ut);if(pt!==void 0)return pt;const{array:dt,_indexes:ft}=cast(ct);const _t=dt.push(ut);return ft[ut]=_t-1}function remove(ct,ut){const pt=get(ct,ut);if(pt===void 0)return;const{array:dt,_indexes:ft}=cast(ct);for(let ct=pt+1;ct<dt.length;ct++){const ut=dt[ct];dt[ct-1]=ut;ft[ut]--}ft[ut]=void 0;dt.pop()}var $t=__toESM(vt());var Et=__toESM(St());var Ct=0;var Tt=1;var wt=2;var At=3;var kt=4;var It=-1;var Nt=class{constructor({file:ct,sourceRoot:ut}={}){this._names=new xt;this._sources=new xt;this._sourcesContent=[];this._mappings=[];this.file=ct;this.sourceRoot=ut;this._ignoreList=new xt}};function cast2(ct){return ct}function addSegment(ct,ut,pt,dt,ft,_t,mt,ht){return addSegmentInternal(false,ct,ut,pt,dt,ft,_t,mt,ht)}function addMapping(ct,ut){return addMappingInternal(false,ct,ut)}var maybeAddSegment=(ct,ut,pt,dt,ft,_t,mt,ht)=>addSegmentInternal(true,ct,ut,pt,dt,ft,_t,mt,ht);var maybeAddMapping=(ct,ut)=>addMappingInternal(true,ct,ut);function setSourceContent(ct,ut,pt){const{_sources:dt,_sourcesContent:ft}=cast2(ct);const _t=put(dt,ut);ft[_t]=pt}function setIgnore(ct,ut,pt=true){const{_sources:dt,_sourcesContent:ft,_ignoreList:_t}=cast2(ct);const mt=put(dt,ut);if(mt===ft.length)ft[mt]=null;if(pt)put(_t,mt);else remove(_t,mt)}function toDecodedMap(ct){const{_mappings:ut,_sources:pt,_sourcesContent:dt,_names:ft,_ignoreList:_t}=cast2(ct);removeEmptyFinalLines(ut);return{version:3,file:ct.file||void 0,names:ft.array,sourceRoot:ct.sourceRoot||void 0,sources:pt.array,sourcesContent:dt,mappings:ut,ignoreList:_t.array}}function toEncodedMap(ct){const ut=toDecodedMap(ct);return Object.assign({},ut,{mappings:(0,$t.encode)(ut.mappings)})}function fromMap(ct){const ut=new Et.TraceMap(ct);const pt=new Nt({file:ut.file,sourceRoot:ut.sourceRoot});putAll(cast2(pt)._names,ut.names);putAll(cast2(pt)._sources,ut.sources);cast2(pt)._sourcesContent=ut.sourcesContent||ut.sources.map((()=>null));cast2(pt)._mappings=(0,Et.decodedMappings)(ut);if(ut.ignoreList)putAll(cast2(pt)._ignoreList,ut.ignoreList);return pt}function allMappings(ct){const ut=[];const{_mappings:pt,_sources:dt,_names:ft}=cast2(ct);for(let ct=0;ct<pt.length;ct++){const _t=pt[ct];for(let pt=0;pt<_t.length;pt++){const mt=_t[pt];const ht={line:ct+1,column:mt[Ct]};let yt=void 0;let vt=void 0;let St=void 0;if(mt.length!==1){yt=dt.array[mt[Tt]];vt={line:mt[wt]+1,column:mt[At]};if(mt.length===5)St=ft.array[mt[kt]]}ut.push({generated:ht,source:yt,original:vt,name:St})}}return ut}function addSegmentInternal(ct,ut,pt,dt,ft,_t,mt,ht,yt){const{_mappings:vt,_sources:St,_sourcesContent:bt,_names:xt}=cast2(ut);const $t=getIndex(vt,pt);const Et=getColumnIndex($t,dt);if(!ft){if(ct&&skipSourceless($t,Et))return;return insert($t,Et,[dt])}assert(_t);assert(mt);const Ct=put(St,ft);const Tt=ht?put(xt,ht):It;if(Ct===bt.length)bt[Ct]=yt!=null?yt:null;if(ct&&skipSource($t,Et,Ct,_t,mt,Tt)){return}return insert($t,Et,ht?[dt,Ct,_t,mt,Tt]:[dt,Ct,_t,mt])}function assert(ct){}function getIndex(ct,ut){for(let pt=ct.length;pt<=ut;pt++){ct[pt]=[]}return ct[ut]}function getColumnIndex(ct,ut){let pt=ct.length;for(let dt=pt-1;dt>=0;pt=dt--){const pt=ct[dt];if(ut>=pt[Ct])break}return pt}function insert(ct,ut,pt){for(let pt=ct.length;pt>ut;pt--){ct[pt]=ct[pt-1]}ct[ut]=pt}function removeEmptyFinalLines(ct){const{length:ut}=ct;let pt=ut;for(let ut=pt-1;ut>=0;pt=ut,ut--){if(ct[ut].length>0)break}if(pt<ut)ct.length=pt}function putAll(ct,ut){for(let pt=0;pt<ut.length;pt++)put(ct,ut[pt])}function skipSourceless(ct,ut){if(ut===0)return true;const pt=ct[ut-1];return pt.length===1}function skipSource(ct,ut,pt,dt,ft,_t){if(ut===0)return false;const mt=ct[ut-1];if(mt.length===1)return false;return pt===mt[Tt]&&dt===mt[wt]&&ft===mt[At]&&_t===(mt.length===5?mt[kt]:It)}function addMappingInternal(ct,ut,pt){const{generated:dt,source:ft,original:_t,name:mt,content:ht}=pt;if(!ft){return addSegmentInternal(ct,ut,dt.line-1,dt.column,null,null,null,null,null)}assert(_t);return addSegmentInternal(ct,ut,dt.line-1,dt.column,ft,_t.line-1,_t.column,mt,ht)}}))},6001:function(ct){(function(ut,pt){true?ct.exports=pt():0})(this,(function(){"use strict";const ct=/^[\w+.-]+:\/\//;const ut=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;const pt=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function isAbsoluteUrl(ut){return ct.test(ut)}function isSchemeRelativeUrl(ct){return ct.startsWith("//")}function isAbsolutePath(ct){return ct.startsWith("/")}function isFileUrl(ct){return ct.startsWith("file:")}function isRelative(ct){return/^[.?#]/.test(ct)}function parseAbsoluteUrl(ct){const pt=ut.exec(ct);return makeUrl(pt[1],pt[2]||"",pt[3],pt[4]||"",pt[5]||"/",pt[6]||"",pt[7]||"")}function parseFileUrl(ct){const ut=pt.exec(ct);const dt=ut[2];return makeUrl("file:","",ut[1]||"","",isAbsolutePath(dt)?dt:"/"+dt,ut[3]||"",ut[4]||"")}function makeUrl(ct,ut,pt,dt,ft,_t,mt){return{scheme:ct,user:ut,host:pt,port:dt,path:ft,query:_t,hash:mt,type:7}}function parseUrl(ct){if(isSchemeRelativeUrl(ct)){const ut=parseAbsoluteUrl("http:"+ct);ut.scheme="";ut.type=6;return ut}if(isAbsolutePath(ct)){const ut=parseAbsoluteUrl("http://foo.com"+ct);ut.scheme="";ut.host="";ut.type=5;return ut}if(isFileUrl(ct))return parseFileUrl(ct);if(isAbsoluteUrl(ct))return parseAbsoluteUrl(ct);const ut=parseAbsoluteUrl("http://foo.com/"+ct);ut.scheme="";ut.host="";ut.type=ct?ct.startsWith("?")?3:ct.startsWith("#")?2:4:1;return ut}function stripPathFilename(ct){if(ct.endsWith("/.."))return ct;const ut=ct.lastIndexOf("/");return ct.slice(0,ut+1)}function mergePaths(ct,ut){normalizePath(ut,ut.type);if(ct.path==="/"){ct.path=ut.path}else{ct.path=stripPathFilename(ut.path)+ct.path}}function normalizePath(ct,ut){const pt=ut<=4;const dt=ct.path.split("/");let ft=1;let _t=0;let mt=false;for(let ct=1;ct<dt.length;ct++){const ut=dt[ct];if(!ut){mt=true;continue}mt=false;if(ut===".")continue;if(ut===".."){if(_t){mt=true;_t--;ft--}else if(pt){dt[ft++]=ut}continue}dt[ft++]=ut;_t++}let ht="";for(let ct=1;ct<ft;ct++){ht+="/"+dt[ct]}if(!ht||mt&&!ht.endsWith("/..")){ht+="/"}ct.path=ht}function resolve(ct,ut){if(!ct&&!ut)return"";const pt=parseUrl(ct);let dt=pt.type;if(ut&&dt!==7){const ct=parseUrl(ut);const ft=ct.type;switch(dt){case 1:pt.hash=ct.hash;case 2:pt.query=ct.query;case 3:case 4:mergePaths(pt,ct);case 5:pt.user=ct.user;pt.host=ct.host;pt.port=ct.port;case 6:pt.scheme=ct.scheme}if(ft>dt)dt=ft}normalizePath(pt,dt);const ft=pt.query+pt.hash;switch(dt){case 2:case 3:return ft;case 4:{const dt=pt.path.slice(1);if(!dt)return ft||".";if(isRelative(ut||ct)&&!isRelative(dt)){return"./"+dt+ft}return dt+ft}case 5:return pt.path+ft;default:return pt.scheme+"//"+pt.user+pt.host+pt.port+pt.path+ft}}return resolve}))},35073:function(ct,ut,pt){ct=pt.nmd(ct);(function(ut,pt){if(true){pt(ct);ct.exports=def(ct)}else{}function def(ct){return"default"in ct.exports?ct.exports.default:ct.exports}})(this,(function(ct){"use strict";var ut=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ft=Object.prototype.hasOwnProperty;var __export=(ct,pt)=>{for(var dt in pt)ut(ct,dt,{get:pt[dt],enumerable:true})};var __copyProps=(ct,_t,mt,ht)=>{if(_t&&typeof _t==="object"||typeof _t==="function"){for(let yt of dt(_t))if(!ft.call(ct,yt)&&yt!==mt)ut(ct,yt,{get:()=>_t[yt],enumerable:!(ht=pt(_t,yt))||ht.enumerable})}return ct};var __toCommonJS=ct=>__copyProps(ut({},"__esModule",{value:true}),ct);var _t={};__export(_t,{decode:()=>decode,decodeGeneratedRanges:()=>decodeGeneratedRanges,decodeOriginalScopes:()=>decodeOriginalScopes,encode:()=>encode,encodeGeneratedRanges:()=>encodeGeneratedRanges,encodeOriginalScopes:()=>encodeOriginalScopes});ct.exports=__toCommonJS(_t);var mt=",".charCodeAt(0);var ht=";".charCodeAt(0);var yt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var vt=new Uint8Array(64);var St=new Uint8Array(128);for(let ct=0;ct<yt.length;ct++){const ut=yt.charCodeAt(ct);vt[ct]=ut;St[ut]=ct}function decodeInteger(ct,ut){let pt=0;let dt=0;let ft=0;do{const ut=ct.next();ft=St[ut];pt|=(ft&31)<<dt;dt+=5}while(ft&32);const _t=pt&1;pt>>>=1;if(_t){pt=-2147483648|-pt}return ut+pt}function encodeInteger(ct,ut,pt){let dt=ut-pt;dt=dt<0?-dt<<1|1:dt<<1;do{let ut=dt&31;dt>>>=5;if(dt>0)ut|=32;ct.write(vt[ut])}while(dt>0);return ut}function hasMoreVlq(ct,ut){if(ct.pos>=ut)return false;return ct.peek()!==mt}var bt=1024*16;var xt=typeof TextDecoder!=="undefined"?new TextDecoder:typeof Buffer!=="undefined"?{decode(ct){const ut=Buffer.from(ct.buffer,ct.byteOffset,ct.byteLength);return ut.toString()}}:{decode(ct){let ut="";for(let pt=0;pt<ct.length;pt++){ut+=String.fromCharCode(ct[pt])}return ut}};var $t=class{constructor(){this.pos=0;this.out="";this.buffer=new Uint8Array(bt)}write(ct){const{buffer:ut}=this;ut[this.pos++]=ct;if(this.pos===bt){this.out+=xt.decode(ut);this.pos=0}}flush(){const{buffer:ct,out:ut,pos:pt}=this;return pt>0?ut+xt.decode(ct.subarray(0,pt)):ut}};var Et=class{constructor(ct){this.pos=0;this.buffer=ct}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(ct){const{buffer:ut,pos:pt}=this;const dt=ut.indexOf(ct,pt);return dt===-1?ut.length:dt}};var Ct=[];function decodeOriginalScopes(ct){const{length:ut}=ct;const pt=new Et(ct);const dt=[];const ft=[];let _t=0;for(;pt.pos<ut;pt.pos++){_t=decodeInteger(pt,_t);const ct=decodeInteger(pt,0);if(!hasMoreVlq(pt,ut)){const ut=ft.pop();ut[2]=_t;ut[3]=ct;continue}const mt=decodeInteger(pt,0);const ht=decodeInteger(pt,0);const yt=ht&1;const vt=yt?[_t,ct,0,0,mt,decodeInteger(pt,0)]:[_t,ct,0,0,mt];let St=Ct;if(hasMoreVlq(pt,ut)){St=[];do{const ct=decodeInteger(pt,0);St.push(ct)}while(hasMoreVlq(pt,ut))}vt.vars=St;dt.push(vt);ft.push(vt)}return dt}function encodeOriginalScopes(ct){const ut=new $t;for(let pt=0;pt<ct.length;){pt=_encodeOriginalScopes(ct,pt,ut,[0])}return ut.flush()}function _encodeOriginalScopes(ct,ut,pt,dt){const ft=ct[ut];const{0:_t,1:ht,2:yt,3:vt,4:St,vars:bt}=ft;if(ut>0)pt.write(mt);dt[0]=encodeInteger(pt,_t,dt[0]);encodeInteger(pt,ht,0);encodeInteger(pt,St,0);const xt=ft.length===6?1:0;encodeInteger(pt,xt,0);if(ft.length===6)encodeInteger(pt,ft[5],0);for(const ct of bt){encodeInteger(pt,ct,0)}for(ut++;ut<ct.length;){const ft=ct[ut];const{0:_t,1:mt}=ft;if(_t>yt||_t===yt&&mt>=vt){break}ut=_encodeOriginalScopes(ct,ut,pt,dt)}pt.write(mt);dt[0]=encodeInteger(pt,yt,dt[0]);encodeInteger(pt,vt,0);return ut}function decodeGeneratedRanges(ct){const{length:ut}=ct;const pt=new Et(ct);const dt=[];const ft=[];let _t=0;let mt=0;let ht=0;let yt=0;let vt=0;let St=0;let bt=0;let xt=0;do{const ct=pt.indexOf(";");let ut=0;for(;pt.pos<ct;pt.pos++){ut=decodeInteger(pt,ut);if(!hasMoreVlq(pt,ct)){const ct=ft.pop();ct[2]=_t;ct[3]=ut;continue}const $t=decodeInteger(pt,0);const Et=$t&1;const Tt=$t&2;const wt=$t&4;let At=null;let kt=Ct;let It;if(Et){const ct=decodeInteger(pt,mt);ht=decodeInteger(pt,mt===ct?ht:0);mt=ct;It=[_t,ut,0,0,ct,ht]}else{It=[_t,ut,0,0]}It.isScope=!!wt;if(Tt){const ct=yt;const ut=vt;yt=decodeInteger(pt,yt);const dt=ct===yt;vt=decodeInteger(pt,dt?vt:0);St=decodeInteger(pt,dt&&ut===vt?St:0);At=[yt,vt,St]}It.callsite=At;if(hasMoreVlq(pt,ct)){kt=[];do{bt=_t;xt=ut;const ct=decodeInteger(pt,0);let dt;if(ct<-1){dt=[[decodeInteger(pt,0)]];for(let ut=-1;ut>ct;ut--){const ct=bt;bt=decodeInteger(pt,bt);xt=decodeInteger(pt,bt===ct?xt:0);const ut=decodeInteger(pt,0);dt.push([ut,bt,xt])}}else{dt=[[ct]]}kt.push(dt)}while(hasMoreVlq(pt,ct))}It.bindings=kt;dt.push(It);ft.push(It)}_t++;pt.pos=ct+1}while(pt.pos<ut);return dt}function encodeGeneratedRanges(ct){if(ct.length===0)return"";const ut=new $t;for(let pt=0;pt<ct.length;){pt=_encodeGeneratedRanges(ct,pt,ut,[0,0,0,0,0,0,0])}return ut.flush()}function _encodeGeneratedRanges(ct,ut,pt,dt){const ft=ct[ut];const{0:_t,1:ht,2:yt,3:vt,isScope:St,callsite:bt,bindings:xt}=ft;if(dt[0]<_t){catchupLine(pt,dt[0],_t);dt[0]=_t;dt[1]=0}else if(ut>0){pt.write(mt)}dt[1]=encodeInteger(pt,ft[1],dt[1]);const $t=(ft.length===6?1:0)|(bt?2:0)|(St?4:0);encodeInteger(pt,$t,0);if(ft.length===6){const{4:ct,5:ut}=ft;if(ct!==dt[2]){dt[3]=0}dt[2]=encodeInteger(pt,ct,dt[2]);dt[3]=encodeInteger(pt,ut,dt[3])}if(bt){const{0:ct,1:ut,2:_t}=ft.callsite;if(ct!==dt[4]){dt[5]=0;dt[6]=0}else if(ut!==dt[5]){dt[6]=0}dt[4]=encodeInteger(pt,ct,dt[4]);dt[5]=encodeInteger(pt,ut,dt[5]);dt[6]=encodeInteger(pt,_t,dt[6])}if(xt){for(const ct of xt){if(ct.length>1)encodeInteger(pt,-ct.length,0);const ut=ct[0][0];encodeInteger(pt,ut,0);let dt=_t;let ft=ht;for(let ut=1;ut<ct.length;ut++){const _t=ct[ut];dt=encodeInteger(pt,_t[1],dt);ft=encodeInteger(pt,_t[2],ft);encodeInteger(pt,_t[0],0)}}}for(ut++;ut<ct.length;){const ft=ct[ut];const{0:_t,1:mt}=ft;if(_t>yt||_t===yt&&mt>=vt){break}ut=_encodeGeneratedRanges(ct,ut,pt,dt)}if(dt[0]<yt){catchupLine(pt,dt[0],yt);dt[0]=yt;dt[1]=0}else{pt.write(mt)}dt[1]=encodeInteger(pt,vt,dt[1]);return ut}function catchupLine(ct,ut,pt){do{ct.write(ht)}while(++ut<pt)}function decode(ct){const{length:ut}=ct;const pt=new Et(ct);const dt=[];let ft=0;let _t=0;let mt=0;let ht=0;let yt=0;do{const ct=pt.indexOf(";");const ut=[];let vt=true;let St=0;ft=0;while(pt.pos<ct){let dt;ft=decodeInteger(pt,ft);if(ft<St)vt=false;St=ft;if(hasMoreVlq(pt,ct)){_t=decodeInteger(pt,_t);mt=decodeInteger(pt,mt);ht=decodeInteger(pt,ht);if(hasMoreVlq(pt,ct)){yt=decodeInteger(pt,yt);dt=[ft,_t,mt,ht,yt]}else{dt=[ft,_t,mt,ht]}}else{dt=[ft]}ut.push(dt);pt.pos++}if(!vt)sort(ut);dt.push(ut);pt.pos=ct+1}while(pt.pos<=ut);return dt}function sort(ct){ct.sort(sortComparator)}function sortComparator(ct,ut){return ct[0]-ut[0]}function encode(ct){const ut=new $t;let pt=0;let dt=0;let ft=0;let _t=0;for(let yt=0;yt<ct.length;yt++){const vt=ct[yt];if(yt>0)ut.write(ht);if(vt.length===0)continue;let St=0;for(let ct=0;ct<vt.length;ct++){const ht=vt[ct];if(ct>0)ut.write(mt);St=encodeInteger(ut,ht[0],St);if(ht.length===1)continue;pt=encodeInteger(ut,ht[1],pt);dt=encodeInteger(ut,ht[2],dt);ft=encodeInteger(ut,ht[3],ft);if(ht.length===4)continue;_t=encodeInteger(ut,ht[4],_t)}}return ut.flush()}}))},17239:function(ct,ut,pt){ct=pt.nmd(ct);(function(ut,dt){if(true){dt(ct,pt(6001),pt(35073));ct.exports=def(ct)}else{}function def(ct){return"default"in ct.exports?ct.exports.default:ct.exports}})(this,(function(ct,ut,pt){"use strict";var dt=Object.create;var ft=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var ht=Object.getPrototypeOf;var yt=Object.prototype.hasOwnProperty;var __commonJS=(ct,ut)=>function __require(){return ut||(0,ct[mt(ct)[0]])((ut={exports:{}}).exports,ut),ut.exports};var __export=(ct,ut)=>{for(var pt in ut)ft(ct,pt,{get:ut[pt],enumerable:true})};var __copyProps=(ct,ut,pt,dt)=>{if(ut&&typeof ut==="object"||typeof ut==="function"){for(let ht of mt(ut))if(!yt.call(ct,ht)&&ht!==pt)ft(ct,ht,{get:()=>ut[ht],enumerable:!(dt=_t(ut,ht))||dt.enumerable})}return ct};var __toESM=(ct,ut,pt)=>(pt=ct!=null?dt(ht(ct)):{},__copyProps(ut||!ct||!ct.__esModule?ft(pt,"default",{value:ct,enumerable:true}):pt,ct));var __toCommonJS=ct=>__copyProps(ft({},"__esModule",{value:true}),ct);var vt=__commonJS({"umd:@jridgewell/sourcemap-codec"(ct,ut){ut.exports=pt}});var St=__commonJS({"umd:@jridgewell/resolve-uri"(ct,pt){pt.exports=ut}});var bt={};__export(bt,{AnyMap:()=>FlattenMap,FlattenMap:()=>FlattenMap,GREATEST_LOWER_BOUND:()=>Ft,LEAST_UPPER_BOUND:()=>Dt,TraceMap:()=>Mt,allGeneratedPositionsFor:()=>allGeneratedPositionsFor,decodedMap:()=>decodedMap,decodedMappings:()=>decodedMappings,eachMapping:()=>eachMapping,encodedMap:()=>encodedMap,encodedMappings:()=>encodedMappings,generatedPositionFor:()=>generatedPositionFor,isIgnored:()=>isIgnored,originalPositionFor:()=>originalPositionFor,presortedDecodedMap:()=>presortedDecodedMap,sourceContentFor:()=>sourceContentFor,traceSegment:()=>traceSegment});ct.exports=__toCommonJS(bt);var xt=__toESM(vt());var $t=__toESM(St());function stripFilename(ct){if(!ct)return"";const ut=ct.lastIndexOf("/");return ct.slice(0,ut+1)}function resolver(ct,ut){const pt=stripFilename(ct);const dt=ut?ut+"/":"";return ct=>(0,$t.default)(dt+(ct||""),pt)}var Et=0;var Ct=1;var Tt=2;var wt=3;var At=4;var kt=1;var It=2;function maybeSort(ct,ut){const pt=nextUnsortedSegmentLine(ct,0);if(pt===ct.length)return ct;if(!ut)ct=ct.slice();for(let dt=pt;dt<ct.length;dt=nextUnsortedSegmentLine(ct,dt+1)){ct[dt]=sortSegments(ct[dt],ut)}return ct}function nextUnsortedSegmentLine(ct,ut){for(let pt=ut;pt<ct.length;pt++){if(!isSorted(ct[pt]))return pt}return ct.length}function isSorted(ct){for(let ut=1;ut<ct.length;ut++){if(ct[ut][Et]<ct[ut-1][Et]){return false}}return true}function sortSegments(ct,ut){if(!ut)ct=ct.slice();return ct.sort(sortComparator)}function sortComparator(ct,ut){return ct[Et]-ut[Et]}function buildBySources(ct,ut){const pt=ut.map((()=>[]));for(let ut=0;ut<ct.length;ut++){const dt=ct[ut];for(let ct=0;ct<dt.length;ct++){const ft=dt[ct];if(ft.length===1)continue;const _t=ft[Ct];const mt=ft[Tt];const ht=ft[wt];const yt=pt[_t];const vt=yt[mt]||(yt[mt]=[]);vt.push([ht,ut,ft[Et]])}}for(let ct=0;ct<pt.length;ct++){const ut=pt[ct];for(let ct=0;ct<ut.length;ct++){const pt=ut[ct];if(pt)pt.sort(sortComparator)}}return pt}var Nt=false;function binarySearch(ct,ut,pt,dt){while(pt<=dt){const ft=pt+(dt-pt>>1);const _t=ct[ft][Et]-ut;if(_t===0){Nt=true;return ft}if(_t<0){pt=ft+1}else{dt=ft-1}}Nt=false;return pt-1}function upperBound(ct,ut,pt){for(let dt=pt+1;dt<ct.length;pt=dt++){if(ct[dt][Et]!==ut)break}return pt}function lowerBound(ct,ut,pt){for(let dt=pt-1;dt>=0;pt=dt--){if(ct[dt][Et]!==ut)break}return pt}function memoizedState(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function memoizedBinarySearch(ct,ut,pt,dt){const{lastKey:ft,lastNeedle:_t,lastIndex:mt}=pt;let ht=0;let yt=ct.length-1;if(dt===ft){if(ut===_t){Nt=mt!==-1&&ct[mt][Et]===ut;return mt}if(ut>=_t){ht=mt===-1?0:mt}else{yt=mt}}pt.lastKey=dt;pt.lastNeedle=ut;return pt.lastIndex=binarySearch(ct,ut,ht,yt)}function parse(ct){return typeof ct==="string"?JSON.parse(ct):ct}var FlattenMap=function(ct,ut){const pt=parse(ct);if(!("sections"in pt)){return new Mt(pt,ut)}const dt=[];const ft=[];const _t=[];const mt=[];const ht=[];recurse(pt,ut,dt,ft,_t,mt,ht,0,0,Infinity,Infinity);const yt={version:3,file:pt.file,names:mt,sources:ft,sourcesContent:_t,mappings:dt,ignoreList:ht};return presortedDecodedMap(yt)};function recurse(ct,ut,pt,dt,ft,_t,mt,ht,yt,vt,St){const{sections:bt}=ct;for(let ct=0;ct<bt.length;ct++){const{map:xt,offset:$t}=bt[ct];let Et=vt;let Ct=St;if(ct+1<bt.length){const ut=bt[ct+1].offset;Et=Math.min(vt,ht+ut.line);if(Et===vt){Ct=Math.min(St,yt+ut.column)}else if(Et<vt){Ct=yt+ut.column}}addSection(xt,ut,pt,dt,ft,_t,mt,ht+$t.line,yt+$t.column,Et,Ct)}}function addSection(ct,ut,pt,dt,ft,_t,mt,ht,yt,vt,St){const bt=parse(ct);if("sections"in bt)return recurse(...arguments);const xt=new Mt(bt,ut);const $t=dt.length;const kt=_t.length;const It=decodedMappings(xt);const{resolvedSources:Nt,sourcesContent:Pt,ignoreList:Ot}=xt;append(dt,Nt);append(_t,xt.names);if(Pt)append(ft,Pt);else for(let ct=0;ct<Nt.length;ct++)ft.push(null);if(Ot)for(let ct=0;ct<Ot.length;ct++)mt.push(Ot[ct]+$t);for(let ct=0;ct<It.length;ct++){const ut=ht+ct;if(ut>vt)return;const dt=getLine(pt,ut);const ft=ct===0?yt:0;const _t=It[ct];for(let ct=0;ct<_t.length;ct++){const pt=_t[ct];const mt=ft+pt[Et];if(ut===vt&&mt>=St)return;if(pt.length===1){dt.push([mt]);continue}const ht=$t+pt[Ct];const yt=pt[Tt];const bt=pt[wt];dt.push(pt.length===4?[mt,ht,yt,bt]:[mt,ht,yt,bt,kt+pt[At]])}}}function append(ct,ut){for(let pt=0;pt<ut.length;pt++)ct.push(ut[pt])}function getLine(ct,ut){for(let pt=ct.length;pt<=ut;pt++)ct[pt]=[];return ct[ut]}var Pt="`line` must be greater than 0 (lines start at line 1)";var Ot="`column` must be greater than or equal to 0 (columns start at column 0)";var Dt=-1;var Ft=1;var Mt=class{constructor(ct,ut){const pt=typeof ct==="string";if(!pt&&ct._decodedMemo)return ct;const dt=parse(ct);const{version:ft,file:_t,names:mt,sourceRoot:ht,sources:yt,sourcesContent:vt}=dt;this.version=ft;this.file=_t;this.names=mt||[];this.sourceRoot=ht;this.sources=yt;this.sourcesContent=vt;this.ignoreList=dt.ignoreList||dt.x_google_ignoreList||void 0;const St=resolver(ut,ht);this.resolvedSources=yt.map(St);const{mappings:bt}=dt;if(typeof bt==="string"){this._encoded=bt;this._decoded=void 0}else if(Array.isArray(bt)){this._encoded=void 0;this._decoded=maybeSort(bt,pt)}else if(dt.sections){throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`)}else{throw new Error(`invalid source map: ${JSON.stringify(dt)}`)}this._decodedMemo=memoizedState();this._bySources=void 0;this._bySourceMemos=void 0}};function cast(ct){return ct}function encodedMappings(ct){var ut,pt;return(pt=(ut=cast(ct))._encoded)!=null?pt:ut._encoded=(0,xt.encode)(cast(ct)._decoded)}function decodedMappings(ct){var ut;return(ut=cast(ct))._decoded||(ut._decoded=(0,xt.decode)(cast(ct)._encoded))}function traceSegment(ct,ut,pt){const dt=decodedMappings(ct);if(ut>=dt.length)return null;const ft=dt[ut];const _t=traceSegmentInternal(ft,cast(ct)._decodedMemo,ut,pt,Ft);return _t===-1?null:ft[_t]}function originalPositionFor(ct,ut){let{line:pt,column:dt,bias:ft}=ut;pt--;if(pt<0)throw new Error(Pt);if(dt<0)throw new Error(Ot);const _t=decodedMappings(ct);if(pt>=_t.length)return OMapping(null,null,null,null);const mt=_t[pt];const ht=traceSegmentInternal(mt,cast(ct)._decodedMemo,pt,dt,ft||Ft);if(ht===-1)return OMapping(null,null,null,null);const yt=mt[ht];if(yt.length===1)return OMapping(null,null,null,null);const{names:vt,resolvedSources:St}=ct;return OMapping(St[yt[Ct]],yt[Tt]+1,yt[wt],yt.length===5?vt[yt[At]]:null)}function generatedPositionFor(ct,ut){const{source:pt,line:dt,column:ft,bias:_t}=ut;return generatedPosition(ct,pt,dt,ft,_t||Ft,false)}function allGeneratedPositionsFor(ct,ut){const{source:pt,line:dt,column:ft,bias:_t}=ut;return generatedPosition(ct,pt,dt,ft,_t||Dt,true)}function eachMapping(ct,ut){const pt=decodedMappings(ct);const{names:dt,resolvedSources:ft}=ct;for(let ct=0;ct<pt.length;ct++){const _t=pt[ct];for(let pt=0;pt<_t.length;pt++){const mt=_t[pt];const ht=ct+1;const yt=mt[0];let vt=null;let St=null;let bt=null;let xt=null;if(mt.length!==1){vt=ft[mt[1]];St=mt[2]+1;bt=mt[3]}if(mt.length===5)xt=dt[mt[4]];ut({generatedLine:ht,generatedColumn:yt,source:vt,originalLine:St,originalColumn:bt,name:xt})}}}function sourceIndex(ct,ut){const{sources:pt,resolvedSources:dt}=ct;let ft=pt.indexOf(ut);if(ft===-1)ft=dt.indexOf(ut);return ft}function sourceContentFor(ct,ut){const{sourcesContent:pt}=ct;if(pt==null)return null;const dt=sourceIndex(ct,ut);return dt===-1?null:pt[dt]}function isIgnored(ct,ut){const{ignoreList:pt}=ct;if(pt==null)return false;const dt=sourceIndex(ct,ut);return dt===-1?false:pt.includes(dt)}function presortedDecodedMap(ct,ut){const pt=new Mt(clone(ct,[]),ut);cast(pt)._decoded=ct.mappings;return pt}function decodedMap(ct){return clone(ct,decodedMappings(ct))}function encodedMap(ct){return clone(ct,encodedMappings(ct))}function clone(ct,ut){return{version:ct.version,file:ct.file,names:ct.names,sourceRoot:ct.sourceRoot,sources:ct.sources,sourcesContent:ct.sourcesContent,mappings:ut,ignoreList:ct.ignoreList||ct.x_google_ignoreList}}function OMapping(ct,ut,pt,dt){return{source:ct,line:ut,column:pt,name:dt}}function GMapping(ct,ut){return{line:ct,column:ut}}function traceSegmentInternal(ct,ut,pt,dt,ft){let _t=memoizedBinarySearch(ct,dt,ut,pt);if(Nt){_t=(ft===Dt?upperBound:lowerBound)(ct,dt,_t)}else if(ft===Dt)_t++;if(_t===-1||_t===ct.length)return-1;return _t}function sliceGeneratedPositions(ct,ut,pt,dt,ft){let _t=traceSegmentInternal(ct,ut,pt,dt,Ft);if(!Nt&&ft===Dt)_t++;if(_t===-1||_t===ct.length)return[];const mt=Nt?dt:ct[_t][Et];if(!Nt)_t=lowerBound(ct,mt,_t);const ht=upperBound(ct,mt,_t);const yt=[];for(;_t<=ht;_t++){const ut=ct[_t];yt.push(GMapping(ut[kt]+1,ut[It]))}return yt}function generatedPosition(ct,ut,pt,dt,ft,_t){var mt,ht;pt--;if(pt<0)throw new Error(Pt);if(dt<0)throw new Error(Ot);const{sources:yt,resolvedSources:vt}=ct;let St=yt.indexOf(ut);if(St===-1)St=vt.indexOf(ut);if(St===-1)return _t?[]:GMapping(null,null);const bt=(mt=cast(ct))._bySourceMemos||(mt._bySourceMemos=yt.map(memoizedState));const xt=(ht=cast(ct))._bySources||(ht._bySources=buildBySources(decodedMappings(ct),bt));const $t=xt[St][pt];if($t==null)return _t?[]:GMapping(null,null);const Et=bt[St];if(_t)return sliceGeneratedPositions($t,Et,pt,dt,ft);const Ct=traceSegmentInternal($t,Et,pt,dt,ft);if(Ct===-1)return GMapping(null,null);const Tt=$t[Ct];return GMapping(Tt[kt]+1,Tt[It])}}))},3563:(ct,ut,pt)=>{const{parse:dt,format:ft}=pt(87016);const{pathToRegexp:_t,compile:mt,parse:ht}=pt(44985);ct.exports=Layer;function Layer(ct,ut,pt,dt={}){this.opts=dt;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(pt)?pt:[pt];for(const ct of ut){const ut=this.methods.push(ct.toUpperCase());if(this.methods[ut-1]==="GET")this.methods.unshift("HEAD")}for(let pt=0;pt<this.stack.length;pt++){const dt=this.stack[pt];const ft=typeof dt;if(ft!=="function")throw new Error(`${ut.toString()} \`${this.opts.name||ct}\`: \`middleware\` must be a function, not \`${ft}\``)}this.path=ct;this.regexp=_t(ct,this.paramNames,this.opts)}Layer.prototype.match=function(ct){return this.regexp.test(ct)};Layer.prototype.params=function(ct,ut,pt={}){for(let ct=ut.length,dt=0;dt<ct;dt++){if(this.paramNames[dt]){const ct=ut[dt];if(ct&&ct.length>0)pt[this.paramNames[dt].name]=ct?safeDecodeURIComponent(ct):ct}}return pt};Layer.prototype.captures=function(ct){return this.opts.ignoreCaptures?[]:ct.match(this.regexp).slice(1)};Layer.prototype.url=function(ct,ut){let pt=ct;const _t=this.path.replace(/\(\.\*\)/g,"");if(typeof ct!=="object"){pt=Array.prototype.slice.call(arguments);if(typeof pt[pt.length-1]==="object"){ut=pt[pt.length-1];pt=pt.slice(0,-1)}}const yt=mt(_t,{encode:encodeURIComponent,...ut});let vt;const St=ht(_t);let bt={};if(Array.isArray(pt)){for(let ct=St.length,ut=0,dt=0;ut<ct;ut++){if(St[ut].name)bt[St[ut].name]=pt[dt++]}}else if(St.some((ct=>ct.name))){bt=ct}else if(!ut){ut=ct}vt=yt(bt);if(ut&&ut.query){vt=dt(vt);if(typeof ut.query==="string"){vt.search=ut.query}else{vt.search=undefined;vt.query=ut.query}return ft(vt)}return vt};Layer.prototype.param=function(ct,ut){const{stack:pt}=this;const dt=this.paramNames;const middleware=function(pt,dt){return ut.call(this,pt.params[ct],pt,dt)};middleware.param=ct;const ft=dt.map((function(ct){return ct.name}));const _t=ft.indexOf(ct);if(_t>-1){pt.some((function(ct,ut){if(!ct.param||ft.indexOf(ct.param)>_t){pt.splice(ut,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(ct){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${ct}${this.path}`:ct;this.paramNames=[];this.regexp=_t(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(ct){try{return decodeURIComponent(ct)}catch{return ct}}},53777:(ct,ut,pt)=>{const dt=pt(77246);const ft=pt(58024);const _t=pt(93);const{pathToRegexp:mt}=pt(44985);const ht=pt(3563);const yt=pt(26675)("koa-router");ct.exports=Router;function Router(ct={}){if(!(this instanceof Router))return new Router(ct);this.opts=ct;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 vt of _t){function setMethodVerb(ct){Router.prototype[ct]=function(ut,pt,dt){if(typeof pt==="string"||pt instanceof RegExp){dt=Array.prototype.slice.call(arguments,2)}else{dt=Array.prototype.slice.call(arguments,1);pt=ut;ut=null}if(typeof pt!=="string"&&!(pt instanceof RegExp)&&(!Array.isArray(pt)||pt.length===0))throw new Error(`You have to provide a path when adding a ${ct} handler`);this.register(pt,[ct],dt,{name:ut});return this}}setMethodVerb(vt)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const ct=this;const ut=Array.prototype.slice.call(arguments);let pt;if(Array.isArray(ut[0])&&typeof ut[0][0]==="string"){const ft=ut[0];for(const _t of ft){ct.use.apply(ct,[_t].concat(ut.slice(1)))}return this}const dt=typeof ut[0]==="string";if(dt)pt=ut.shift();for(const yt of ut){if(yt.router){const vt=Object.assign(Object.create(Router.prototype),yt.router,{stack:[...yt.router.stack]});for(let St=0;St<vt.stack.length;St++){const bt=vt.stack[St];const xt=Object.assign(Object.create(ht.prototype),bt);if(pt)xt.setPrefix(pt);if(ct.opts.prefix)xt.setPrefix(ct.opts.prefix);ct.stack.push(xt);vt.stack[St]=xt}if(ct.params){function setRouterParams(ut){const pt=ut;for(const ut of pt){vt.param(ut,ct.params[ut])}}setRouterParams(Object.keys(ct.params))}}else{const $t=[];mt(ct.opts.prefix||"",$t);const Et=ct.opts.prefix&&$t.length;ct.register(pt||"([^/]*)",[],yt,{end:false,ignoreCaptures:!dt&&!Et})}}return this};Router.prototype.prefix=function(ct){ct=ct.replace(/\/$/,"");this.opts.prefix=ct;for(let ut=0;ut<this.stack.length;ut++){const pt=this.stack[ut];pt.setPrefix(ct)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const ct=this;const ut=function dispatch(ut,pt){yt("%s %s",ut.method,ut.path);const ft=ct.matchHost(ut.host);if(!ft){return pt()}const _t=ct.opts.routerPath||ut.newRouterPath||ut.path||ut.routerPath;const mt=ct.match(_t,ut.method);let ht;if(ut.matched){ut.matched.push.apply(ut.matched,mt.path)}else{ut.matched=mt.path}ut.router=ct;if(!mt.route)return pt();const vt=mt.pathAndMethod;const St=vt[vt.length-1];ut._matchedRoute=St.path;if(St.name){ut._matchedRouteName=St.name}ht=(ct.exclusive?[St]:vt).reduce((function(ct,ut){ct.push((function(ct,pt){ct.captures=ut.captures(_t,ct.captures);ct.params=ct.request.params=ut.params(_t,ct.captures,ct.params);ct.routerPath=ut.path;ct.routerName=ut.name;ct._matchedRoute=ut.path;if(ut.name){ct._matchedRouteName=ut.name}return pt()}));return ct.concat(ut.stack)}),[]);return dt(ht)(ut,pt)};ut.router=this;return ut};Router.prototype.allowedMethods=function(ct={}){const ut=this.methods;return function allowedMethods(pt,dt){return dt().then((function(){const dt={};if(!pt.status||pt.status===404){for(let ct=0;ct<pt.matched.length;ct++){const ut=pt.matched[ct];for(let ct=0;ct<ut.methods.length;ct++){const pt=ut.methods[ct];dt[pt]=pt}}const _t=Object.keys(dt);if(!~ut.indexOf(pt.method)){if(ct.throw){const ut=typeof ct.notImplemented==="function"?ct.notImplemented():new ft.NotImplemented;throw ut}else{pt.status=501;pt.set("Allow",_t.join(", "))}}else if(_t.length>0){if(pt.method==="OPTIONS"){pt.status=200;pt.body="";pt.set("Allow",_t.join(", "))}else if(!dt[pt.method]){if(ct.throw){const ut=typeof ct.methodNotAllowed==="function"?ct.methodNotAllowed():new ft.MethodNotAllowed;throw ut}else{pt.status=405;pt.set("Allow",_t.join(", "))}}}}}))}};Router.prototype.all=function(ct,ut,pt){if(typeof ut==="string"){pt=Array.prototype.slice.call(arguments,2)}else{pt=Array.prototype.slice.call(arguments,1);ut=ct;ct=null}if(typeof ut!=="string"&&!(ut instanceof RegExp)&&(!Array.isArray(ut)||ut.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(ut,_t,pt,{name:ct});return this};Router.prototype.redirect=function(ct,ut,pt){if(typeof ct==="symbol"||ct[0]!=="/"){ct=this.url(ct);if(ct instanceof Error)throw ct}if(typeof ut==="symbol"||ut[0]!=="/"&&!ut.includes("://")){ut=this.url(ut);if(ut instanceof Error)throw ut}return this.all(ct,(ct=>{ct.redirect(ut);ct.status=pt||301}))};Router.prototype.register=function(ct,ut,pt,dt={}){const ft=this;const{stack:_t}=this;if(Array.isArray(ct)){for(const _t of ct){ft.register.call(ft,_t,ut,pt,dt)}return this}const mt=new ht(ct,ut,pt,{end:dt.end===false?dt.end:true,name:dt.name,sensitive:dt.sensitive||this.opts.sensitive||false,strict:dt.strict||this.opts.strict||false,prefix:dt.prefix||this.opts.prefix||"",ignoreCaptures:dt.ignoreCaptures});if(this.opts.prefix){mt.setPrefix(this.opts.prefix)}for(let ct=0;ct<Object.keys(this.params).length;ct++){const ut=Object.keys(this.params)[ct];mt.param(ut,this.params[ut])}_t.push(mt);yt("defined route %s %s",mt.methods,mt.path);return mt};Router.prototype.route=function(ct){const ut=this.stack;for(let pt=ut.length,dt=0;dt<pt;dt++){if(ut[dt].name&&ut[dt].name===ct)return ut[dt]}return false};Router.prototype.url=function(ct,ut){const pt=this.route(ct);if(pt){const ct=Array.prototype.slice.call(arguments,1);return pt.url.apply(pt,ct)}return new Error(`No route found for name: ${String(ct)}`)};Router.prototype.match=function(ct,ut){const pt=this.stack;let dt;const ft={path:[],pathAndMethod:[],route:false};for(let _t=pt.length,mt=0;mt<_t;mt++){dt=pt[mt];yt("test %s %s",dt.path,dt.regexp);if(dt.match(ct)){ft.path.push(dt);if(dt.methods.length===0||~dt.methods.indexOf(ut)){ft.pathAndMethod.push(dt);if(dt.methods.length>0)ft.route=true}}}return ft};Router.prototype.matchHost=function(ct){const{host:ut}=this;if(!ut){return true}if(!ct){return false}if(typeof ut==="string"){return ct===ut}if(typeof ut==="object"&&ut instanceof RegExp){return ut.test(ct)}};Router.prototype.param=function(ct,ut){this.params[ct]=ut;for(let pt=0;pt<this.stack.length;pt++){const dt=this.stack[pt];dt.param(ct,ut)}return this};Router.url=function(ct){const ut=Array.prototype.slice.call(arguments,1);return ht.prototype.url.apply({path:ct},ut)}},86979:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.AsyncHooksContextManager=void 0;const dt=pt(46123);const ft=pt(90290);class AsyncHooksContextManager{constructor(){this._contexts=new Map;this._stack=[];this._asyncHook=ft.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 ct;return(ct=this._stack[this._stack.length-1])!==null&&ct!==void 0?ct:dt.ASYNC_ROOT_CONTEXT}with(ct,ut,pt,...dt){this._enterContext(ct);try{return ut.call(pt,...dt)}finally{this._exitContext()}}enable(){this._asyncHook.enable();return this}disable(){this._asyncHook.disable();this._contexts.clear();this._stack=[];return this}_init(ct,ut){if(ut==="TIMERWRAP")return;const pt=this._stack[this._stack.length-1];if(pt!==undefined){this._contexts.set(ct,pt)}}_destroy(ct){this._contexts.delete(ct)}_before(ct){const ut=this._contexts.get(ct);if(ut!==undefined){this._enterContext(ut)}}_after(){this._exitContext()}_enterContext(ct){this._stack.push(ct)}_exitContext(){this._stack.pop()}bind(ct,ut){if(typeof ut==="function"){const pt=this;const contextWrapper=function(...dt){return pt.with(ct,(()=>ut.apply(this,dt)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:ut.length});return contextWrapper}return ut}}ut.AsyncHooksContextManager=AsyncHooksContextManager},63259:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.AsyncLocalStorageContextManager=void 0;const dt=pt(46123);const ft=pt(90290);class AsyncLocalStorageContextManager{constructor(){this._asyncLocalStorage=new ft.AsyncLocalStorage}active(){var ct;return(ct=this._asyncLocalStorage.getStore())!==null&&ct!==void 0?ct:dt.ASYNC_ROOT_CONTEXT}with(ct,ut,pt,...dt){const ft=pt==null?ut:ut.bind(pt);return this._asyncLocalStorage.run(ct,ft,...dt)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(ct,ut){if(typeof ut==="function"){const pt=this;const contextWrapper=function(...dt){return pt.with(ct,(()=>ut.apply(this,dt)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:ut.length});return contextWrapper}return ut}}ut.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},44101:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.createContextManager=ut.isSemverGreaterThanOrEqualTo=void 0;ft(pt(86979),ut);ft(pt(63259),ut);var _t=pt(43349);Object.defineProperty(ut,"isSemverGreaterThanOrEqualTo",{enumerable:true,get:function(){return _t.isSemverGreaterThanOrEqualTo}});Object.defineProperty(ut,"createContextManager",{enumerable:true,get:function(){return _t.createContextManager}})},43349:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createContextManager=ut.isSemverGreaterThanOrEqualTo=void 0;const dt=pt(63259);const ft=pt(86979);const _t=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i;function isSemverGreaterThanOrEqualTo(ct,ut){const pt=_t.exec(ct);const dt=_t.exec(ut);if(pt&&dt){if(pt[1]===dt[1]&&pt[2]===dt[2]&&pt[3]===dt[3]&&pt[4]===dt[4]){return true}return gteString(pt[1],dt[1])||pt[1]===dt[1]&&gteString(pt[2],dt[2])||pt[1]===dt[1]&&pt[2]===dt[2]&&gteString(pt[3],dt[3])||pt[1]===dt[1]&&pt[2]===dt[2]&&pt[3]===dt[3]&&gteString(pt[4],dt[4])}return false}ut.isSemverGreaterThanOrEqualTo=isSemverGreaterThanOrEqualTo;function gteString(ct,ut){const pt=parseInt(ct,10);const dt=parseInt(ut,10);return pt>dt}function createContextManager(){const ct=isSemverGreaterThanOrEqualTo(process.version,"14.8.0")?dt.AsyncLocalStorageContextManager:ft.AsyncHooksContextManager;return new ct}ut.createContextManager=createContextManager},26733:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Bootstrap=ut.BootstrapStarter=void 0;const dt=pt(46123);const ft=pt(16928);const _t=pt(51169);const mt=pt(44101);const ht=pt(5982);const yt=pt(92364);class BootstrapStarter{constructor(){this.globalOptions={}}configure(ct={}){this.globalOptions=ct;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 ht.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new ht.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const ct=await(0,dt.loadModule)((0,ft.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=(ct===null||ct===void 0?void 0:ct.type)==="module"?"esm":"commonjs"}this.applicationContext=await(0,dt.initializeGlobalApplicationContext)({asyncContextManager:(0,mt.createContextManager)(),loggerFactory:_t.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 ct=this.applicationContext.get(dt.MidwayApplicationManager);const ut=ct.getApplication("socketIO");(0,yt.setupWorker)(ut)}}const ct=this.applicationContext.get(dt.MidwayFrameworkService);if(!ct.getMainApp()){throw new dt.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,dt.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,dt.isTypeScriptEnvironment)()){return(0,ft.join)(this.appDir,"src")}else{return(0,ft.join)(this.appDir,"dist")}}}ut.BootstrapStarter=BootstrapStarter;class Bootstrap{static configure(ct={}){this.configured=true;if(!this.logger&&!ct.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(ct.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}ct.logger=this.logger}else{this.logger=this.logger||ct.logger}if(ct.appDir&&ct.appDir!==process.cwd()){process.chdir(ct.appDir)}this.getStarter().configure(ct);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((ct=>{this.logger.error(ct);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(ct){this.logger.info("[midway:bootstrap] receive signal %s, closing",ct);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(ct){this.logger.error("[midway:bootstrap] close with error: ",ct);process.exit(1)}}static onExit(ct){this.logger.info("[midway:bootstrap] exit with code:%s",ct)}static uncaughtExceptionHandler(ct){if(!(ct instanceof Error)){ct=new Error(String(ct))}if(ct.name==="Error"){ct.name="unhandledExceptionError"}this.logger.error(ct)}static unhandledRejectionHandler(ct){if(!(ct instanceof Error)){const ut=new Error(String(ct));if(ct){if(ct.name)ut.name=ct.name;if(ct.message)ut.message=ct.message;if(ct.stack)ut.stack=ct.stack}ct=ut}if(ct.name==="Error"){ct.name="unhandledRejectionError"}this.logger.error(ct)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}ut.Bootstrap=Bootstrap;Bootstrap.configured=false;Bootstrap.bootstrapLoggerFactory=new _t.MidwayLoggerContainer},84575:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.setupStickyMaster=ut.AbstractForkManager=ut.ClusterManager=ut.BootstrapStarter=ut.Bootstrap=void 0;ft(pt(82516),ut);var _t=pt(26733);Object.defineProperty(ut,"Bootstrap",{enumerable:true,get:function(){return _t.Bootstrap}});Object.defineProperty(ut,"BootstrapStarter",{enumerable:true,get:function(){return _t.BootstrapStarter}});var mt=pt(93772);Object.defineProperty(ut,"ClusterManager",{enumerable:true,get:function(){return mt.ClusterManager}});var ht=pt(84338);Object.defineProperty(ut,"AbstractForkManager",{enumerable:true,get:function(){return ht.AbstractForkManager}});var yt=pt(92364);Object.defineProperty(ut,"setupStickyMaster",{enumerable:true,get:function(){return yt.setupStickyMaster}})},82516:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},84338:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.AbstractForkManager=void 0;const dt=pt(70857);const ft=pt(39023);const _t=pt(53599);const mt=pt(24434);const ht=pt(39023);const yt=(0,ht.debuglog)("midway:bootstrap");class AbstractForkManager{constructor(ct){this.options=ct;this.reforks=[];this.disconnectCount=0;this.unexpectedCount=0;this.disconnects={};this.hub=new mt.EventEmitter;this.workers=new Map;this.isClosing=false;ct.count=ct.count||dt.cpus().length-1;ct.refork=ct.refork!==false;ct.limit=ct.limit||60;ct.duration=ct.duration||6e4;ct.logger=ct.logger||console;ct.workerInitTimeout=ct.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:ct.workerInitTimeout})}async start(){yt("Start manager with options: %j",this.options);this.bindWorkerDisconnect((ct=>{yt(" - worker(%s): trigger event = disconnect",this.getWorkerId(ct));const ut=this.options.logger[ct["disableRefork"]?"info":"error"];this.disconnectCount++;const pt=this.isWorkerDead(ct);if(pt){yt(" - worker(%s): worker is dead",this.getWorkerId(ct));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,_t.logDate)(),process.pid,this.getWorkerId(ct));return}if(ct["disableRefork"]){yt(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(ct));ut("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,_t.logDate)(),process.pid,this.getWorkerId(ct));return}this.disconnects[this.getWorkerId(ct)]=(0,_t.logDate)();this.tryToRefork(ct)}));this.bindWorkerExit(((ct,ut,pt)=>{yt(" - worker(%s): trigger event = exit",this.getWorkerId(ct));this.workers.delete(this.getWorkerId(ct));if(ct["disableRefork"]){return}const dt=!!this.disconnects[this.getWorkerId(ct)];yt(" - worker(%s): isExpected=%s",this.getWorkerId(ct),dt);if(dt){delete this.disconnects[this.getWorkerId(ct)];return}yt(" - worker(%s): isWorkerDead=%s",this.getWorkerId(ct),this.isWorkerDead(ct));if(this.isWorkerDead(ct)){return}yt(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(ct);this.onUnexpected(ct,ut,pt)}));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 ct=0;ct<this.options.count;ct++){const ct=this.createWorker();yt(" - worker(%s) created",this.getWorkerId(ct));this.eventBus.addWorker(ct);this.workers.set(this.getWorkerId(ct),ct)}await this.eventBus.start()}tryToRefork(ct){if(this.allowRefork()){yt(" - worker(%s): allow refork and will fork new",this.getWorkerId(ct));const ut=this.createWorker(ct);this.workers.set(this.getWorkerId(ut),ut);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,_t.logDate)(),process.pid,this.getWorkerId(ut),ut["state"]);this.eventBus.addWorker(ut)}else{yt(" - worker(%s): forbidden refork and will stop",this.getWorkerId(ct));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,_t.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const ct=this.reforks.push(Date.now());if(ct>this.options.limit){this.reforks.shift()}const ut=this.reforks[this.reforks.length-1]-this.reforks[0];const pt=this.reforks.length<this.options.limit||ut>this.options.duration;if(!pt){this.hub.emit("reachReforkLimit")}return pt}onerror(ct){if(!ct){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,_t.logDate)(),process.pid,ct.stack);this.options.logger.error(ct);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(ct,ut,pt){const dt=ct.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const mt=new Error(ft.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(ct),ut,pt,dt,ct[dt],ct["state"]));mt.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,_t.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,mt.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,_t.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(ct,ut){await this.closeWorker(ct);await Promise.race([(0,mt.once)(ct,"exit"),(0,_t.sleep)(ut)]);if(ct.killed)return;(ct.process||ct).kill("SIGKILL")}async stop(ct=2e3){yt("run close");this.isClosing=true;await this.eventBus.stop();for(const ut of this.workers.values()){ut["disableRefork"]=true;await this.killWorker(ut,ct)}if(this.exitListener){await this.exitListener()}}hasWorker(ct){return this.workers.has(ct)}getWorker(ct){return this.workers.get(ct)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(ct){this.exitListener=ct}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(ct){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",ct);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(ct){this.options.logger.error("[midway:master] close with error: ",ct);process.exit(1)}}}onMasterExit(ct){this.options.logger.info("[bootstrap:master] exit with code:%s",ct)}}ut.AbstractForkManager=AbstractForkManager},93772:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ClusterManager=void 0;const dt=pt(5982);const ft=pt(84338);const _t=pt(29907);const mt=pt(39023);const ht=pt(46123);const yt=(0,mt.debuglog)("midway:bootstrap");class ClusterManager extends ft.AbstractForkManager{constructor(ct={}){super(ct);this.options=ct;ct.args=ct.args||[];ct.execArgv=ct.execArgv||[];if((0,ht.isTypeScriptEnvironment)()){ct.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(_t["setupPrimary"]){_t["setupPrimary"](this.options)}else if(_t["setupMaster"]){_t["setupMaster"](this.options)}return _t.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(ct){yt("Bind cluster.disconnect event");_t.on("disconnect",ct)}bindWorkerExit(ct){yt("Bind cluster.exit event");_t.on("exit",ct)}getWorkerId(ct){return String(ct.process.pid)}isWorkerDead(ct){return ct.isDead()}closeWorker(ct){ct.kill("SIGTERM")}createEventBus(ct){return new dt.ChildProcessEventBus(ct)}isPrimary(){return!_t.isWorker}}ut.ClusterManager=ClusterManager},92364:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.setupWorker=ut.setupStickyMaster=void 0;const dt=pt(29907);const ft=pt(76982);const randomId=()=>(0,ft.randomBytes)(8).toString("hex");function setupStickyMaster(ct,ut={}){const pt={loadBalancingMethod:"least-connection",...ut};const ft=new Map;const _t=/sid=([\w-]{20})/;let mt=0;const computeWorkerId=ct=>{const ut=_t.exec(ct);if(ut){const ct=ut[1];const pt=ft.get(ct);if(pt&&dt.workers[pt]){return pt}}switch(pt.loadBalancingMethod){case"random":{const ct=Object.keys(dt.workers);return ct[Math.floor(Math.random()*ct.length)]}case"round-robin":{const ct=Object.keys(dt.workers);mt++;if(mt>=ct.length){mt=0}return ct[mt]}case"least-connection":let ct;for(const ut in dt.workers){const pt=dt.workers[ut];if(ct===undefined){ct=pt}else{const ut=pt["clientsCount"]||0;const dt=ct["clientsCount"]||0;if(ut<dt){ct=pt}}}return ct.id}};ct.on("connection",(ct=>{let ut,pt;const sendCallback=ut=>{if(ut){ct.destroy()}};ct.on("data",(ft=>{let _t="utf-8";let mt=ft.toString(_t);if(ut&&pt){dt.workers[ut].send({type:"sticky:http-chunk",data:mt,encoding:_t,connectionId:pt},sendCallback);return}ut=computeWorkerId(mt);const ht=!(mt.startsWith("GET")||mt.substring(0,mt.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(mt.startsWith("POST")&&mt.includes("multipart/form-data")){_t="base64";mt=ft.toString("base64")}ct.pause();if(ht){pt=randomId()}dt.workers[ut].send({type:"sticky:connection",data:mt,encoding:_t,connectionId:pt},ct,{keepOpen:ht},sendCallback)}))}));ct.on("request",(ct=>{ct.on("data",(()=>{}))}));dt.on("message",((ct,{type:ut,data:dt})=>{switch(ut){case"sticky:connection":ft.set(dt,ct.id);if(pt.loadBalancingMethod==="least-connection"){ct["clientsCount"]=(ct["clientsCount"]||0)+1}break;case"sticky:disconnection":ft.delete(dt);if(pt.loadBalancingMethod==="least-connection"){ct["clientsCount"]--}break}}))}ut.setupStickyMaster=setupStickyMaster;function setupWorker(ct){const ut=new Map;process.on("message",(({type:pt,data:dt,encoding:ft,connectionId:_t},mt)=>{switch(pt){case"sticky:connection":if(!mt){return}ct.httpServer.emit("connection",mt);mt.emit("data",Buffer.from(dt,ft));mt.resume();if(_t){ut.set(_t,mt);mt.on("close",(()=>{ut.delete(_t)}))}break;case"sticky:http-chunk":{const ct=ut.get(_t);if(ct){ct.emit("data",Buffer.from(dt,ft))}}}}));const ignoreError=()=>{};ct.engine.on("connection",(ct=>{process.send({type:"sticky:connection",data:ct.id},ignoreError);ct.once("close",(()=>{process.send({type:"sticky:disconnection",data:ct.id},ignoreError)}))}))}ut.setupWorker=setupWorker},53599:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.sleep=ut.logDate=void 0;function logDate(){const ct=new Date;let ut=ct.getDate();if(ut<10){ut="0"+ut}let pt=ct.getMonth()+1;if(pt<10){pt="0"+pt}let dt=ct.getHours();if(dt<10){dt="0"+dt}let ft=ct.getMinutes();if(ft<10){ft="0"+ft}let _t=ct.getSeconds();if(_t<10){_t="0"+_t}let mt=ct.getMilliseconds();if(mt<10){mt="00"+mt}else if(mt<100){mt="0"+mt}return ct.getFullYear()+"-"+pt+"-"+ut+" "+dt+":"+ft+":"+_t+"."+mt}ut.logDate=logDate;async function sleep(ct){return new Promise((ut=>{setTimeout(ut,ct)}))}ut.sleep=sleep},64080:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.multiCaching=ut.createCache=ut.caching=void 0;const dt=pt(48851);const ft=pt(87932);async function caching(ct,ut){if(ct==="memory"){const ct=(0,ft.memoryStore)(ut);return createCache(ct,ut)}if(typeof ct==="function"){const pt=await ct(ut);return createCache(pt,ut)}return createCache(ct,ut)}ut.caching=caching;function createCache(ct,ut){return{wrap:async(pt,ft,_t)=>(0,dt.coalesceAsync)(pt,(async()=>{const mt=await ct.get(pt);if(mt===undefined){const ut=await ft();const dt=typeof _t==="function"?_t(ut):_t;await ct.set(pt,ut,dt);return ut}else if(ut===null||ut===void 0?void 0:ut.refreshThreshold){const ht=typeof _t==="function"?_t(mt):_t;const yt=await ct.ttl(pt);if(yt!==-1&&yt<ut.refreshThreshold){(0,dt.coalesceAsync)(`+++${pt}`,ft).then((ut=>ct.set(pt,ut,ht)))}}return mt})),store:ct,del:ut=>ct.del(ut),get:ut=>ct.get(ut),set:(ut,pt,dt)=>ct.set(ut,pt,dt),reset:()=>ct.reset(),methodWrap:async(pt,ft,_t,mt)=>(0,dt.coalesceAsync)(pt,(async()=>{const ht=await ct.get(pt);if(ht===undefined){const ut=await ft(..._t);const dt=typeof mt==="function"?mt(ut):mt;await ct.set(pt,ut,dt);return ut}else if(ut===null||ut===void 0?void 0:ut.refreshThreshold){const yt=typeof mt==="function"?mt(ht):mt;const vt=await ct.ttl(pt);if(vt!==-1&&vt<ut.refreshThreshold){(0,dt.coalesceAsync)(`+++${pt}`,(()=>ft(..._t))).then((ut=>ct.set(pt,ut,yt)))}}return ht}))}}ut.createCache=createCache;function multiCaching(ct){const get=async ut=>{for(const pt of ct){try{const ct=await pt.get(ut);if(ct!==undefined)return ct}catch(ct){}}};const set=async(ut,pt,dt)=>{await Promise.all(ct.map((ct=>ct.set(ut,pt,dt))))};return{get:get,set:set,del:async ut=>{await Promise.all(ct.map((ct=>ct.del(ut))))},async wrap(ut,pt,dt){let ft;let _t=0;for(;_t<ct.length;_t++){try{ft=await ct[_t].get(ut);if(ft!==undefined)break}catch(ct){}}if(ft===undefined){const ct=await pt();const ft=typeof dt==="function"?dt(ct):dt;await set(ut,ct,ft);return ct}else{const mt=typeof dt==="function"?dt(ft):dt;Promise.all(ct.slice(0,_t).map((ct=>ct.set(ut,ft,mt)))).then();ct[_t].wrap(ut,pt,dt).then()}return ft},reset:async()=>{await Promise.all(ct.map((ct=>ct.reset())))},mget:async(...ut)=>{const pt=new Array(ut.length).fill(undefined);for(const dt of ct){if(pt.every((ct=>ct!==undefined)))break;try{const ct=await dt.store.mget(...ut);ct.forEach(((ct,ut)=>{if(pt[ut]===undefined&&ct!==undefined)pt[ut]=ct}))}catch(ct){}}return pt},mset:async(ut,pt)=>{await Promise.all(ct.map((ct=>ct.store.mset(ut,pt))))},mdel:async(...ut)=>{await Promise.all(ct.map((ct=>ct.store.mdel(...ut))))},methodWrap:async(ut,pt,dt,ft)=>{let _t;let mt=0;for(;mt<ct.length;mt++){try{_t=await ct[mt].get(ut);if(_t!==undefined)break}catch(ct){}}if(_t===undefined){const ct=await pt(...dt);const _t=typeof ft==="function"?ft(ct):ft;await set(ut,ct,_t);return ct}else{const ht=typeof ft==="function"?ft(_t):ft;Promise.all(ct.slice(0,mt).map((ct=>ct.set(ut,_t,ht)))).then();ct[mt].methodWrap(ut,pt,dt,ft).then()}return _t}}}ut.multiCaching=multiCaching},8869:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ft(pt(64080),ut);ft(pt(87932),ut);ft(pt(91724),ut)},48851:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.coalesceAsync=void 0;const pt=new Map;async function coalesceAsync(ct,ut){if(!hasKey(ct)){addKey(ct);try{const pt=await Promise.resolve(ut());coalesce({key:ct,result:pt});return pt}catch(ut){coalesce({key:ct,error:ut});throw ut}}return enqueue(ct)}ut.coalesceAsync=coalesceAsync;function hasKey(ct){return pt.has(ct)}function addKey(ct){pt.set(ct,[])}function removeKey(ct){pt.delete(ct)}function addCallbackToKey(ct,ut){const dt=getCallbacksByKey(ct);dt.push(ut);pt.set(ct,dt)}function getCallbacksByKey(ct){var ut;return(ut=pt.get(ct))!==null&&ut!==void 0?ut:[]}function enqueue(ct){return new Promise(((ut,pt)=>{const dt={resolve:ut,reject:pt};addCallbackToKey(ct,dt)}))}function dequeue(ct){const ut=getCallbacksByKey(ct);removeKey(ct);return ut}function coalesce(ct){const{key:ut,error:pt,result:dt}=ct;dequeue(ut).forEach((ct=>{if(pt){ct.reject(pt)}else{ct.resolve(dt)}}))}},87932:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.memoryStore=void 0;const dt=pt(57223);const ft=pt(19944);function clone(ct){if(typeof ct==="object"&&ct!==null){return ft(ct)}return ct}function memoryStore(ct){var ut;const pt=(ct===null||ct===void 0?void 0:ct.shouldCloneBeforeSet)!==false;const ft=(ut=ct===null||ct===void 0?void 0:ct.isCacheable)!==null&&ut!==void 0?ut:ct=>ct!==undefined;const _t={ttlAutopurge:true,...ct,max:(ct===null||ct===void 0?void 0:ct.max)||500,ttl:(ct===null||ct===void 0?void 0:ct.ttl)!==undefined?ct.ttl:0};const mt=new dt(_t);return{async del(ct){mt.delete(ct)},get:async ct=>mt.get(ct),keys:async()=>[...mt.keys()],mget:async(...ct)=>ct.map((ct=>mt.get(ct))),async mset(ct,ut){const dt={ttl:ut!==undefined?ut:_t.ttl};for(const[ut,_t]of ct){if(!ft(_t))throw new Error(`no cacheable value ${JSON.stringify(_t)}`);if(pt)mt.set(ut,clone(_t),dt);else mt.set(ut,_t,dt)}},async mdel(...ct){for(const ut of ct)mt.delete(ut)},async reset(){mt.clear()},ttl:async ct=>mt.getRemainingTTL(ct),async set(ct,ut,dt){if(!ft(ut))throw new Error(`no cacheable value ${JSON.stringify(ut)}`);if(pt)ut=clone(ut);const ht=dt!==undefined?dt:_t.ttl;mt.set(ct,ut,{ttl:ht})},get calculatedSize(){return mt.calculatedSize},get size(){return mt.size},dump:()=>mt.dump(),load:(...ct)=>mt.load(...ct)}}ut.memoryStore=memoryStore},91724:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},68805:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.CacheConfiguration=ut.getClassMethodDefaultCacheKey=void 0;const _t=pt(46123);const mt=pt(42696);const ht=pt(91761);function getClassMethodDefaultCacheKey(ct,ut){return ct.name+"-"+(0,_t.getProviderUUId)(ct)+"-"+ut}ut.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;let yt=class CacheConfiguration{async onReady(ct){this.cacheService=await ct.getAsync(ht.CachingFactory);this.decoratorService.registerMethodHandler(mt.CACHE_DECORATOR_KEY,(({target:ct,propertyName:ut,metadata:pt})=>{if(!pt.cacheKey){pt.cacheKey=getClassMethodDefaultCacheKey(ct,ut)}return{around:async ct=>{let ut=pt.cacheKey;const dt=this.cacheService.get(pt.cacheInstanceName);if(typeof ut==="function"){ut=await ut({methodArgs:ct.args,ctx:ct.target[_t.REQUEST_OBJ_CTX_KEY],target:ct.target})}if(typeof ut==="string"){return dt.methodWrap(ut,ct.proceed,ct.args,pt.ttl)}else{return ct.proceed(...ct.args)}}}}))}};dt([(0,_t.Inject)(),ft("design:type",_t.MidwayDecoratorService)],yt.prototype,"decoratorService",void 0);yt=dt([(0,_t.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],yt);ut.CacheConfiguration=yt},42696:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Caching=ut.CACHE_DECORATOR_KEY=void 0;const dt=pt(46123);ut.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(ct,pt,ft){if(typeof pt==="number"){ft=pt;pt=undefined}return(0,dt.createCustomMethodDecorator)(ut.CACHE_DECORATOR_KEY,{cacheInstanceName:ct,cacheKey:pt,ttl:ft})}ut.Caching=Caching},91761:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.CachingFactory=void 0;const _t=pt(46123);const mt=pt(8869);let ht=class CachingFactory extends _t.ServiceFactory{async init(){await this.initClients(this.cacheManagerConfig)}async createClient(ct,ut){if(Array.isArray(ct.store)){const pt=[];for(const dt of ct.store){if(typeof dt==="string"){if(!this.has(dt)){throw new _t.MidwayCommonError(`cache instance "${dt}" not found in "${ut}", please check your configuration.`)}pt.push(this.get(dt))}else if(typeof dt==="function"){pt.push(await dt())}else if(dt["wrap"]){pt.push(dt["wrap"])}else if(typeof dt==="object"){if(typeof dt.store==="function"){dt.store=await dt.store(dt["options"]||{},this.applicationContext)}if(!dt.store){throw new _t.MidwayCommonError(`cache instance "${ut}" store is undefined, please check your configuration.`)}pt.push(await(0,mt.caching)(dt.store,dt["options"]))}else{throw new _t.MidwayCommonError("invalid cache config")}}return await(0,mt.multiCaching)(pt)}else{if(typeof ct.store==="function"){ct.store=await ct.store(ct["options"]||{},this.applicationContext)}if(!ct.store){throw new _t.MidwayCommonError(`cache instance "${ut}" store is undefined, please check your configuration.`)}return await(0,mt.caching)(ct.store,ct["options"])}}getName(){return"cache-manager"}getCaching(ct){return this.get(ct)}getMultiCaching(ct){return this.get(ct)}};dt([(0,_t.Config)("cacheManager"),ft("design:type",Object)],ht.prototype,"cacheManagerConfig",void 0);dt([(0,_t.ApplicationContext)(),ft("design:type",Object)],ht.prototype,"applicationContext",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],ht.prototype,"init",null);ht=dt([(0,_t.Provide)(),(0,_t.Scope)(_t.ScopeEnum.Singleton)],ht);ut.CachingFactory=ht},96955:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.CacheManager=ut.getClassMethodDefaultCacheKey=ut.Configuration=void 0;var _t=pt(68805);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.CacheConfiguration}});Object.defineProperty(ut,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return _t.getClassMethodDefaultCacheKey}});ft(pt(43488),ut);ft(pt(91761),ut);ft(pt(42696),ut);ut.CacheManager=pt(8869);ft(pt(93730),ut)},43488:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},93730:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createRedisStore=void 0;const dt=pt(46123);const getVal=ct=>JSON.stringify(ct)||'"undefined"';function createRedisStore(ct){return async(ut,pt)=>{const{RedisServiceFactory:ft}=(0,dt.safeRequire)("@midwayjs/redis");const _t=await pt.getAsync(ft);const mt=_t.get(ct);return createStore(mt,ut)}}ut.createRedisStore=createRedisStore;function createStore(ct,ut){const pt=(ut===null||ut===void 0?void 0:ut.isCacheable)||(ct=>ct!==undefined&&ct!==null);const keys=ut=>ct.keys(ut);return{async get(ut){const pt=await ct.get(ut);if(pt===undefined||pt===null)return undefined;else{try{return JSON.parse(pt)}catch(ct){return pt}}},async set(ft,_t,mt){if(!pt(_t))throw new dt.MidwayCommonError(`"${_t}" is not a cacheable value`);const ht=mt===undefined?ut===null||ut===void 0?void 0:ut.ttl:mt;if(ht!==undefined&&ht!==0)await ct.set(ft,getVal(_t),"PX",ht);else await ct.set(ft,getVal(_t))},async mset(ft,_t){const mt=_t===undefined?ut===null||ut===void 0?void 0:ut.ttl:_t;if(mt!==undefined&&mt!==0){const ut=ct.multi();for(const[ct,_t]of ft){if(!pt(_t))throw new dt.MidwayCommonError(`"${getVal(_t)}" is not a cacheable value`);ut.set(ct,getVal(_t),"PX",mt)}await ut.exec()}else await ct.mset(ft.flatMap((([ct,ut])=>{if(!pt(ut))throw new Error(`"${getVal(ut)}" is not a cacheable value`);return[ct,getVal(ut)]})))},mget:(...ut)=>ct.mget(ut).then((ct=>ct.map((ct=>{if(ct===null||ct===undefined){return undefined}else{try{return JSON.parse(ct)}catch(ut){return ct}}})))),async mdel(...ut){await ct.del(ut)},async del(ut){await ct.del(ut)},ttl:async ut=>ct.pttl(ut),keys:(ct="*")=>keys(ct),reset:()=>{throw new dt.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:pt}}},4074:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Cookie=void 0;const dt=pt(42613);const ft=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const _t=/^(?:none|lax|strict)$/i;class Cookie{constructor(ct,ut,pt){dt(ft.test(ct),"argument name is invalid");dt(!ut||ft.test(ut),"argument value is invalid");this.name=ct;this.value=ut||"";this.attrs=mergeDefaultAttrs(pt);dt(!this.attrs.path||ft.test(this.attrs.path),"argument option path is invalid");dt(!this.attrs.domain||ft.test(this.attrs.domain),"argument option domain is invalid");dt(!this.attrs.sameSite||this.attrs.sameSite===true||_t.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!ut){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let ct=this.toString();const ut=this.attrs;if(ut.path)ct+="; path="+ut.path;const pt=typeof ut.maxAge==="string"?parseInt(ut.maxAge,10):ut.maxAge;if(pt){ct+="; max-age="+Math.round(pt/1e3);ut.expires=new Date(Date.now()+pt)}if(ut.expires)ct+="; expires="+ut.expires.toUTCString();if(ut.domain)ct+="; domain="+ut.domain;if(ut.sameSite)ct+="; samesite="+(ut.sameSite===true?"strict":ut.sameSite.toLowerCase());if(ut.secure)ct+="; secure";if(ut.httpOnly)ct+="; httponly";if(ut.priority)ct+="; priority="+ut.priority;if(ut.partitioned)ct+="; partitioned";return ct}}ut.Cookie=Cookie;const mt=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(ct){const ut={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!ct)return ut;for(let pt=0;pt<mt.length;pt++){const dt=mt[pt];if(dt in ct)ut[dt]=ct[dt]}return ut}},11033:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.urlSafeDecode=ut.urlSafeEncode=ut.Cookies=void 0;const dt=pt(42613);const ft=pt(4074);const _t=pt(5693);const mt=pt(86054);const ht=Symbol("midwayCookies:keysArray");const yt=Symbol("midwayCookies:keys");const vt=new Map;class Cookies{constructor(ct,ut,pt,dt){var ft;this[ht]=ut?[].concat(ut):ut;this._defaultCookieOptions=pt;this._defaultGetCookieOptions=dt;this.ctx=ct;this.secure=(ft=pt===null||pt===void 0?void 0:pt.secure)!==null&&ft!==void 0?ft:this.ctx.secure;this.app=ct.app}get keys(){if(!this[yt]){const ct=this[ht];dt(Array.isArray(ct),".keys required for encrypt/sign cookies");const ut=vt.get(ct);if(ut){this[yt]=ut}else{this[yt]=new _t.Keygrip(this[ht]);vt.set(ct,this[yt])}}return this[yt]}get(ct,ut){ut=Object.assign({},this._defaultGetCookieOptions||{},ut);const pt=computeSigned(ut);const dt=this.ctx.get("cookie");if(!dt)return;const ft=dt.match(getPattern(ct));if(!ft)return;let _t=ft[1];if(!ut.encrypt&&!pt)return _t;if(pt){const ut=ct+".sig";const pt=this.get(ut,{signed:false});if(!pt)return;const dt=ct+"="+_t;const ft=this.keys.verify(dt,pt);if(ft<0){this.set(ut,null,{path:"/",signed:false});return}if(ft>0){this.set(ut,this.keys.sign(dt),{signed:false})}return _t}_t=urlSafeDecode(_t);const mt=this.keys.decrypt(_t);if(mt===null||mt===void 0?void 0:mt.value){return mt.value.toString()}return undefined}set(ct,ut,pt){if(!pt&&typeof ut!=="string"){pt=ut;ut=""}pt=Object.assign({},this._defaultCookieOptions,pt);const dt=computeSigned(pt);ut=ut||"";if(!this.secure&&pt.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let _t=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(_t))_t=[_t];if(pt.encrypt){ut=ut&&urlSafeEncode(this.keys.encrypt(ut))}if(ut.length>4093){this.app.emit("cookieLimitExceed",{name:ct,value:ut,ctx:this.ctx})}const mt=this.ctx.get("user-agent");if(pt.sameSite&&typeof pt.sameSite==="string"&&pt.sameSite.toLowerCase()==="none"){if(!this.secure||mt&&!this.isSameSiteNoneCompatible(mt)){pt.sameSite=false}}if(pt.partitioned){if(!this.secure||!mt||mt&&!this.isPartitionedCompatible(mt)){pt.partitioned=false}}if(pt.partitioned&&pt.removeUnpartitioned){const ut=pt.overwrite;if(ut){pt.overwrite=false;_t=ignoreCookiesByName(_t,ct)}const mt=Object.assign({},pt,{partitioned:false});const ht=new ft.Cookie(ct,"",mt);if(pt.secure===undefined)ht.attrs.secure=this.secure;_t=pushCookie(_t,ht);if(dt){ht.name+=".sig";_t=ignoreCookiesByName(_t,ht.name);_t=pushCookie(_t,ht)}}if(pt.priority){if(!mt||mt&&!this.isPriorityCompatible(mt)){pt.priority=undefined}}const ht=new ft.Cookie(ct,ut,pt);if(pt.secure===undefined)ht.attrs.secure=this.secure;_t=pushCookie(_t,ht);if(dt){ht.value=ut&&this.keys.sign(ht.toString());ht.name+=".sig";_t=pushCookie(_t,ht)}this.ctx.set("set-cookie",_t);return this}isSameSiteNoneCompatible(ct){const ut=this.parseChromiumAndMajorVersion(ct);if(ut.chromium&&ut.majorVersion){return ut.majorVersion>=80}return(0,mt.isSameSiteNoneCompatible)(ct)}isPartitionedCompatible(ct){const ut=this.parseChromiumAndMajorVersion(ct);if(ut.chromium&&ut.majorVersion){return ut.majorVersion>=114}return false}parseChromiumAndMajorVersion(ct){if(!this.uaParseResult){const ut=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(ct);if(!ut)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(ut[1])}}return this.uaParseResult}isPriorityCompatible(ct){const ut=this.parseChromiumAndMajorVersion(ct);if(ut.chromium&&ut.majorVersion){return ut.majorVersion>=81}return false}}ut.Cookies=Cookies;const St=new Map;function getPattern(ct){const ut=St.get(ct);if(ut)return ut;const pt=new RegExp("(?:^|;) *"+ct.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");St.set(ct,pt);return pt}function computeSigned(ct){if(ct.encrypt)return false;return ct.signed!==false}function pushCookie(ct,ut){if(ut.attrs.overwrite){ct=ignoreCookiesByName(ct,ut.name)}ct.push(ut.toHeader());return ct}function ignoreCookiesByName(ct,ut){const pt=`${ut}=`;return ct.filter((ct=>!ct.startsWith(pt)))}function urlSafeEncode(ct){return ct.replace(/\+/g,"-").replace(/\//g,"_")}ut.urlSafeEncode=urlSafeEncode;function urlSafeDecode(ct){return ct.replace(/-/g,"+").replace(/_/g,"/")}ut.urlSafeDecode=urlSafeDecode},60990:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ft(pt(33249),ut);ft(pt(11033),ut)},33249:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},5693:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Keygrip=void 0;const dt=pt(42613);const ft=pt(39023);const _t=pt(76982);const mt=pt(48978);const ht=(0,ft.debuglog)("midway:cookies");const yt={"/":"_","+":"-","=":""};class Keygrip{constructor(ct){dt(Array.isArray(ct)&&ct.length,"keys must be provided and should be an array");this.keys=ct;this.hash="sha256"}encrypt(ct,ut){ut=ut||this.keys[0];try{ct=String(ct);const pt=getAlgorithm();const dt=(0,_t.randomBytes)(64);const ft=(0,_t.randomBytes)(16);const mt=Math.floor(Math.random()*(99999-1e4+1))+1e4;const ht=deriveKeyFromPassword(ut,dt,Math.floor(mt*.47+1337));const yt=(0,_t.createCipheriv)(pt,ht,ft);const vt=Buffer.concat([yt.update(ct,"utf8"),yt.final()]);const St=yt.getAuthTag();const bt=Buffer.concat([dt,ft,St,Buffer.from(mt.toString()),vt]).toString("hex");return getEncryptedPrefix()+bt}catch(ct){ht("crypt error",ct.stack);return undefined}}decrypt(ct,ut){if(!ut){const ut=this.keys;for(let pt=0;pt<ut.length;pt++){const dt=this.decrypt(ct,ut[pt]);if(dt!==false)return{value:dt,index:pt}}return false}try{const pt=getAlgorithm();const dt=ct.split(getEncryptedPrefix());if(dt.length!==2){return void 0}else{ct=dt[1]}const ft=Buffer.from(ct,"hex");const mt=ft.slice(0,64);const ht=ft.slice(64,80);const yt=ft.slice(80,96);const vt=parseInt(ft.slice(96,101).toString("utf-8"),10);const St=ft.slice(101);const bt=deriveKeyFromPassword(ut,mt,Math.floor(vt*.47+1337));const xt=(0,_t.createDecipheriv)(pt,bt,ht);xt.setAuthTag(yt);return xt.update(St,"binary","utf-8")+xt.final("utf-8")}catch(ct){ht("crypt error",ct.stack);return false}}sign(ct,ut){ut=ut||this.keys[0];return(0,_t.createHmac)(this.hash,ut).update(ct).digest("base64").replace(/\/|\+|=/g,(ct=>yt[ct]))}verify(ct,ut){const pt=this.keys;for(let dt=0;dt<pt.length;dt++){if(mt(Buffer.from(ut),Buffer.from(this.sign(ct,pt[dt])))){ht("data %s match key %s",ct,pt[dt]);return dt}}return-1}}ut.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(ct,ut,pt){return(0,_t.pbkdf2Sync)(ct,ut,pt,32,"sha512")}},83872:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.BaseFramework=void 0;const _t=pt(6192);const mt=pt(2222);const ht=pt(49757);const yt=pt(97983);const vt=pt(70275);const St=pt(78842);const bt=pt(37482);const xt=pt(34888);const $t=pt(12738);const Et=pt(68220);const Ct=pt(39408);const Tt=pt(77306);const wt=pt(39023);const At=pt(75351);const kt=pt(40581);const It=wt.debuglog("midway:debug");class BaseFramework{constructor(ct){this.applicationContext=ct;this.defaultContext={};this.middlewareManager=this.createMiddlewareManager();this.filterManager=this.createFilterManager();this.guardManager=this.createGuardManager();this.composeMiddleware=null}async init(){var ct,ut;this.configurationOptions=(ct=this.configure())!==null&&ct!==void 0?ct:{};this.contextLoggerApplyLogger=(ut=this.configurationOptions.contextLoggerApplyLogger)!==null&&ut!==void 0?ut:"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(ct){this.bootstrapOptions=ct;await this.beforeContainerInitialize(ct);await this.containerInitialize(ct);await this.afterContainerInitialize(ct);await this.containerDirectoryLoad(ct);await this.afterContainerDirectoryLoad(ct);await this.applicationInitialize(ct);await this.containerReady(ct);await this.afterContainerReady(ct);await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(ct){}async containerDirectoryLoad(ct){}async containerReady(ct){if(!this.app.getApplicationContext){this.defineApplicationProperties()}}getApplicationContext(){return this.applicationContext}getConfiguration(ct){return this.configService.getConfiguration(ct)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(ct,ut){if(ut&&ut!=="appLogger"){const pt=this.getLogger(ut);let dt=ct.getAttr(mt.REQUEST_CTX_LOGGER_CACHE_KEY);if(!dt){dt=new Map;ct.setAttr(mt.REQUEST_CTX_LOGGER_CACHE_KEY,dt)}if(dt.has(ut)){return dt.get(ut)}const ft=this.loggerService.createContextLogger(ct,pt);dt.set(ut,ft);return ft}else{const pt=this.getLogger(ut!==null&&ut!==void 0?ut:this.contextLoggerApplyLogger);if(ct["_logger"]){return ct["_logger"]}ct["_logger"]=this.loggerService.createContextLogger(ct,pt,{contextFormat:this.contextLoggerFormat});return ct["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(ct={},ut=[]){const pt={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:ct=>this.getConfiguration(ct),getFrameworkType:()=>{if(this["getFrameworkType"]){return this["getFrameworkType"]()}},getProcessType:()=>_t.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:ct=>this.getLogger(ct),createLogger:(ct,ut={})=>this.createLogger(ct,ut),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:ct=>{const ut=ct||Object.create(this.defaultContext);if(!ut.startTime){ut.startTime=Date.now()}if(!ut.logger){ut.logger=this.createContextLogger(ut)}if(!ut.requestContext){ut.requestContext=new yt.MidwayRequestContainer(ut,this.getApplicationContext());ut.requestContext.ready()}if(!ut.getLogger){ut.getLogger=ct=>this.createContextLogger(ut,ct)}ut.setAttr=(ct,pt)=>{ut.requestContext.setAttr(ct,pt)};ut.getAttr=ct=>ut.requestContext.getAttr(ct);ut.getApp=()=>this.getApplication();return ut},addConfigObject:ct=>{this.configService.addObject(ct)},setAttr:(ct,ut)=>{this.getApplicationContext().setAttr(ct,ut)},getAttr:ct=>this.getApplicationContext().getAttr(ct),useMiddleware:ct=>this.useMiddleware(ct),getMiddleware:()=>this.getMiddleware(),useFilter:ct=>this.useFilter(ct),useGuard:ct=>this.useGuard(ct),getNamespace:()=>this.getNamespace()};for(const ct of ut){delete pt[ct]}Object.assign(this.app,pt,ct)}async beforeStop(){}async beforeContainerInitialize(ct){}async afterContainerInitialize(ct){}async afterContainerDirectoryLoad(ct){}async afterContainerReady(ct){}async applyMiddleware(ct){var ut;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(mt.ASYNC_CONTEXT_MANAGER_KEY)){const ct=this.configService.getConfiguration("asyncContextManager.enable")||false;const pt=ct?((ut=this.bootstrapOptions)===null||ut===void 0?void 0:ut.asyncContextManager)||new At.NoopContextManager:new At.NoopContextManager;if(ct){pt.enable()}this.applicationContext.registerObject(mt.ASYNC_CONTEXT_MANAGER_KEY,pt)}this.middlewareManager.insertFirst((async(ct,ut)=>{const pt=At.ASYNC_ROOT_CONTEXT.setValue(mt.ASYNC_CONTEXT_KEY,ct);const dt=this.applicationContext.get(mt.ASYNC_CONTEXT_MANAGER_KEY);return await dt.with(pt,(async()=>{await this.mockService.runSimulatorContextSetup(ct,this.app);this.mockService.applyContextMocks(this.app,ct);let pt=undefined;try{const dt=await ut();pt=await this.filterManager.runResultFilter(dt,ct)}catch(ut){pt=await this.filterManager.runErrorFilter(ut,ct)}finally{await this.mockService.runSimulatorContextTearDown(ct,this.app)}if(pt.error){throw pt.error}return pt.result}))}));It(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(ct){ct=Array.isArray(ct)?ct:[ct];return await this.middlewareService.compose([this.composeMiddleware,...ct],this.app)}return this.composeMiddleware}getLogger(ct){var ut;return(ut=this.loggerService.getLogger(ct))!==null&&ut!==void 0?ut:this.appLogger}getCoreLogger(){return this.logger}createLogger(ct,ut={}){return this.loggerService.createLogger(ct,ut)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(ct){this.middlewareManager.insertLast(ct)}getMiddleware(){return this.middlewareManager}useFilter(ct){return this.filterManager.useFilter(ct)}useGuard(ct){return this.guardManager.addGlobalGuard(ct)}async runGuard(ct,ut,pt){return this.guardManager.runGuard(ct,ut,pt)}createMiddlewareManager(){return new $t.ContextMiddlewareManager}createFilterManager(){return new Ct.FilterManager}createGuardManager(){return new kt.GuardManager}setNamespace(ct){this.namespace=ct}getNamespace(){return this.namespace}}dt([(0,ht.Inject)(),ft("design:type",xt.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);dt([(0,ht.Inject)(),ft("design:type",vt.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);dt([(0,ht.Inject)(),ft("design:type",St.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);dt([(0,ht.Inject)(),ft("design:type",bt.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);dt([(0,ht.Inject)(),ft("design:type",Et.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);dt([(0,ht.Inject)(),ft("design:type",Tt.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);dt([(0,ht.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],BaseFramework.prototype,"init",null);ut.BaseFramework=BaseFramework},43436:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayApplicationManager=void 0;const ft=pt(6192);const _t=pt(49757);let mt=class MidwayApplicationManager{constructor(){this.globalFrameworkMap=new Map;this.globalFrameworkTypeMap=new WeakMap}addFramework(ct,ut){this.globalFrameworkMap.set(ct,ut);if(ut["getFrameworkType"]){this.globalFrameworkTypeMap.set(ut["getFrameworkType"](),ut)}}getFramework(ct){if(typeof ct==="string"){if(this.globalFrameworkMap.has(ct)){return this.globalFrameworkMap.get(ct)}}else{if(this.globalFrameworkTypeMap.has(ct)){return this.globalFrameworkTypeMap.get(ct)}}}getApplication(ct){if(typeof ct==="string"){if(this.globalFrameworkMap.has(ct)){return this.globalFrameworkMap.get(ct).getApplication()}}else{if(this.globalFrameworkTypeMap.has(ct)){return this.globalFrameworkTypeMap.get(ct).getApplication()}}}getApplications(ct){if(!ct){return Array.from(this.globalFrameworkMap.values()).map((ct=>ct.getApplication())).filter((ct=>!!ct))}else{return ct.map((ct=>this.getApplication(ct))).filter((ct=>!!ct))}}};mt=dt([(0,_t.Provide)(),(0,_t.Scope)(ft.ScopeEnum.Singleton)],mt);ut.MidwayApplicationManager=mt},75351:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.NoopContextManager=ut.ASYNC_ROOT_CONTEXT=void 0;class AsyncBaseContext{constructor(ct){const ut=this;ut._currentContext=ct?new Map(ct):new Map;ut.getValue=ct=>ut._currentContext.get(ct);ut.setValue=(ct,pt)=>{const dt=new AsyncBaseContext(ut._currentContext);dt._currentContext.set(ct,pt);return dt};ut.deleteValue=ct=>{const pt=new AsyncBaseContext(ut._currentContext);pt._currentContext.delete(ct);return pt}}}ut.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return ut.ASYNC_ROOT_CONTEXT}with(ct,ut,pt,...dt){return ut.call(pt,...dt)}bind(ct,ut){return ut}enable(){return this}disable(){return this}}ut.NoopContextManager=NoopContextManager},46673:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.DataListener=void 0;const _t=pt(49757);class DataListener{async init(){this.innerData=await this.initData();await this.onData(this.setData.bind(this))}setData(ct){this.innerData=ct}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],DataListener.prototype,"init",null);dt([(0,_t.Destroy)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],DataListener.prototype,"stop",null);ut.DataListener=DataListener},12849:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.globModels=ut.formatGlobString=ut.DataSourceManager=void 0;const _t=pt(83486);const mt=pt(86314);const ht=pt(62525);const yt=pt(16928);const vt=pt(63289);const St=pt(2222);const bt=pt(39023);const xt=pt(65308);const $t=pt(49757);const Et=pt(70275);const Ct=pt(78842);const Tt=pt(67934);const wt=(0,bt.debuglog)("midway:debug");class DataSourceManager{constructor(){this.dataSource=new Map;this.options={};this.modelMapping=new WeakMap;this.dataSourcePriority={}}async initDataSource(ct,ut){var pt,dt;this.options=ct;if(!this.options.dataSource){throw new mt.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof ut==="string"){ut={baseDir:ut,entitiesConfigKey:"entities"}}const ft=ut;const _t=(dt=(pt=this.configService)===null||pt===void 0?void 0:pt.getConfiguration("core.concurrentDataSourceInitialization"))!==null&&dt!==void 0?dt:false;const processDataSource=async ut=>{var pt;const dt=ct.dataSource[ut];const _t=dt[ft.entitiesConfigKey];if(_t){const ct=new Set;for(const dt of _t){if(typeof dt==="string"){const _t=await globModels(dt,ft.baseDir,(pt=this.environmentService)===null||pt===void 0?void 0:pt.getModuleLoadType());for(const pt of _t){ct.add(pt);this.modelMapping.set(pt,ut)}}else{ct.add(dt);this.modelMapping.set(dt,ut)}}dt[ft.entitiesConfigKey]=Array.from(ct);wt(`[core]: DataManager load ${dt[ft.entitiesConfigKey].length} models from ${ut}.`)}const mt={cacheInstance:ct.cacheInstance,validateConnection:ct.validateConnection};await this.createInstance(dt,ut,mt)};const ht=Object.keys(ct.dataSource);if(_t){await Promise.all(ht.map(processDataSource))}else{for(const ct of ht){await processDataSource(ct)}}}getDataSource(ct){return this.dataSource.get(ct)}hasDataSource(ct){return this.dataSource.has(ct)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(ct){const ut=this.getDataSource(ct);return ut?this.checkConnected(ut):false}async createInstance(ct,ut,pt){const dt=pt&&typeof pt.cacheInstance==="boolean"?pt.cacheInstance:true;const ft=pt&&pt.validateConnection||false;const ht=(0,_t.extend)(true,{},this.options["default"],ct);const yt=await this.createDataSource(ht,ut);if(dt&&ut&&yt){this.dataSource.set(ut,yt)}if(ft){if(!yt){throw new mt.MidwayCommonError(`[DataSourceManager] ${ut} initialization failed.`)}const ct=await this.checkConnected(yt);if(!ct){throw new mt.MidwayCommonError(`[DataSourceManager] ${ut} is not connected.`)}}return yt}getDataSourceNameByModel(ct){return this.modelMapping.get(ct)}async stop(){const ct=Array.from(this.dataSource.values());await Promise.all(ct.map((ct=>this.destroyDataSource(ct))));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(ct){return this.priorityManager.getPriority(this.dataSourcePriority[ct])}isHighPriority(ct){return this.priorityManager.isHighPriority(this.dataSourcePriority[ct])}isMediumPriority(ct){return this.priorityManager.isMediumPriority(this.dataSourcePriority[ct])}isLowPriority(ct){return this.priorityManager.isLowPriority(this.dataSourcePriority[ct])}}dt([(0,$t.Inject)(),ft("design:type",String)],DataSourceManager.prototype,"appDir",void 0);dt([(0,$t.Inject)(),ft("design:type",Et.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);dt([(0,$t.Inject)(),ft("design:type",Ct.MidwayConfigService)],DataSourceManager.prototype,"configService",void 0);dt([(0,$t.Inject)(),ft("design:type",Tt.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0);ut.DataSourceManager=DataSourceManager;function formatGlobString(ct){let ut;if(!/^\*/.test(ct)){ct="/"+ct}const pt=(0,yt.parse)(ct);if(pt.base&&(/\*/.test(pt.base)||pt.ext)){ut=[ct]}else{ut=[...St.DEFAULT_PATTERN.map((ut=>(0,yt.join)(ct,ut)))]}return ut}ut.formatGlobString=formatGlobString;async function globModels(ct,ut,pt){const dt=formatGlobString(ct);const ft=[];const _t=(0,ht.run)(dt,{cwd:ut,ignore:St.IGNORE_PATTERN});for(const ct of _t){const ut=await(0,xt.loadModule)(ct,{loadMode:pt});if(vt.Types.isClass(ut)){ft.push(ut)}else{for(const ct in ut){const pt=ut[ct];if(vt.Types.isClass(pt)){ft.push(pt)}}}}return ft}ut.globModels=globModels},1845:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.CustomModuleDetector=ut.ESModuleFileDetector=ut.CommonJSFileDetector=ut.AbstractFileDetector=void 0;const dt=pt(63289);const ft=pt(62525);const _t=pt(86314);const mt=pt(2222);const ht=pt(49757);const yt=pt(65308);class AbstractFileDetector{constructor(ct){this.options=ct;this.extraDetectorOptions={}}setExtraDetectorOptions(ct){this.extraDetectorOptions=ct}}ut.AbstractFileDetector=AbstractFileDetector;const vt=["**/**.tsx"].concat(mt.DEFAULT_PATTERN);const St=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(mt.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{constructor(){super(...arguments);this.duplicateModuleCheckSet=new Map}run(ct){if(this.getType()==="commonjs"){return this.loadSync(ct)}else{return this.loadAsync(ct)}}loadSync(ct){var ut;this.options=this.options||{};const pt=[].concat((ut=this.options.loadDir)!==null&&ut!==void 0?ut:ct.get("baseDir"));for(const ut of pt){const pt=(0,ft.run)(vt.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:ut,ignore:St.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(ct,ut)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&dt.Types.isClass(ct)){const pt=(0,ht.getProviderName)(ct);if(pt){if(this.duplicateModuleCheckSet.has(pt)){throw new _t.MidwayDuplicateClassNameError(pt,ut.srcPath,this.duplicateModuleCheckSet.get(pt))}else{this.duplicateModuleCheckSet.set(pt,ut.srcPath)}}}};for(const ut of pt){const pt=require(ut);ct.bindClass(pt,{namespace:this.options.namespace,srcPath:ut,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(ct){var ut;this.options=this.options||{};const pt=[].concat((ut=this.options.loadDir)!==null&&ut!==void 0?ut:ct.get("baseDir"));for(const ut of pt){const pt=(0,ft.run)(vt.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:ut,ignore:St.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(ct,ut)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&dt.Types.isClass(ct)){const pt=(0,ht.getProviderName)(ct);if(pt){if(this.duplicateModuleCheckSet.has(pt)){throw new _t.MidwayDuplicateClassNameError(pt,ut.srcPath,this.duplicateModuleCheckSet.get(pt))}else{this.duplicateModuleCheckSet.set(pt,ut.srcPath)}}}};for(const ut of pt){const pt=await(0,yt.loadModule)(ut,{loadMode:"esm"});ct.bindClass(pt,{namespace:this.options.namespace,srcPath:ut,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}}ut.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}ut.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(ct){for(const ut of this.options.modules){ct.bindClass(ut,{namespace:this.options.namespace,createFrom:"module"})}}}ut.CustomModuleDetector=CustomModuleDetector},39408:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.FilterManager=void 0;const dt=pt(49757);const ft=pt(65308);class FilterManager{constructor(){this.errFilterList=[];this.successFilterList=[];this.exceptionMap=new WeakMap;this.defaultErrFilter=undefined;this.matchFnList=[];this.protoMatchList=[]}useFilter(ct){if(!Array.isArray(ct)){ct=[ct]}for(const ut of ct){if((0,dt.getClassMetadata)(dt.CATCH_KEY,ut)){this.errFilterList.push(ut)}if((0,dt.getClassMetadata)(dt.MATCH_KEY,ut)){this.successFilterList.push(ut)}}}async init(ct){for(const ut of this.errFilterList){const pt=await ct.getAsync(ut);const ft=(0,dt.getClassMetadata)(dt.CATCH_KEY,ut);if(ft&&ft.catchTargets){ft.catchOptions=ft.catchOptions||{};for(const ct of ft.catchTargets){this.exceptionMap.set(ct,{filter:pt,catchOptions:ft.catchOptions});if(ft.catchOptions["matchPrototype"]){this.protoMatchList.push((ut=>{if(ut instanceof ct){return ct}else{return false}}))}}}else{this.defaultErrFilter=pt}}for(const ut of this.successFilterList){const pt=await ct.getAsync(ut);const _t=(0,dt.getClassMetadata)(dt.MATCH_KEY,ut);if(_t&&_t.matchPattern){this.matchFnList.push({matchFn:(0,ft.toPathMatch)(_t.matchPattern),target:pt})}}}async runErrorFilter(ct,ut,pt,dt){let ft,_t;let mt=false;if(ct&&this.exceptionMap.has(ct.constructor)){mt=true;const _t=this.exceptionMap.get(ct.constructor);ft=await _t.filter.catch(ct,ut,pt,dt)}if(!mt&&this.protoMatchList.length){let _t;for(const ut of this.protoMatchList){_t=ut(ct);if(_t){break}}if(_t){mt=true;const ht=this.exceptionMap.get(_t);ft=await ht.filter.catch(ct,ut,pt,dt)}}if(!mt&&this.defaultErrFilter){mt=true;ft=await this.defaultErrFilter.catch(ct,ut,pt,dt)}if(!mt){_t=ct}return{result:ft,error:_t}}async runResultFilter(ct,ut,pt,dt){let ft=ct;for(const ct of this.matchFnList){if(ct.matchFn(ut,pt)){ft=await ct.target.match(ft,ut,pt,dt)}}return{result:ft,error:undefined}}}ut.FilterManager=FilterManager},40581:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.GuardManager=void 0;const dt=pt(49757);class GuardManager extends Array{addGlobalGuard(ct){if(!Array.isArray(ct)){this.push(ct)}else{this.push(...ct)}}async runGuard(ct,ut,pt){for(const dt of this){const ft=await ct.requestContext.getAsync(dt);const _t=await ft.canActivate(ct,ut,pt);if(!_t){return false}}const ft=(0,dt.getClassMetadata)(dt.GUARD_KEY,ut);if(ft){for(const dt of ft){const ft=await ct.requestContext.getAsync(dt);const _t=await ft.canActivate(ct,ut,pt);if(!_t){return false}}}const _t=(0,dt.getPropertyMetadata)(dt.GUARD_KEY,ut,pt);if(_t){for(const dt of _t){const ft=await ct.requestContext.getAsync(dt);const _t=await ft.canActivate(ct,ut,pt);if(!_t){return false}}}return true}}ut.GuardManager=GuardManager},82535:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.DefaultConsoleLoggerFactory=ut.LoggerFactory=void 0;class LoggerFactory{}ut.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{constructor(){this.instance=new Map}createLogger(ct,ut){this.instance.set(ct,console);return console}getLogger(ct){return this.instance.get(ct)}close(ct){}removeLogger(ct){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(ct,ut,pt){return ut}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}ut.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},12738:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createMiddleware=ut.ContextMiddlewareManager=void 0;class ContextMiddlewareManager extends Array{insertFirst(ct){if(Array.isArray(ct)){this.unshift(...ct)}else{this.unshift(ct)}}insertLast(ct){if(Array.isArray(ct)){this.push(...ct)}else{this.push(ct)}}insertBefore(ct,ut){if(typeof ut!=="number"){ut=this.findItemIndex(ut)}if(Array.isArray(ct)){this.splice(ut,0,...ct)}else{this.splice(ut,0,ct)}}insertAfter(ct,ut){if(typeof ut!=="number"){ut=this.findItemIndex(ut)}if(Array.isArray(ct)){this.splice(ut+1,0,...ct)}else{this.splice(ut+1,0,ct)}}findAndInsertAfter(ct,ut){ct=this.findItem(ct);ut=this.findItem(ut);if(!ct||!ut||ct===ut){return}if(ut){const pt=this.remove(ct);if(pt){this.insertAfter(pt,ut)}}}findAndInsertBefore(ct,ut){ct=this.findItem(ct);ut=this.findItem(ut);if(!ct||!ut||ct===ut){return}if(ut){const pt=this.remove(ct);if(pt){this.insertBefore(pt,ut)}}}findAndInsertFirst(ct){const ut=this.remove(ct);if(ut){this.insertFirst(ut)}}findAndInsertLast(ct){const ut=this.remove(ct);if(ut){this.insertLast(ut)}}findItemIndex(ct){if(typeof ct==="number"){return ct}else if(typeof ct==="string"){return this.findIndex((ut=>this.getMiddlewareName(ut)===ct))}else{return this.findIndex((ut=>ut===ct))}}findItem(ct){if(typeof ct==="number"){if(ct>=0&&ct<=this.length-1){return this[ct]}}else if(typeof ct==="string"){return this.find((ut=>this.getMiddlewareName(ut)===ct))}else{return ct}}getMiddlewareName(ct){var ut,pt,dt;if(ct["middleware"]){return(ut=ct.name)!==null&&ut!==void 0?ut:this.getMiddlewareName(ct["middleware"])}return(dt=(pt=ct.getName&&ct.getName())!==null&&pt!==void 0?pt:ct._name)!==null&&dt!==void 0?dt:ct.name}remove(ct){if(typeof ct==="number"&&ct!==-1){return this.splice(ct,1)[0]}else{const ut=this.findItemIndex(ct);if(ut!==-1){return this.splice(ut,1)[0]}}}push(...ct){ct.forEach((ct=>{if(typeof ct!=="string"&&!this.getMiddlewareName(ct)){ct._name="anonymous"}}));return super.push(...ct)}unshift(...ct){ct.forEach((ct=>{if(typeof ct!=="string"&&!this.getMiddlewareName(ct)){ct._name="anonymous"}}));return super.unshift(...ct)}getNames(){return this.map((ct=>this.getMiddlewareName(ct)))}}ut.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(ct,ut,pt){return{middleware:ct,options:ut,name:pt}}ut.createMiddleware=createMiddleware},70032:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayInitializerPerformanceManager=ut.MidwayPerformanceManager=void 0;const dt=pt(82987);class MidwayPerformanceManager{constructor(ct){this.group=ct;this.observer=null;this.marks=new Set;this.measures=new Set}static getInstance(ct){if(!this.instances.has(ct)){this.instances.set(ct,new MidwayPerformanceManager(ct))}return this.instances.get(ct)}formatKey(ct,ut){return`${this.group}:${ct}-${ut}`}markStart(ct){const ut=this.formatKey(ct,"start");dt.performance.mark(ut);this.marks.add(ut)}markEnd(ct){const ut=this.formatKey(ct,"start");const pt=this.formatKey(ct,"end");const ft=`${this.group}:${ct}`;dt.performance.mark(pt);this.marks.add(pt);dt.performance.measure(ft,ut,pt);this.measures.add(ft)}observeMeasure(ct){if(this.observer){return}this.observer=new dt.PerformanceObserver((ut=>{const pt=ut.getEntries().filter((ct=>ct.name.startsWith(`${this.group}:`)));if(pt.length>0){ct({getEntries:()=>pt})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((ct=>{try{dt.performance.clearMarks(ct)}catch(ut){console.warn(`Failed to clear mark ${ct}: ${ut}`)}}));this.marks.clear();this.measures.forEach((ct=>{try{dt.performance.clearMeasures(ct)}catch(ut){console.warn(`Failed to clear measure ${ct}: ${ut}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((ct=>ct.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const ct=[];dt.performance===null||dt.performance===void 0?void 0:dt.performance.getEntries().forEach((ut=>{if(ut.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){ct.push(ut.toJSON())}}));return ct}}ut.MidwayPerformanceManager=MidwayPerformanceManager;MidwayPerformanceManager.instances=new Map;MidwayPerformanceManager.DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};class MidwayInitializerPerformanceManager{static markStart(ct){const ut=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);ut.markStart(ct)}static markEnd(ct){const ut=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);ut.markEnd(ct)}static frameworkInitializeStart(ct){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${ct}`)}static frameworkInitializeEnd(ct){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${ct}`)}static frameworkRunStart(ct){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${ct}`)}static frameworkRunEnd(ct){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${ct}`)}static lifecycleStart(ct,ut){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${ct}:${ut}`)}static lifecycleEnd(ct,ut){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${ct}:${ut}`)}}ut.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(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayPriorityManager=ut.DEFAULT_PRIORITY=void 0;const ft=pt(49757);const _t=pt(6192);ut.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let mt=class MidwayPriorityManager{constructor(){this.priorityList=ut.DEFAULT_PRIORITY;this.defaultPriority=ut.DEFAULT_PRIORITY.L2}getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(ct=ut.DEFAULT_PRIORITY.L2){return ct===ut.DEFAULT_PRIORITY.L1}isMediumPriority(ct=ut.DEFAULT_PRIORITY.L2){return ct===ut.DEFAULT_PRIORITY.L2}isLowPriority(ct=ut.DEFAULT_PRIORITY.L2){return ct===ut.DEFAULT_PRIORITY.L3}getPriority(ct){return ct||this.getDefaultPriority()}};mt=dt([(0,ft.Provide)(),(0,ft.Scope)(_t.ScopeEnum.Singleton)],mt);ut.MidwayPriorityManager=mt},64842:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.ServiceFactory=void 0;const _t=pt(83486);const mt=pt(67934);const ht=pt(49757);class ServiceFactory{constructor(){this.clients=new Map;this.options={}}async initClients(ct={}){this.options=ct;if(ct.client){ct.clients=ct.clients||{};ct.clients["default"]=ct.clients["default"]||{};(0,_t.extend)(true,ct.clients["default"],ct.client)}if(ct.clients){for(const ut of Object.keys(ct.clients)){await this.createInstance(ct.clients[ut],ut)}}this.clientPriority=ct.priority||{}}get(ct="default"){return this.clients.get(ct)}has(ct){return this.clients.has(ct)}async createInstance(ct,ut){ct=(0,_t.extend)(true,{},this.options["default"],ct);const pt=await this.createClient(ct,ut);if(pt){if(ut){this.clients.set(ut,pt)}return pt}}async destroyClient(ct,ut){}async stop(){for(const[ct,ut]of this.clients.entries()){await this.destroyClient(ut,ct)}}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(ct){return this.priorityManager.getPriority(this.clientPriority[ct])}isHighPriority(ct){return this.priorityManager.isHighPriority(this.clientPriority[ct])}isMediumPriority(ct){return this.priorityManager.isMediumPriority(this.clientPriority[ct])}isLowPriority(ct){return this.priorityManager.isLowPriority(this.clientPriority[ct])}}dt([(0,ht.Inject)(),ft("design:type",mt.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0);ut.ServiceFactory=ServiceFactory},11330:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.TypedResourceManager=void 0;class TypedResourceManager{constructor(ct){this.typedResourceInitializerOptions=ct;this.resourceMap=new Map;this.resourceBindingMap=new Map}async createResource(ct,ut){const pt=await this.typedResourceInitializerOptions.resourceInitialize(ut,ct);this.resourceMap.set(ct,pt);return pt}async init(){for(const ct of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const ut=this.typedResourceInitializerOptions.initializeValue[ct];const pt=this.typedResourceInitializerOptions.initializeClzProvider[ct];const dt=await this.createResource(ct,ut);const ft=await this.typedResourceInitializerOptions.resourceBinding(pt,ut,dt,ct);if(ft){this.resourceBindingMap.set(ct,ft)}}}async startParallel(){const ct=[];for(const[ut,pt]of this.resourceMap.entries()){ct.push(this.typedResourceInitializerOptions.resourceStart(pt,this.typedResourceInitializerOptions.initializeValue[ut],this.resourceBindingMap.get(ut)))}await Promise.all(ct)}async start(){for(const[ct,ut]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(ut,this.typedResourceInitializerOptions.initializeValue[ct],this.resourceBindingMap.get(ct))}}async destroyParallel(){const ct=[];for(const[ut,pt]of this.resourceMap.entries()){ct.push(this.typedResourceInitializerOptions.resourceDestroy(pt,this.typedResourceInitializerOptions.initializeValue[ut]))}await Promise.all(ct)}async destroy(){for(const[ct,ut]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(ut,this.typedResourceInitializerOptions.initializeValue[ct])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(ct){return this.resourceMap.get(ct)}}ut.TypedResourceManager=TypedResourceManager},11026:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.WebControllerGenerator=void 0;const dt=pt(49757);const ft=pt(39023);const _t=pt(6192);const mt=pt(86314);const ht=pt(68220);const yt=ft.debuglog("midway:debug");class WebControllerGenerator{constructor(ct,ut){this.app=ct;this.midwayWebRouterService=ut}generateKoaController(ct){return async(ut,pt)=>{if(ct.controllerClz&&typeof ct.method==="string"){const pt=await this.app.getFramework().runGuard(ut,ct.controllerClz,ct.method);if(!pt){throw new mt.httpError.ForbiddenError}}const ft=[ut,pt];let _t;if(typeof ct.method!=="string"){_t=await ct.method(ut,pt)}else{const pt=await ut.requestContext.getAsync(ct.id);_t=await pt[ct.method].apply(pt,ft)}if(_t!==undefined){if(_t===null){ut.response._body=null;ut.response._midwayControllerNullBody=true}else{ut.body=_t}}if(Array.isArray(ct.responseMetadata)&&ct.responseMetadata.length){for(const pt of ct.responseMetadata){switch(pt.type){case dt.WEB_RESPONSE_HTTP_CODE:ut.status=pt.code;break;case dt.WEB_RESPONSE_HEADER:for(const ct in(pt===null||pt===void 0?void 0:pt.setHeaders)||{}){ut.set(ct,pt.setHeaders[ct])}break;case dt.WEB_RESPONSE_CONTENT_TYPE:ut.type=pt.contentType;break;case dt.WEB_RESPONSE_REDIRECT:ut.status=pt.code;ut.redirect(pt.url);return}}}}}async loadMidwayController(ct){var ut,pt;const dt=await this.midwayWebRouterService.getRouterTable();const ft=await this.midwayWebRouterService.getRoutePriorityList();const mt=this.app.getApplicationContext();const vt=this.app.getCoreLogger();const St=mt.get(ht.MidwayMiddlewareService);for(const ht of ft){mt.bindClass(ht.routerModule);vt.debug(`Load Controller "${ht.controllerId}", prefix=${ht.prefix}`);yt(`[core]: Load Controller "${ht.controllerId}", prefix=${ht.prefix}`);const ft=this.createRouter({prefix:ht.prefix,...ht.routerOptions});ht.middleware=(ut=ht.middleware)!==null&&ut!==void 0?ut:[];if(ht.middleware.length){const ct=await St.compose(ht.middleware,this.app);ft.use(ct)}const bt=dt.get(ht.prefix);for(const ct of bt){const ut=[];ct.middleware=(pt=ct.middleware)!==null&&pt!==void 0?pt:[];if(ct.middleware.length){const pt=await St.compose(ct.middleware,this.app);ut.push(pt)}if(this.app.getFrameworkType()===_t.MidwayFrameworkType.WEB_KOA){if(typeof ct.url==="string"&&/\*$/.test(ct.url)){ct.url=ct.url.replace("*","(.*)")}}const dt=[ct.routerName,ct.url,...ut,this.generateController(ct)];vt.debug(`Load Router "${ct.requestMethod.toUpperCase()} ${ct.url}"`);yt(`[core]: Load Router "${ct.requestMethod.toUpperCase()} ${ct.url}"`);ft[ct.requestMethod.toLowerCase()].apply(ft,dt)}ct&&ct(ft)}}}ut.WebControllerGenerator=WebControllerGenerator},42193:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});const dt=pt(65308);ut["default"]=ct=>{const ut=(0,dt.isDevelopmentEnvironment)((0,dt.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3,concurrentDataSourceInitialization:false},asyncContextManager:{enable:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:ut?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:ut}}}},2222:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.SINGLETON_CONTAINER_CTX=ut.IGNORE_PATTERN=ut.DEFAULT_PATTERN=ut.ASYNC_CONTEXT_MANAGER_KEY=ut.ASYNC_CONTEXT_KEY=ut.REQUEST_CTX_LOGGER_CACHE_KEY=ut.HTTP_SERVER_KEY=ut.CONTAINER_OBJ_SCOPE=ut.REQUEST_OBJ_CTX_KEY=ut.REQUEST_CTX_KEY=ut.MIDWAY_LOGGER_WRITEABLE_DIR=ut.FUNCTION_INJECT_KEY=ut.KEYS=void 0;ut.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"};ut.FUNCTION_INJECT_KEY="midway:function_inject_key";ut.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";ut.REQUEST_CTX_KEY="ctx";ut.REQUEST_OBJ_CTX_KEY="_req_ctx";ut.CONTAINER_OBJ_SCOPE="_obj_scope";ut.HTTP_SERVER_KEY="_midway_http_server";ut.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";ut.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");ut.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";ut.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];ut.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];ut.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},9288:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayContainer=void 0;const dt=pt(49757);const ft=pt(24451);const _t=pt(39023);const mt=pt(20873);const ht=pt(6192);const yt=pt(2222);const vt=pt(47698);const St=pt(34881);const bt=pt(80932);const xt=pt(70275);const $t=pt(78842);const Et=pt(24434);const Ct=pt(86314);const Tt=pt(63289);const wt=pt(65308);const At=_t.debuglog("midway:debug");const kt=_t.debuglog("midway:bind");const It=9;class ContainerConfiguration{constructor(ct){this.container=ct;this.loadedMap=new WeakMap;this.namespaceList=[];this.configurationOptionsList=[]}load(ct){let ut=dt.MAIN_MODULE_KEY;const pt=this.getConfigurationExport(ct);if(!pt.length)return;for(let ct=0;ct<pt.length;ct++){const _t=pt[ct];if(this.loadedMap.get(_t)){continue}let mt;if(_t instanceof ft.FunctionalConfiguration){mt=_t.getConfigurationOptions()}else{mt=(0,dt.getClassMetadata)(dt.CONFIGURATION_KEY,_t)}this.loadedMap.set(_t,true);if(mt){if(mt.namespace!==undefined){ut=mt.namespace;this.namespaceList.push(ut)}this.configurationOptionsList.push(mt);At(`[core]: load configuration in namespace="${ut}"`);this.addImports(mt.imports);this.addImportObjects(mt.importObjects);this.addImportConfigs(mt.importConfigs);this.addImportConfigFilter(mt.importConfigFilter);this.bindConfigurationClass(_t,ut)}}this.container.bindClass(ct,{namespace:ut})}addImportConfigs(ct){if(ct){if(Array.isArray(ct)){this.container.get($t.MidwayConfigService).add(ct)}else{this.container.get($t.MidwayConfigService).addObject(ct)}}}addImportConfigFilter(ct){if(ct){this.container.get($t.MidwayConfigService).addFilter(ct)}}addImports(ct=[]){var ut;for(let pt of ct){if(!pt)continue;if(typeof pt==="string"){pt=require(pt)}if("Configuration"in pt){this.load(pt)}else if("component"in pt){if(pt===null||pt===void 0?void 0:pt.enabledEnvironment){if((ut=pt===null||pt===void 0?void 0:pt.enabledEnvironment)===null||ut===void 0?void 0:ut.includes(this.container.get(xt.MidwayEnvironmentService).getCurrentEnvironment())){this.load(pt.component)}}else{this.load(pt.component)}}else{this.load(pt)}}}addImportObjects(ct){if(ct){const ut=Object.keys(ct);for(const pt of ut){if(typeof ct[pt]!==undefined){this.container.registerObject(pt,ct[pt])}}}}bindConfigurationClass(ct,ut){if(ct instanceof ft.FunctionalConfiguration){}else{(0,dt.saveProviderId)(undefined,ct);const pt=(0,dt.getProviderUUId)(ct);this.container.bind(pt,ct,{namespace:ut,scope:ht.ScopeEnum.Singleton})}const pt=(0,dt.listModule)(dt.CONFIGURATION_KEY);const _t=pt.find((ut=>ut.target===ct));if(!_t){(0,dt.saveModule)(dt.CONFIGURATION_KEY,{target:ct,namespace:ut})}}getConfigurationExport(ct){const ut=[];if(Tt.Types.isClass(ct)||Tt.Types.isFunction(ct)||ct instanceof ft.FunctionalConfiguration){ut.push(ct)}else{for(const pt in ct){const dt=ct[pt];if(Tt.Types.isClass(dt)||Tt.Types.isFunction(dt)||dt instanceof ft.FunctionalConfiguration){ut.push(dt)}}}return ut}getNamespaceList(){return this.namespaceList}getConfigurationOptionsList(){return this.configurationOptionsList}}class MidwayContainer{constructor(ct){this._resolverFactory=null;this._registry=null;this._identifierMapping=null;this.moduleMap=null;this.parent=null;this.ctx=yt.SINGLETON_CONTAINER_CTX;this.attrMap=new Map;this._namespaceSet=null;this.parent=ct;this.init()}init(){this.registerObject(yt.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new Et}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new mt.ObjectDefinitionRegistry}return this._registry}set registry(ct){this._registry=ct}get managedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new bt.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(ct){var ut,pt,dt;if(!Array.isArray(ct)){ct=[ct]}const ft=new ContainerConfiguration(this);for(const ut of ct){if(ut){ft.load(ut)}}for(const ct of ft.getNamespaceList()){this.namespaceSet.add(ct);At(`[core]: load configuration in namespace="${ct}" complete`)}const _t=(ut=ft.getConfigurationOptionsList())!==null&&ut!==void 0?ut:[];const mt=(pt=_t.find((ct=>!ct.namespace)))!==null&&pt!==void 0?pt:{};this.fileDetector=(dt=mt.detector)!==null&&dt!==void 0?dt:this.fileDetector;if(this.fileDetector){this.fileDetector.setExtraDetectorOptions({conflictCheck:mt.conflictCheck,...mt.detectorOptions})}}loadDefinitions(){if(this.fileDetector){return this.fileDetector.run(this)}}bindClass(ct,ut){if(Tt.Types.isClass(ct)||Tt.Types.isFunction(ct)){this.bindModule(ct,ut)}else{for(const pt in ct){const dt=ct[pt];if(Tt.Types.isClass(dt)||Tt.Types.isFunction(dt)){this.bindModule(dt,ut)}}}}bind(ct,ut,pt){var ft;if(Tt.Types.isClass(ct)||Tt.Types.isFunction(ct)){return this.bindModule(ct,ut)}if(this.registry.hasDefinition(ct)){return}if(pt===null||pt===void 0?void 0:pt.bindHook){pt.bindHook(ut,pt)}let _t;if(Tt.Types.isClass(ut)){_t=new vt.ObjectDefinition;_t.name=(0,dt.getProviderName)(ut)}else{_t=new St.FunctionDefinition;if(!Tt.Types.isAsyncFunction(ut)){_t.asynchronous=false}_t.name=_t.id}_t.path=ut;_t.id=ct;_t.srcPath=(pt===null||pt===void 0?void 0:pt.srcPath)||null;_t.namespace=(pt===null||pt===void 0?void 0:pt.namespace)||"";_t.scope=(pt===null||pt===void 0?void 0:pt.scope)||ht.ScopeEnum.Request;_t.createFrom=pt===null||pt===void 0?void 0:pt.createFrom;if(_t.srcPath){At(`[core]: bind id "${_t.name} (${_t.srcPath}) ${ct}"`)}else{At(`[core]: bind id "${_t.name}" ${ct}`)}const mt=(0,dt.getPropertyInject)(ut);for(const ct in mt){const ut=mt[ct];kt(`${" ".repeat(It)}inject properties => [${JSON.stringify(ut)}]`);const pt=new bt.ManagedReference;pt.args=ut.args;pt.name=ut.value;pt.injectMode=ut["injectMode"];_t.properties.set(ut["targetKey"],pt)}const yt=(0,dt.getClassExtendedMetadata)(dt.INJECT_CUSTOM_PROPERTY,ut);for(const ct in yt){const ut=yt[ct];_t.handlerProps.push(ut)}const xt=(ft=(0,dt.getObjectDefinition)(ut))!==null&&ft!==void 0?ft:{};if(xt.initMethod){kt(`${" ".repeat(It)}register initMethod = ${xt.initMethod}`);_t.initMethod=xt.initMethod}if(xt.destroyMethod){kt(`${" ".repeat(It)}register destroyMethod = ${xt.destroyMethod}`);_t.destroyMethod=xt.destroyMethod}if(xt.scope){kt(`${" ".repeat(It)}register scope = ${xt.scope}`);_t.scope=xt.scope}if(xt.allowDowngrade){kt(`${" ".repeat(It)}register allowDowngrade = ${xt.allowDowngrade}`);_t.allowDowngrade=xt.allowDowngrade}this.objectCreateEventTarget.emit(ht.ObjectLifeCycleEvent.BEFORE_BIND,ut,{context:this,definition:_t,replaceCallback:ct=>{_t=ct}});if(_t){this.registry.registerDefinition(_t.id,_t)}}bindModule(ct,ut){if(Tt.Types.isClass(ct)){const pt=(0,dt.getProviderUUId)(ct);if(pt){this.identifierMapping.saveClassRelation(ct,ut===null||ut===void 0?void 0:ut.namespace);this.bind(pt,ct,ut)}else{}}else{const pt=ct[yt.FUNCTION_INJECT_KEY];if(pt&&pt.id){if(!pt.scope){pt.scope=ht.ScopeEnum.Request}const dt=wt.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(pt.id,dt);this.bind(dt,ct,{scope:pt.scope,namespace:ut.namespace,srcPath:ut.srcPath,createFrom:ut.createFrom})}}}setFileDetector(ct){this.fileDetector=ct}createChild(){return new MidwayContainer(this)}setAttr(ct,ut){this.attrMap.set(ct,ut)}getAttr(ct){return this.attrMap.get(ct)}getIdentifier(ct){return(0,dt.getProviderUUId)(ct)}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new bt.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll()}ready(){return this.loadDefinitions()}get(ct,ut,pt){var dt;ut=ut!==null&&ut!==void 0?ut:[];pt=pt!==null&&pt!==void 0?pt:{originName:ct};if(typeof ct!=="string"){pt.originName=ct.name;ct=this.getIdentifier(ct)}if(this.registry.hasObject(ct)){return this.registry.getObject(ct)}const ft=this.registry.getDefinition(ct);if(!ft&&this.parent){return this.parent.get(ct,ut)}if(!ft){throw new Ct.MidwayDefinitionNotFoundError((dt=pt===null||pt===void 0?void 0:pt.originName)!==null&&dt!==void 0?dt:ct)}return this.getManagedResolverFactory().create({definition:ft,args:ut})}async getAsync(ct,ut,pt){var dt;ut=ut!==null&&ut!==void 0?ut:[];pt=pt!==null&&pt!==void 0?pt:{originName:ct};if(typeof ct!=="string"){pt.originName=ct.name;ct=this.getIdentifier(ct)}if(this.registry.hasObject(ct)){return this.registry.getObject(ct)}const ft=this.registry.getDefinition(ct);if(!ft&&this.parent){return this.parent.getAsync(ct,ut)}if(!ft){throw new Ct.MidwayDefinitionNotFoundError((dt=pt===null||pt===void 0?void 0:pt.originName)!==null&&dt!==void 0?dt:ct)}return this.getManagedResolverFactory().createAsync({definition:ft,args:ut})}registerObject(ct,ut){this.registry.registerObject(ct,ut)}onBeforeBind(ct){this.objectCreateEventTarget.on(ht.ObjectLifeCycleEvent.BEFORE_BIND,ct)}onBeforeObjectCreated(ct){this.objectCreateEventTarget.on(ht.ObjectLifeCycleEvent.BEFORE_CREATED,ct)}onObjectCreated(ct){this.objectCreateEventTarget.on(ht.ObjectLifeCycleEvent.AFTER_CREATED,ct)}onObjectInit(ct){this.objectCreateEventTarget.on(ht.ObjectLifeCycleEvent.AFTER_INIT,ct)}onBeforeObjectDestroy(ct){this.objectCreateEventTarget.on(ht.ObjectLifeCycleEvent.BEFORE_DESTROY,ct)}saveModule(ct,ut){if(!this.moduleMap.has(ct)){this.moduleMap.set(ct,new Set)}this.moduleMap.get(ct).add(ut)}listModule(ct){return Array.from(this.moduleMap.get(ct)||{})}transformModule(ct){this.moduleMap=new Map(ct)}hasNamespace(ct){return this.namespaceSet.has(ct)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(ct){return this.registry.hasDefinition(ct)}hasObject(ct){return this.registry.hasObject(ct)}getInstanceScope(ct){if(ct[yt.CONTAINER_OBJ_SCOPE]){return ct[yt.CONTAINER_OBJ_SCOPE]}return undefined}}ut.MidwayContainer=MidwayContainer},20873:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ObjectDefinitionRegistry=void 0;const dt=pt(49757);const ft="_id_default_";class LegacyIdentifierRelation extends Map{saveClassRelation(ct,ut){const pt=(0,dt.getProviderUUId)(ct);this.set(pt,pt);if(pt){const ft=(0,dt.getProviderId)(ct);if(ft){this.set(ft,pt)}this.set((0,dt.getProviderName)(ct),pt);if(ut){this.set(ut+":"+(0,dt.getProviderName)(ct),pt)}}}saveFunctionRelation(ct,ut){this.set(ut,ut);this.set(ct,ut)}hasRelation(ct){return this.has(ct)}getRelation(ct){return this.get(ct)}}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(ct){this._identifierRelation=ct}get identifiers(){const ct=[];for(const ut of this.keys()){if(ut.indexOf(ft)===-1){ct.push(ut)}}return ct}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(ct){const ut=[];for(const pt of this.values()){const dt=pt;if(dt.name===ct){ut.push(dt)}}return ut}registerDefinition(ct,ut){if(ut.isSingletonScope()){this.singletonIds.push(ct)}this.set(ct,ut)}getDefinition(ct){var ut;ct=(ut=this.identifierRelation.getRelation(ct))!==null&&ut!==void 0?ut:ct;return this.get(ct)}removeDefinition(ct){this.delete(ct)}hasDefinition(ct){var ut;ct=(ut=this.identifierRelation.getRelation(ct))!==null&&ut!==void 0?ut:ct;return this.has(ct)}clearAll(){this.singletonIds=[];this.clear()}hasObject(ct){var ut;ct=(ut=this.identifierRelation.getRelation(ct))!==null&&ut!==void 0?ut:ct;return this.has(ft+ct)}registerObject(ct,ut){this.set(ft+ct,ut)}getObject(ct){var ut;ct=(ut=this.identifierRelation.getRelation(ct))!==null&&ut!==void 0?ut:ct;return this.get(ft+ct)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(ct){this.identifierRelation=ct}}ut.ObjectDefinitionRegistry=ObjectDefinitionRegistry},80932:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ManagedResolverFactory=ut.ManagedReference=void 0;const dt=pt(2222);const ft=pt(6192);const _t=pt(39023);const mt=pt(86314);const ht=_t.debuglog("midway:managedresolver");const yt=_t.debuglog("midway:debug");class ManagedReference{constructor(){this.type=dt.KEYS.REF_ELEMENT}}ut.ManagedReference=ManagedReference;class RefResolver{constructor(ct){this.factory=ct}get type(){return dt.KEYS.REF_ELEMENT}resolve(ct,ut){var pt;const dt=ct;if(dt.injectMode===ft.InjectModeEnum.Class&&!((pt=this.factory.context.parent)!==null&&pt!==void 0?pt:this.factory.context).hasDefinition(dt.name)){if(ut==="loggerService"){throw new mt.MidwayInconsistentVersionError}else{throw new mt.MidwayMissingImportComponentError(ut)}}return this.factory.context.get(dt.name,dt.args,{originName:ut})}async resolveAsync(ct,ut){var pt;const dt=ct;if(dt.injectMode===ft.InjectModeEnum.Class&&!((pt=this.factory.context.parent)!==null&&pt!==void 0?pt:this.factory.context).hasDefinition(dt.name)){if(ut==="loggerService"){throw new mt.MidwayInconsistentVersionError}else{throw new mt.MidwayMissingImportComponentError(ut)}}return this.factory.context.getAsync(dt.name,dt.args,{originName:ut})}}class ManagedResolverFactory{constructor(ct){this.resolvers={};this.creating=new Map;this.singletonCache=new Map;this.context=ct;this.resolvers={ref:new RefResolver(this)}}registerResolver(ct){this.resolvers[ct.type]=ct}resolveManaged(ct,ut){const pt=this.resolvers[ct.type];if(!pt||pt.type!==ct.type){throw new mt.MidwayResolverMissingError(ct.type)}return pt.resolve(ct,ut)}async resolveManagedAsync(ct,ut){const pt=this.resolvers[ct.type];if(!pt||pt.type!==ct.type){throw new mt.MidwayResolverMissingError(ct.type)}return pt.resolveAsync(ct,ut)}create(ct){const{definition:ut,args:pt}=ct;if(ut.isSingletonScope()&&this.singletonCache.has(ut.id)){return this.singletonCache.get(ut.id)}let _t=this.createProxyReference(ut);if(_t){return _t}this.compareAndSetCreateStatus(ut);if(ut.hasDependsOn()){for(const ct of ut.dependsOn){this.context.get(ct,pt)}}yt(`[core]: Create id = "${ut.name}" ${ut.id}.`);const ht=ut.creator.load();let vt=[];if(pt&&Array.isArray(pt)&&pt.length>0){vt=pt}this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.BEFORE_CREATED,ht,{constructorArgs:vt,definition:ut,context:this.context});_t=ut.creator.doConstruct(ht,vt,this.context);if(ut.isRequestScope()&&ut.constructor.name==="ObjectDefinition"){Object.defineProperty(_t,dt.REQUEST_OBJ_CTX_KEY,{value:this.context.get(dt.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(ut.properties){const ct=ut.properties.propertyKeys();for(const pt of ct){this.checkSingletonInvokeRequest(ut,pt);try{_t[pt]=this.resolveManaged(ut.properties.get(pt),pt)}catch(ct){if(mt.MidwayDefinitionNotFoundError.isClosePrototypeOf(ct)){const pt=ut.path.name;ct.updateErrorMsg(pt)}this.removeCreateStatus(ut,true);throw ct}}}this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.AFTER_CREATED,_t,{context:this.context,definition:ut,replaceCallback:ct=>{_t=ct}});ut.creator.doInit(_t);this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.AFTER_INIT,_t,{context:this.context,definition:ut});if(ut.id){if(ut.isSingletonScope()){this.singletonCache.set(ut.id,_t);this.setInstanceScope(_t,ft.ScopeEnum.Singleton)}else if(ut.isRequestScope()){this.context.registerObject(ut.id,_t);this.setInstanceScope(_t,ft.ScopeEnum.Request)}else{this.setInstanceScope(_t,ft.ScopeEnum.Prototype)}}this.removeCreateStatus(ut,true);return _t}async createAsync(ct){const{definition:ut,args:pt}=ct;if(ut.isSingletonScope()&&this.singletonCache.has(ut.id)){ht(`id = ${ut.id}(${ut.name}) get from singleton cache.`);return this.singletonCache.get(ut.id)}let _t=this.createProxyReference(ut);if(_t){ht(`id = ${ut.id}(${ut.name}) from proxy reference.`);return _t}this.compareAndSetCreateStatus(ut);if(ut.hasDependsOn()){for(const ct of ut.dependsOn){ht("id = %s init depend %s.",ut.id,ct);await this.context.getAsync(ct,pt)}}yt(`[core]: Create id = "${ut.name}" ${ut.id}.`);const vt=ut.creator.load();let St=[];if(pt&&Array.isArray(pt)&&pt.length>0){St=pt}this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.BEFORE_CREATED,vt,{constructorArgs:St,context:this.context});_t=await ut.creator.doConstructAsync(vt,St,this.context);if(!_t){this.removeCreateStatus(ut,false);throw new mt.MidwayCommonError(`${ut.id} construct return undefined`)}if(ut.isRequestScope()&&ut.constructor.name==="ObjectDefinition"){ht("id = %s inject ctx",ut.id);Object.defineProperty(_t,dt.REQUEST_OBJ_CTX_KEY,{value:this.context.get(dt.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(ut.properties){const ct=ut.properties.propertyKeys();for(const pt of ct){this.checkSingletonInvokeRequest(ut,pt);try{_t[pt]=await this.resolveManagedAsync(ut.properties.get(pt),pt)}catch(ct){if(mt.MidwayDefinitionNotFoundError.isClosePrototypeOf(ct)){const pt=ut.path.name;ct.updateErrorMsg(pt)}this.removeCreateStatus(ut,false);throw ct}}}this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.AFTER_CREATED,_t,{context:this.context,definition:ut,replaceCallback:ct=>{_t=ct}});await ut.creator.doInitAsync(_t);this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.AFTER_INIT,_t,{context:this.context,definition:ut});if(ut.id){if(ut.isSingletonScope()){ht(`id = ${ut.id}(${ut.name}) set to singleton cache`);this.singletonCache.set(ut.id,_t);this.setInstanceScope(_t,ft.ScopeEnum.Singleton)}else if(ut.isRequestScope()){ht(`id = ${ut.id}(${ut.name}) set to register object`);this.context.registerObject(ut.id,_t);this.setInstanceScope(_t,ft.ScopeEnum.Request)}else{this.setInstanceScope(_t,ft.ScopeEnum.Prototype)}}this.removeCreateStatus(ut,true);return _t}async destroyCache(){for(const ct of this.singletonCache.keys()){const ut=this.context.registry.getDefinition(ct);if(ut.creator){const pt=this.singletonCache.get(ct);this.getObjectEventTarget().emit(ft.ObjectLifeCycleEvent.BEFORE_DESTROY,pt,{context:this.context,definition:ut});await ut.creator.doDestroyAsync(pt)}}this.singletonCache.clear();this.creating.clear()}removeCreateStatus(ct,ut){if(this.creating.has(ct.id)){this.creating.set(ct.id,false)}return true}isCreating(ct){return this.creating.has(ct.id)&&this.creating.get(ct.id)}compareAndSetCreateStatus(ct){if(!this.creating.has(ct.id)||!this.creating.get(ct.id)){this.creating.set(ct.id,true)}}createProxyReference(ct){if(this.isCreating(ct)){ht("create proxy for %s.",ct.id);if(!this.depthFirstSearch(ct.id,ct)){ht("id = %s after dfs return null",ct.id);return null}return new Proxy({__is_proxy__:true,__target_id__:ct.id},{get:(ut,pt)=>{let dt;if(ct.isRequestScope()){dt=this.context.registry.getObject(ct.id)}else if(ct.isSingletonScope()){dt=this.singletonCache.get(ct.id)}else{dt=this.context.get(ct.id)}if(dt){if(typeof dt[pt]==="function"){return dt[pt].bind(dt)}return dt[pt]}return undefined}})}return null}depthFirstSearch(ct,ut,pt){var dt;if(ut){ht("dfs for %s == %s start.",ct,ut.id);if(ut.properties){const ft=ut.properties.propertyKeys();if(ft.indexOf(ct)>-1){ht("dfs exist in properties %s == %s.",ct,ut.id);return true}for(const _t of ft){if(!Array.isArray(pt)){pt=[ct]}let ft=_t;const mt=ut.properties.get(_t);if(mt&&mt.name){ft=(dt=this.context.identifierMapping.getRelation(mt.name))!==null&&dt!==void 0?dt:mt.name}if(ft===ct){ht("dfs exist in properties key %s == %s.",ct,ut.id);return true}if(pt.indexOf(ft)>-1){ht("dfs depth circular %s == %s, %s, %j.",ct,ut.id,ft,pt);continue}else{pt.push(ft);ht("dfs depth push %s == %s, %j.",ct,ft,pt)}let yt=this.context.registry.getDefinition(ft);if(!yt&&this.context.parent){yt=this.context.parent.registry.getDefinition(ft)}if(this.depthFirstSearch(ct,yt,pt)){ht("dfs exist in sub tree %s == %s subId = %s.",ct,ut.id,yt.id);return true}}}ht("dfs for %s == %s end.",ct,ut.id)}return false}getObjectEventTarget(){if(this.context.parent){return this.context.parent.objectCreateEventTarget}return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(ct,ut){if(ct.isSingletonScope()){const pt=ct.properties.get(ut);if(this.context.hasDefinition(pt===null||pt===void 0?void 0:pt.name)){const ut=this.context.registry.getDefinition(pt.name);if(ut.isRequestScope()&&!ut.allowDowngrade){throw new mt.MidwaySingletonInjectRequestError(ct.path.name,ut.path.name)}}}return true}setInstanceScope(ct,ut){if(typeof ct==="object"){if(ut===ft.ScopeEnum.Request&&ct[dt.REQUEST_OBJ_CTX_KEY]===dt.SINGLETON_CONTAINER_CTX){ut=ft.ScopeEnum.Singleton}Object.defineProperty(ct,dt.CONTAINER_OBJ_SCOPE,{value:ut,writable:false,enumerable:false,configurable:false})}}}ut.ManagedResolverFactory=ManagedResolverFactory},28695:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.providerWrapper=void 0;const dt=pt(2222);function providerWrapper(ct){for(const ut of ct){Object.defineProperty(ut.provider,dt.FUNCTION_INJECT_KEY,{value:ut,writable:false})}}ut.providerWrapper=providerWrapper},97983:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayRequestContainer=void 0;const dt=pt(9288);const ft=pt(49757);const _t=pt(2222);class MidwayRequestContainer extends dt.MidwayContainer{constructor(ct,ut){super(ut);this.applicationContext=ut;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.ctx=ct;this.registerObject(_t.REQUEST_CTX_KEY,ct);this.registerObject("res",{});if(ct.logger){this.registerObject("logger",ct.logger)}}init(){}get(ct,ut){if(typeof ct!=="string"){ct=this.getIdentifier(ct)}if(this.registry.hasObject(ct)){return this.registry.getObject(ct)}const pt=this.applicationContext.registry.getDefinition(ct);if(pt){if(pt.isRequestScope()||pt.id===ft.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().create({definition:pt,args:ut})}}if(this.parent){return this.parent.get(ct,ut)}}async getAsync(ct,ut){if(typeof ct!=="string"){ct=this.getIdentifier(ct)}if(this.registry.hasObject(ct)){return this.registry.getObject(ct)}const pt=this.applicationContext.registry.getDefinition(ct);if(pt){if(pt.isRequestScope()||pt.id===ft.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().createAsync({definition:pt,args:ut})}}if(this.parent){return this.parent.getAsync(ct,ut)}}async ready(){}getContext(){return this.ctx}}ut.MidwayRequestContainer=MidwayRequestContainer},76271:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Aspect=void 0;const dt=pt(49757);const ft=pt(18025);const _t=pt(6192);function Aspect(ct,ut,pt){return function(mt){(0,dt.saveModule)(dt.ASPECT_KEY,mt);const ht=[].concat(ct);for(const ct of ht){(0,dt.attachClassMetadata)(dt.ASPECT_KEY,{aspectTarget:ct,match:ut,priority:pt},mt)}(0,ft.Scope)(_t.ScopeEnum.Singleton)(mt);(0,dt.Provide)()(mt)}}ut.Aspect=Aspect},2940:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Autoload=void 0;const dt=pt(45317);const ft=pt(39990);function Autoload(){return function(ct){(0,dt.savePreloadModule)(ct);(0,ft.Provide)()(ct)}}ut.Autoload=Autoload},73821:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=void 0;const dt=pt(49757);function Configuration(ct={}){return ut=>{(0,dt.saveClassMetadata)(dt.CONFIGURATION_KEY,ct,ut)}}ut.Configuration=Configuration},41573:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Match=ut.Catch=void 0;const dt=pt(45317);const ft=pt(75105);const _t=pt(18025);const mt=pt(39990);const ht=pt(6192);function Catch(ct,ut={}){return function(pt){const yt=ct?[].concat(ct):undefined;(0,dt.saveClassMetadata)(ft.CATCH_KEY,{catchTargets:yt,catchOptions:ut},pt);(0,_t.Scope)(ht.ScopeEnum.Singleton)(pt);(0,mt.Provide)()(pt)}}ut.Catch=Catch;function Match(ct=true){return function(ut){(0,dt.saveClassMetadata)(ft.MATCH_KEY,{matchPattern:ct},ut);(0,_t.Scope)(ht.ScopeEnum.Singleton)(ut);(0,mt.Provide)()(ut)}}ut.Match=Match},1623:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApplicationContext=ut.Logger=ut.App=ut.Config=ut.Plugin=ut.Framework=void 0;const dt=pt(49757);const ft=pt(6192);function Framework(){return ct=>{(0,dt.saveModule)(dt.FRAMEWORK_KEY,ct);(0,dt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,dt.Provide)()(ct)}}ut.Framework=Framework;function Plugin(ct){return(0,dt.createCustomPropertyDecorator)(dt.PLUGIN_KEY,{identifier:ct})}ut.Plugin=Plugin;function Config(ct){return(0,dt.createCustomPropertyDecorator)(dt.CONFIG_KEY,{identifier:ct})}ut.Config=Config;function App(ct){return(0,dt.createCustomPropertyDecorator)(dt.APPLICATION_KEY,{type:ct})}ut.App=App;function Logger(ct){return(0,dt.createCustomPropertyDecorator)(dt.LOGGER_KEY,{identifier:ct})}ut.Logger=Logger;function ApplicationContext(){return(0,dt.createCustomPropertyDecorator)(dt.APPLICATION_CONTEXT_KEY,{})}ut.ApplicationContext=ApplicationContext},41958:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Guard=ut.UseGuard=void 0;const dt=pt(45317);const ft=pt(6192);const _t=pt(75105);const mt=pt(39990);const ht=pt(18025);function UseGuard(ct){return(ut,pt,ft)=>{if(!Array.isArray(ct)){ct=[ct]}if(pt){(0,dt.savePropertyMetadata)(_t.GUARD_KEY,ct,ut,pt)}else{(0,dt.saveClassMetadata)(_t.GUARD_KEY,ct,ut)}}}ut.UseGuard=UseGuard;function Guard(){return ct=>{(0,mt.Provide)()(ct);(0,ht.Scope)(ft.ScopeEnum.Singleton)(ct)}}ut.Guard=Guard},92922:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.InjectClient=ut.Inject=void 0;const dt=pt(45317);const ft=pt(75105);function Inject(ct){return function(ut,pt){(0,dt.savePropertyInject)({target:ut,targetKey:pt,identifier:ct})}}ut.Inject=Inject;function InjectClient(ct,ut){return(0,dt.createCustomPropertyDecorator)(ft.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:ct,clientName:ut})}ut.InjectClient=InjectClient},17511:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Middleware=void 0;const dt=pt(49757);const ft=pt(6192);function Middleware(){return ct=>{(0,dt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,dt.Provide)()(ct)}}ut.Middleware=Middleware},56329:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Mock=void 0;const dt=pt(49757);const ft=pt(6192);function Mock(){return ct=>{(0,dt.saveModule)(dt.MOCK_KEY,ct);(0,dt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,dt.Provide)()(ct)}}ut.Mock=Mock},18025:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Singleton=ut.Scope=ut.Destroy=ut.Init=void 0;const dt=pt(45317);const ft=pt(39990);const _t=pt(6192);function Init(){return function(ct,ut){(0,dt.saveObjectDefinition)(ct,{initMethod:ut})}}ut.Init=Init;function Destroy(){return function(ct,ut){(0,dt.saveObjectDefinition)(ct,{destroyMethod:ut})}}ut.Destroy=Destroy;function Scope(ct,ut){return function(pt){(0,dt.saveObjectDefinition)(pt,{scope:ct,...ut})}}ut.Scope=Scope;function Singleton(){return function(ct){Scope(_t.ScopeEnum.Singleton)(ct);(0,ft.Provide)()(ct)}}ut.Singleton=Singleton},64331:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Pipe=void 0;const dt=pt(49757);const ft=pt(6192);function Pipe(){return ct=>{(0,dt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,dt.Provide)()(ct)}}ut.Pipe=Pipe},52953:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Pipeline=void 0;const dt=pt(45317);const ft=pt(75105);function Pipeline(ct){return(0,dt.createCustomPropertyDecorator)(ft.PIPELINE_IDENTIFIER,{valves:ct})}ut.Pipeline=Pipeline},39990:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Provide=void 0;const dt=pt(45317);function Provide(ct){return function(ut){return(0,dt.saveProviderId)(ct,ut)}}ut.Provide=Provide},75105:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.TAGGED_CLS=ut.INJECT_CUSTOM_PARAM=ut.INJECT_CUSTOM_METHOD=ut.INJECT_CUSTOM_PROPERTY=ut.INJECT_TAG=ut.NAMED_TAG=ut.CLASS_KEY_CONSTRUCTOR=ut.APPLICATION_CONTEXT_KEY=ut.APPLICATION_KEY=ut.LOGGER_KEY=ut.PLUGIN_KEY=ut.CONFIG_KEY=ut.MS_HSF_METHOD_KEY=ut.MS_DUBBO_METHOD_KEY=ut.MS_GRPC_METHOD_KEY=ut.MS_PROVIDER_KEY=ut.MS_PRODUCER_KEY=ut.MS_CONSUMER_KEY=ut.RPC_DUBBO_KEY=ut.RPC_GRPC_KEY=ut.HSF_KEY=ut.WS_EVENT_KEY=ut.WS_CONTROLLER_KEY=ut.MODULE_TASK_QUEUE_OPTIONS=ut.MODULE_TASK_QUEUE_KEY=ut.MODULE_TASK_TASK_LOCAL_OPTIONS=ut.MODULE_TASK_TASK_LOCAL_KEY=ut.MODULE_TASK_METADATA=ut.MODULE_TASK_KEY=ut.WEB_RESPONSE_RENDER=ut.WEB_RESPONSE_CONTENT_TYPE=ut.WEB_RESPONSE_HEADER=ut.WEB_RESPONSE_REDIRECT=ut.WEB_RESPONSE_HTTP_CODE=ut.WEB_RESPONSE_KEY=ut.WEB_ROUTER_PARAM_KEY=ut.WEB_ROUTER_KEY=ut.CONTROLLER_KEY=ut.SERVERLESS_FUNC_KEY=ut.FUNC_KEY=ut.FACTORY_SERVICE_CLIENT_KEY=ut.MOCK_KEY=ut.GUARD_KEY=ut.MATCH_KEY=ut.CATCH_KEY=ut.ASPECT_KEY=ut.FRAMEWORK_KEY=ut.CONFIGURATION_KEY=ut.SCHEDULE_KEY=ut.ALL=void 0;ut.PRIVATE_META_DATA_KEY=ut.MAIN_MODULE_KEY=ut.LIFECYCLE_IDENTIFIER_PREFIX=ut.PIPELINE_IDENTIFIER=ut.OBJ_DEF_CLS=ut.TAGGED_FUN=void 0;ut.ALL="common:all_value_key";ut.SCHEDULE_KEY="common:schedule";ut.CONFIGURATION_KEY="common:configuration";ut.FRAMEWORK_KEY="common:framework";ut.ASPECT_KEY="common:aspect";ut.CATCH_KEY="common:catch";ut.MATCH_KEY="common:match";ut.GUARD_KEY="common:guard";ut.MOCK_KEY="common:mock";ut.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";ut.FUNC_KEY="faas:func";ut.SERVERLESS_FUNC_KEY="faas:serverless:function";ut.CONTROLLER_KEY="web:controller";ut.WEB_ROUTER_KEY="web:router";ut.WEB_ROUTER_PARAM_KEY="web:router_param";ut.WEB_RESPONSE_KEY="web:response";ut.WEB_RESPONSE_HTTP_CODE="web:response_http_code";ut.WEB_RESPONSE_REDIRECT="web:response_redirect";ut.WEB_RESPONSE_HEADER="web:response_header";ut.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";ut.WEB_RESPONSE_RENDER="web:response_render";ut.MODULE_TASK_KEY="task:task";ut.MODULE_TASK_METADATA="task:task:options";ut.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";ut.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";ut.MODULE_TASK_QUEUE_KEY="task:task:queue";ut.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";ut.WS_CONTROLLER_KEY="ws:controller";ut.WS_EVENT_KEY="ws:event";ut.HSF_KEY="rpc:hsf";ut.RPC_GRPC_KEY="rpc:grpc";ut.RPC_DUBBO_KEY="rpc:dubbo";ut.MS_CONSUMER_KEY="ms:consumer";ut.MS_PRODUCER_KEY="ms:producer";ut.MS_PROVIDER_KEY="ms:provider";ut.MS_GRPC_METHOD_KEY="ms:grpc:method";ut.MS_DUBBO_METHOD_KEY="ms:dubbo:method";ut.MS_HSF_METHOD_KEY="ms:hsf:method";ut.CONFIG_KEY="config";ut.PLUGIN_KEY="plugin";ut.LOGGER_KEY="logger";ut.APPLICATION_KEY="__midway_framework_app__";ut.APPLICATION_CONTEXT_KEY="__midway_application_context__";ut.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";ut.NAMED_TAG="named";ut.INJECT_TAG="inject";ut.INJECT_CUSTOM_PROPERTY="inject_custom_property";ut.INJECT_CUSTOM_METHOD="inject_custom_method";ut.INJECT_CUSTOM_PARAM="inject_custom_param";ut.TAGGED_CLS="injection:tagged_class";ut.TAGGED_FUN="injection:tagged_function";ut.OBJ_DEF_CLS="injection:object_definition_class";ut.PIPELINE_IDENTIFIER="__pipeline_identifier__";ut.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__";ut.MAIN_MODULE_KEY="__main__";ut.PRIVATE_META_DATA_KEY="__midway_private_meta_data__"},45317:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createCustomParamDecorator=ut.createCustomMethodDecorator=ut.createCustomPropertyDecorator=ut.getMethodReturnTypes=ut.getPropertyType=ut.getMethodParamTypes=ut.BaseType=ut.isProvide=ut.getProviderUUId=ut.getProviderName=ut.getProviderId=ut.saveProviderId=ut.getObjectDefinition=ut.saveObjectDefinition=ut.getPropertyInject=ut.savePropertyInject=ut.transformTypeFromTSDesign=ut.clearAllModule=ut.resetModule=ut.listModule=ut.clearBindContainer=ut.bindContainer=ut.saveModule=ut.listPreloadModule=ut.savePreloadModule=ut.getPropertyMetadata=ut.attachPropertyMetadata=ut.savePropertyMetadata=ut.listPropertyDataFromClass=ut.getPropertyDataFromClass=ut.attachPropertyDataToClass=ut.savePropertyDataToClass=ut.getClassMetadata=ut.getClassExtendedMetadata=ut.attachClassMetadata=ut.saveClassMetadata=ut.DecoratorManager=ut.INJECT_CLASS_KEY_PREFIX=ut.PRELOAD_MODULE_KEY=void 0;pt(37159);const dt=pt(6192);const ft=pt(75105);const _t=pt(63289);const mt=pt(90406);const ht=pt(65308);const yt=pt(61327);const vt=pt(39023).debuglog("midway:core");ut.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY";ut.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class DecoratorManager extends Map{constructor(){super(...arguments);this.injectClassKeyPrefix=ut.INJECT_CLASS_KEY_PREFIX;this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA";this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(ct,ut){if(this.container){return this.container.saveModule(ct,ut)}if(!this.has(ct)){this.set(ct,new Set)}this.get(ct).add(ut)}listModule(ct){if(this.container){return this.container.listModule(ct)}return Array.from(this.get(ct)||{})}resetModule(ct){this.set(ct,new Set)}bindContainer(ct){this.container=ct;this.container.transformModule(this)}static getDecoratorClassKey(ct){return ct.toString()+"_CLS"}static removeDecoratorClassKeySuffix(ct){return ct.toString().replace("_CLS","")}static getDecoratorMethodKey(ct){return ct.toString()+"_METHOD"}static getDecoratorClsExtendedKey(ct){return ct.toString()+"_EXT"}static getDecoratorClsMethodPrefix(ct){return ct.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(ct,ut){return DecoratorManager.getDecoratorClsMethodPrefix(ct)+":"+ut.toString()}static getDecoratorMethod(ct,ut){return DecoratorManager.getDecoratorMethodKey(ct)+"_"+ut.toString()}static saveMetadata(ct,ut,pt,dt){if(typeof ut==="object"&&ut.constructor){ut=ut.constructor}let ft;if(Reflect.hasOwnMetadata(ct,ut)){ft=Reflect.getMetadata(ct,ut)}else{ft=new Map}ft.set(pt,dt);Reflect.defineMetadata(ct,ft,ut)}static attachMetadata(ct,ut,pt,dt,ft,_t="one"){if(typeof ut==="object"&&ut.constructor){ut=ut.constructor}let mt;if(Reflect.hasOwnMetadata(ct,ut)){mt=Reflect.getMetadata(ct,ut)}else{mt=new Map}if(!mt.has(pt)){if(ft){mt.set(pt,{})}else{mt.set(pt,[])}}if(ft){if(_t==="one"){mt.get(pt)[ft]=dt}else{if(mt.get(pt)[ft]){mt.get(pt)[ft].push(dt)}else{mt.get(pt)[ft]=[dt]}}}else{mt.get(pt).push(dt)}Reflect.defineMetadata(ct,mt,ut)}static getMetadata(ct,ut,pt){if(typeof ut==="object"&&ut.constructor){ut=ut.constructor}let dt;if(!Reflect.hasOwnMetadata(ct,ut)){dt=new Map;Reflect.defineMetadata(ct,dt,ut)}else{dt=Reflect.getMetadata(ct,ut)}if(!pt){return dt}return dt.get(pt)}saveMetadata(ct,ut,pt,dt){if(dt){const ft=DecoratorManager.getDecoratorMethod(ct,dt);DecoratorManager.saveMetadata(this.injectMethodKeyPrefix,pt,ft,ut)}else{const dt=DecoratorManager.getDecoratorClassKey(ct);DecoratorManager.saveMetadata(this.injectClassKeyPrefix,pt,dt,ut)}}attachMetadata(ct,ut,pt,dt,ft,_t){if(dt){const mt=DecoratorManager.getDecoratorMethod(ct,dt);DecoratorManager.attachMetadata(this.injectMethodKeyPrefix,pt,mt,ut,ft,_t)}else{const dt=DecoratorManager.getDecoratorClassKey(ct);DecoratorManager.attachMetadata(this.injectClassKeyPrefix,pt,dt,ut,ft,_t)}}getMetadata(ct,ut,pt){if(pt){const dt=DecoratorManager.getDecoratorMethod(ct,pt);return DecoratorManager.getMetadata(this.injectMethodKeyPrefix,ut,dt)}else{const pt=`${DecoratorManager.getDecoratorClassKey(ct)}`;return DecoratorManager.getMetadata(this.injectClassKeyPrefix,ut,pt)}}savePropertyDataToClass(ct,ut,pt,dt){const ft=DecoratorManager.getDecoratorClsMethodKey(ct,dt);DecoratorManager.saveMetadata(this.injectClassMethodKeyPrefix,pt,ft,ut)}attachPropertyDataToClass(ct,ut,pt,dt,ft){const _t=DecoratorManager.getDecoratorClsMethodKey(ct,dt);DecoratorManager.attachMetadata(this.injectClassMethodKeyPrefix,pt,_t,ut,ft)}getPropertyDataFromClass(ct,ut,pt){const dt=DecoratorManager.getDecoratorClsMethodKey(ct,pt);return DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,ut,dt)}listPropertyDataFromClass(ct,ut){const pt=DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,ut);const dt=[];for(const[ut,ft]of pt){if(ut.indexOf(DecoratorManager.getDecoratorClsMethodPrefix(ct))!==-1){dt.push(ft)}}return dt}}ut.DecoratorManager=DecoratorManager;let St=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 ct=(0,yt.getModuleRequirePathList)("@midwayjs/core");if(ct.length){console.info("The module may be located in:");ct.forEach(((ct,ut)=>{console.info(`${ut+1}. ${ct}`)}))}St=global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]}else{global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=St}}function saveClassMetadata(ct,ut,pt,dt){if(dt&&typeof ut==="object"){const dt=St.getMetadata(ct,pt);if(!dt){return St.saveMetadata(ct,ut,pt)}if(Array.isArray(dt)){return St.saveMetadata(ct,dt.concat(ut),pt)}else{return St.saveMetadata(ct,Object.assign(dt,ut),pt)}}else{return St.saveMetadata(ct,ut,pt)}}ut.saveClassMetadata=saveClassMetadata;function attachClassMetadata(ct,ut,pt,dt,ft){return St.attachMetadata(ct,ut,pt,undefined,dt,ft)}ut.attachClassMetadata=attachClassMetadata;function getClassExtendedMetadata(ct,ut,pt,dt){if(dt===undefined){dt=true}const ft=DecoratorManager.getDecoratorClsExtendedKey(ct);let _t=St.getMetadata(ft,ut,pt);if(dt&&_t!==undefined){return _t}const mt=Reflect.getPrototypeOf(ut);if(mt&&mt.constructor!==Object){_t=(0,ht.merge)(getClassExtendedMetadata(ct,mt,pt,dt),St.getMetadata(ct,ut,pt))}St.saveMetadata(ft,_t||null,ut,pt);return _t}ut.getClassExtendedMetadata=getClassExtendedMetadata;function getClassMetadata(ct,ut){return St.getMetadata(ct,ut)}ut.getClassMetadata=getClassMetadata;function savePropertyDataToClass(ct,ut,pt,dt){return St.savePropertyDataToClass(ct,ut,pt,dt)}ut.savePropertyDataToClass=savePropertyDataToClass;function attachPropertyDataToClass(ct,ut,pt,dt,ft){return St.attachPropertyDataToClass(ct,ut,pt,dt,ft)}ut.attachPropertyDataToClass=attachPropertyDataToClass;function getPropertyDataFromClass(ct,ut,pt){return St.getPropertyDataFromClass(ct,ut,pt)}ut.getPropertyDataFromClass=getPropertyDataFromClass;function listPropertyDataFromClass(ct,ut){return St.listPropertyDataFromClass(ct,ut)}ut.listPropertyDataFromClass=listPropertyDataFromClass;function savePropertyMetadata(ct,ut,pt,dt){return St.saveMetadata(ct,ut,pt,dt)}ut.savePropertyMetadata=savePropertyMetadata;function attachPropertyMetadata(ct,ut,pt,dt){return St.attachMetadata(ct,ut,pt,dt)}ut.attachPropertyMetadata=attachPropertyMetadata;function getPropertyMetadata(ct,ut,pt){return St.getMetadata(ct,ut,pt)}ut.getPropertyMetadata=getPropertyMetadata;function savePreloadModule(ct){return saveModule(ut.PRELOAD_MODULE_KEY,ct)}ut.savePreloadModule=savePreloadModule;function listPreloadModule(){return listModule(ut.PRELOAD_MODULE_KEY)}ut.listPreloadModule=listPreloadModule;function saveModule(ct,ut){if((0,_t.isClass)(ut)){saveProviderId(undefined,ut)}return St.saveModule(ct,ut)}ut.saveModule=saveModule;function bindContainer(ct){return St.bindContainer(ct)}ut.bindContainer=bindContainer;function clearBindContainer(){return St.container=null}ut.clearBindContainer=clearBindContainer;function listModule(ct,ut){const pt=St.listModule(ct);if(ut){return pt.filter(ut)}else{return pt}}ut.listModule=listModule;function resetModule(ct){return St.resetModule(ct)}ut.resetModule=resetModule;function clearAllModule(){vt("--- clear all module here ---");return St.clear()}ut.clearAllModule=clearAllModule;function transformTypeFromTSDesign(ct){if((0,_t.isNullOrUndefined)(ct)){return{name:"undefined",isBaseType:true,originDesign:ct}}switch(ct.name){case"String":return{name:"string",isBaseType:true,originDesign:ct};case"Number":return{name:"number",isBaseType:true,originDesign:ct};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:ct};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:ct};case"Object":return{name:"object",isBaseType:true,originDesign:ct};case"Function":return{name:"function",isBaseType:true,originDesign:ct};default:return{name:ct.name,isBaseType:false,originDesign:ct}}}ut.transformTypeFromTSDesign=transformTypeFromTSDesign;function savePropertyInject(ct){let ut=ct.identifier;let pt=dt.InjectModeEnum.Identifier;if(!ut){const ft=getPropertyType(ct.target,ct.targetKey);if(!ft.isBaseType&&(0,_t.isClass)(ft.originDesign)&&isProvide(ft.originDesign)){ut=getProviderUUId(ft.originDesign);pt=dt.InjectModeEnum.Class}if(!ut){ut=ct.targetKey;pt=dt.InjectModeEnum.PropertyName}}attachClassMetadata(ft.INJECT_TAG,{targetKey:ct.targetKey,value:ut,args:ct.args,injectMode:pt},ct.target,ct.targetKey)}ut.savePropertyInject=savePropertyInject;function getPropertyInject(ct,ut){return getClassExtendedMetadata(ft.INJECT_TAG,ct,undefined,ut)}ut.getPropertyInject=getPropertyInject;function saveObjectDefinition(ct,ut={}){saveClassMetadata(ft.OBJ_DEF_CLS,ut,ct,true);return ct}ut.saveObjectDefinition=saveObjectDefinition;function getObjectDefinition(ct){return getClassExtendedMetadata(ft.OBJ_DEF_CLS,ct)}ut.getObjectDefinition=getObjectDefinition;function saveProviderId(ct,ut){if(isProvide(ut)){if(ct){const pt=getClassMetadata(ft.TAGGED_CLS,ut);if(pt.id!==ct){pt.id=ct;saveClassMetadata(ft.TAGGED_CLS,pt,ut);vt(`update provide: ${ut.name} -> ${pt.uuid}`)}}}else{const pt=(0,ht.generateRandomId)();saveClassMetadata(ft.TAGGED_CLS,{id:ct,originName:ut.name,uuid:pt,name:(0,mt.camelCase)(ut.name)},ut);vt(`save provide: ${ut.name} -> ${pt}`)}return ut}ut.saveProviderId=saveProviderId;function getProviderId(ct){const ut=getClassMetadata(ft.TAGGED_CLS,ct);if(ut&&ut.id){return ut.id}}ut.getProviderId=getProviderId;function getProviderName(ct){const ut=getClassMetadata(ft.TAGGED_CLS,ct);if(ut&&ut.name){return ut.name}}ut.getProviderName=getProviderName;function getProviderUUId(ct){const ut=getClassMetadata(ft.TAGGED_CLS,ct);if(ut&&ut.uuid){return ut.uuid}}ut.getProviderUUId=getProviderUUId;function isProvide(ct){return!!getClassMetadata(ft.TAGGED_CLS,ct)}ut.isProvide=isProvide;var bt;(function(ct){ct["Boolean"]="boolean";ct["Number"]="number";ct["String"]="string"})(bt=ut.BaseType||(ut.BaseType={}));function getMethodParamTypes(ct,ut){if((0,_t.isClass)(ct)){ct=ct.prototype}return Reflect.getMetadata("design:paramtypes",ct,ut)}ut.getMethodParamTypes=getMethodParamTypes;function getPropertyType(ct,ut){return transformTypeFromTSDesign(Reflect.getMetadata("design:type",ct,ut))}ut.getPropertyType=getPropertyType;function getMethodReturnTypes(ct,ut){if((0,_t.isClass)(ct)){ct=ct.prototype}return Reflect.getMetadata("design:returntype",ct,ut)}ut.getMethodReturnTypes=getMethodReturnTypes;function createCustomPropertyDecorator(ct,ut,pt=true){return function(dt,_t){attachClassMetadata(ft.INJECT_CUSTOM_PROPERTY,{propertyName:_t,key:ct,metadata:ut,impl:pt},dt,_t)}}ut.createCustomPropertyDecorator=createCustomPropertyDecorator;function createCustomMethodDecorator(ct,ut,pt={impl:true}){if(typeof pt==="boolean"){pt={impl:pt}}if(pt.impl===undefined){pt.impl=true}return function(dt,_t,mt){attachClassMetadata(ft.INJECT_CUSTOM_METHOD,{propertyName:_t,key:ct,metadata:ut,options:pt},dt)}}ut.createCustomMethodDecorator=createCustomMethodDecorator;function createCustomParamDecorator(ct,ut,pt={impl:true}){if(typeof pt==="boolean"){pt={impl:pt}}if(pt.impl===undefined){pt.impl=true}return function(dt,_t,mt){attachClassMetadata(ft.INJECT_CUSTOM_PARAM,{key:ct,parameterIndex:mt,propertyName:_t,metadata:ut,options:pt},dt,_t,"multi")}}ut.createCustomParamDecorator=createCustomParamDecorator},69193:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ServerlessTrigger=ut.ServerlessFunction=void 0;const dt=pt(49757);const ft=pt(6192);function ServerlessFunction(ct){return(ut,pt,ft)=>{(0,dt.savePropertyMetadata)(dt.SERVERLESS_FUNC_KEY,ct,ut,pt)}}ut.ServerlessFunction=ServerlessFunction;function ServerlessTrigger(ct,ut={}){return(pt,_t,mt)=>{var ht;if(ct===ft.ServerlessTriggerType.HTTP||ct===ft.ServerlessTriggerType.API_GATEWAY){ut["method"]=(ht=ut["method"])!==null&&ht!==void 0?ht:"get"}(0,dt.saveModule)(dt.FUNC_KEY,pt.constructor);ut=ut||{};(0,dt.attachClassMetadata)(dt.FUNC_KEY,{type:ct,methodName:_t,metadata:ut},pt)}}ut.ServerlessTrigger=ServerlessTrigger},49757:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ft(pt(39990),ut);ft(pt(92922),ut);ft(pt(52953),ut);ft(pt(76271),ut);ft(pt(2940),ut);ft(pt(73821),ut);ft(pt(18025),ut);ft(pt(1623),ut);ft(pt(41573),ut);ft(pt(17511),ut);ft(pt(41958),ut);ft(pt(64331),ut);ft(pt(56329),ut);ft(pt(69193),ut);ft(pt(86690),ut);ft(pt(58843),ut);ft(pt(29619),ut);ft(pt(92233),ut);ft(pt(75105),ut);ft(pt(45317),ut);ft(pt(573),ut);ft(pt(4132),ut);ft(pt(76543),ut);ft(pt(64767),ut);ft(pt(41684),ut);ft(pt(17640),ut);ft(pt(81970),ut);ft(pt(52963),ut);ft(pt(57706),ut);ft(pt(67999),ut);ft(pt(20551),ut)},573:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Consumer=void 0;const dt=pt(49757);const ft=pt(6192);function Consumer(ct,ut={}){return pt=>{(0,dt.saveModule)(dt.MS_CONSUMER_KEY,pt);(0,dt.saveClassMetadata)(dt.MS_CONSUMER_KEY,{type:ct,metadata:ut},pt);(0,dt.Scope)(ft.ScopeEnum.Request)(pt);(0,dt.Provide)()(pt)}}ut.Consumer=Consumer},64767:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.KafkaListener=void 0;const dt=pt(49757);function KafkaListener(ct,ut={}){return(pt,ft)=>{ut.topic=ct;ut.propertyKey=ft;(0,dt.attachPropertyDataToClass)(dt.MS_CONSUMER_KEY,ut,pt,ft)}}ut.KafkaListener=KafkaListener},4132:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.DubboMethod=ut.GrpcMethod=ut.GrpcStreamTypeEnum=ut.Provider=void 0;const dt=pt(49757);const ft=pt(6192);function Provider(ct,ut={}){return pt=>{(0,dt.saveModule)(dt.MS_PROVIDER_KEY,pt);(0,dt.saveClassMetadata)(dt.MS_PROVIDER_KEY,{type:ct,metadata:ut},pt);(0,dt.Scope)(ft.ScopeEnum.Request)(pt);(0,dt.Provide)()(pt)}}ut.Provider=Provider;var _t;(function(ct){ct["BASE"]="base";ct["DUPLEX"]="ServerDuplexStream";ct["READABLE"]="ServerReadableStream";ct["WRITEABLE"]="ServerWritableStream"})(_t=ut.GrpcStreamTypeEnum||(ut.GrpcStreamTypeEnum={}));function GrpcMethod(ct={}){return(ut,pt,ft)=>{if(!ct.type){ct.type=_t.BASE}(0,dt.savePropertyMetadata)(dt.MS_GRPC_METHOD_KEY,{methodName:ct.methodName||pt,type:ct.type,onEnd:ct.onEnd},ut,pt);return ft}}ut.GrpcMethod=GrpcMethod;function DubboMethod(ct){return(ut,pt,ft)=>{(0,dt.attachClassMetadata)(dt.MS_DUBBO_METHOD_KEY,{methodName:ct||pt},ut);return ft}}ut.DubboMethod=DubboMethod},76543:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.RabbitMQListener=void 0;const dt=pt(49757);function RabbitMQListener(ct,ut={}){return(pt,ft)=>{ut.queueName=ct;ut.propertyKey=ft;(0,dt.attachPropertyDataToClass)(dt.MS_CONSUMER_KEY,ut,pt,ft)}}ut.RabbitMQListener=RabbitMQListener},41684:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.HSF=void 0;const dt=pt(49757);const ft=pt(6192);function HSF(ct={}){return ut=>{(0,dt.saveModule)(dt.HSF_KEY,ut);(0,dt.saveClassMetadata)(dt.HSF_KEY,ct,ut);(0,dt.Scope)(ft.ScopeEnum.Request)(ut);(0,dt.Provide)()(ut)}}ut.HSF=HSF},17640:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Queue=void 0;const dt=pt(49757);const ft=pt(75105);function Queue(ct){return function(ut){(0,dt.saveModule)(ft.MODULE_TASK_QUEUE_KEY,ut);(0,dt.saveClassMetadata)(ft.MODULE_TASK_QUEUE_OPTIONS,{options:ct,name:ut.name},ut);(0,dt.Provide)()(ut)}}ut.Queue=Queue},57706:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Schedule=void 0;const dt=pt(49757);const ft=pt(6192);function Schedule(ct){return function(ut){(0,dt.saveModule)(dt.SCHEDULE_KEY,ut);(0,dt.saveClassMetadata)(dt.SCHEDULE_KEY,ct,ut);(0,dt.Scope)(ft.ScopeEnum.Request)(ut);(0,dt.Provide)()(ut)}}ut.Schedule=Schedule},81970:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Task=void 0;const dt=pt(49757);const ft=pt(75105);function Task(ct){return function(ut,pt,_t){(0,dt.saveModule)(ft.MODULE_TASK_KEY,ut.constructor);(0,dt.attachClassMetadata)(ft.MODULE_TASK_METADATA,{options:ct,propertyKey:pt,value:_t.value,name:ut.constructor.name},ut)}}ut.Task=Task},52963:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.TaskLocal=void 0;const dt=pt(49757);const ft=pt(75105);function TaskLocal(ct){return function(ut,pt,_t){(0,dt.saveModule)(ft.MODULE_TASK_TASK_LOCAL_KEY,ut.constructor);(0,dt.attachClassMetadata)(ft.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:ct,propertyKey:pt,value:_t.value},ut)}}ut.TaskLocal=TaskLocal},86690:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Controller=void 0;const dt=pt(49757);const ft=pt(6192);function Controller(ct="/",ut={middleware:[],sensitive:true}){return pt=>{(0,dt.saveModule)(dt.CONTROLLER_KEY,pt);if(ct)(0,dt.saveClassMetadata)(dt.CONTROLLER_KEY,{prefix:ct,routerOptions:ut},pt);(0,dt.Scope)(ft.ScopeEnum.Request)(pt);(0,dt.Provide)()(pt)}}ut.Controller=Controller},58843:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Fields=ut.Queries=ut.RequestIP=ut.RequestPath=ut.Files=ut.File=ut.Headers=ut.Param=ut.Query=ut.Body=ut.Session=ut.createRequestParamDecorator=ut.RouteParamTypes=void 0;const dt=pt(49757);var ft;(function(ct){ct["QUERY"]="query";ct["BODY"]="body";ct["PARAM"]="param";ct["HEADERS"]="headers";ct["SESSION"]="session";ct["FILESTREAM"]="file_stream";ct["FILESSTREAM"]="files_stream";ct["NEXT"]="next";ct["REQUEST_PATH"]="request_path";ct["REQUEST_IP"]="request_ip";ct["QUERIES"]="queries";ct["FIELDS"]="fields";ct["CUSTOM"]="custom"})(ft=ut.RouteParamTypes||(ut.RouteParamTypes={}));const createParamMapping=function(ct){return(ut,pt={})=>{let ft=ut;if(Array.isArray(ut)&&pt.pipes===undefined){pt.pipes=ut;ft=undefined}return(0,dt.createCustomParamDecorator)(dt.WEB_ROUTER_PARAM_KEY,{type:ct,propertyData:ft},pt)}};const createRequestParamDecorator=function(ct,ut){ut=ut||{};if(Array.isArray(ut)){ut={pipes:ut}}return createParamMapping(ft.CUSTOM)(ct,ut)};ut.createRequestParamDecorator=createRequestParamDecorator;const Session=(ct,ut)=>createParamMapping(ft.SESSION)(ct,{pipes:ut});ut.Session=Session;const Body=(ct,ut)=>createParamMapping(ft.BODY)(ct,{pipes:ut});ut.Body=Body;const Query=(ct,ut)=>createParamMapping(ft.QUERY)(ct,{pipes:ut});ut.Query=Query;const Param=(ct,ut)=>createParamMapping(ft.PARAM)(ct,{pipes:ut});ut.Param=Param;const Headers=(ct,ut)=>createParamMapping(ft.HEADERS)(ct,{pipes:ut});ut.Headers=Headers;const File=(ct,ut)=>createParamMapping(ft.FILESTREAM)(ct,{pipes:ut});ut.File=File;const Files=(ct,ut)=>createParamMapping(ft.FILESSTREAM)(ct,{pipes:ut});ut.Files=Files;const RequestPath=ct=>createParamMapping(ft.REQUEST_PATH)(undefined,{pipes:ct});ut.RequestPath=RequestPath;const RequestIP=ct=>createParamMapping(ft.REQUEST_IP)(undefined,{pipes:ct});ut.RequestIP=RequestIP;const Queries=(ct,ut)=>createParamMapping(ft.QUERIES)(ct,{pipes:ut});ut.Queries=Queries;const Fields=(ct,ut)=>createParamMapping(ft.FIELDS)(ct,{pipes:ut});ut.Fields=Fields},29619:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.All=ut.Head=ut.Options=ut.Patch=ut.Put=ut.Del=ut.Get=ut.Post=ut.RequestMapping=ut.RequestMethod=void 0;const dt=pt(49757);ut.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const ft={path:"/",requestMethod:ut.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(ct=ft)=>{const pt=ct.path||"/";const _t=ct.requestMethod||ut.RequestMethod.GET;const mt=ct.routerName;const ht=ct.middleware;return(ut,ft,yt)=>{var vt;(0,dt.attachClassMetadata)(dt.WEB_ROUTER_KEY,{path:pt,requestMethod:_t,routerName:mt,method:ft,middleware:ht,summary:(ct===null||ct===void 0?void 0:ct.summary)||"",description:(ct===null||ct===void 0?void 0:ct.description)||"",ignoreGlobalPrefix:(vt=ct===null||ct===void 0?void 0:ct.ignoreGlobalPrefix)!==null&&vt!==void 0?vt:false},ut);return yt}};ut.RequestMapping=RequestMapping;const createMappingDecorator=ct=>(pt,dt={middleware:[]})=>(0,ut.RequestMapping)(Object.assign(dt,{requestMethod:ct,path:pt}));ut.Post=createMappingDecorator(ut.RequestMethod.POST);ut.Get=createMappingDecorator(ut.RequestMethod.GET);ut.Del=createMappingDecorator(ut.RequestMethod.DELETE);ut.Put=createMappingDecorator(ut.RequestMethod.PUT);ut.Patch=createMappingDecorator(ut.RequestMethod.PATCH);ut.Options=createMappingDecorator(ut.RequestMethod.OPTIONS);ut.Head=createMappingDecorator(ut.RequestMethod.HEAD);ut.All=createMappingDecorator(ut.RequestMethod.ALL)},92233:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createRender=ut.ContentType=ut.SetHeader=ut.HttpCode=ut.Redirect=void 0;const dt=pt(49757);function Redirect(ct,ut=302){return(pt,ft,_t)=>{(0,dt.attachPropertyMetadata)(dt.WEB_RESPONSE_KEY,{type:dt.WEB_RESPONSE_REDIRECT,url:ct,code:ut},pt,ft);return _t}}ut.Redirect=Redirect;function HttpCode(ct){return(ut,pt,ft)=>{(0,dt.attachPropertyMetadata)(dt.WEB_RESPONSE_KEY,{type:dt.WEB_RESPONSE_HTTP_CODE,code:ct},ut,pt);return ft}}ut.HttpCode=HttpCode;function SetHeader(ct,ut){return(pt,ft,_t)=>{let mt={};if(ut){mt[ct]=ut}else{mt=ct}(0,dt.attachPropertyMetadata)(dt.WEB_RESPONSE_KEY,{type:dt.WEB_RESPONSE_HEADER,setHeaders:mt},pt,ft);return _t}}ut.SetHeader=SetHeader;function ContentType(ct){return(ut,pt,ft)=>{(0,dt.attachPropertyMetadata)(dt.WEB_RESPONSE_KEY,{type:dt.WEB_RESPONSE_CONTENT_TYPE,contentType:ct},ut,pt);return ft}}ut.ContentType=ContentType;function createRender(ct){return ct=>(ut,pt,ft)=>{(0,dt.attachPropertyMetadata)(dt.WEB_RESPONSE_KEY,{type:dt.WEB_RESPONSE_RENDER,templateName:ct},ut,pt);return ft}}ut.createRender=createRender},67999:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.WSController=void 0;const dt=pt(49757);const ft=pt(6192);function WSController(ct="/",ut={middleware:[],connectionMiddleware:[]}){return pt=>{(0,dt.saveModule)(dt.WS_CONTROLLER_KEY,pt);(0,dt.saveClassMetadata)(dt.WS_CONTROLLER_KEY,{namespace:ct,routerOptions:ut},pt);(0,dt.Scope)(ft.ScopeEnum.Request)(pt);(0,dt.Provide)()(pt)}}ut.WSController=WSController},20551:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.OnConnection=ut.OnDisConnection=ut.Emit=ut.OnMessage=ut.WSBroadCast=ut.WSEmit=ut.OnWSMessage=ut.OnWSDisConnection=ut.OnWSConnection=ut.WSEventTypeEnum=void 0;const dt=pt(49757);var ft;(function(ct){ct["ON_CONNECTION"]="ws:onConnection";ct["ON_DISCONNECTION"]="ws:onDisconnection";ct["ON_MESSAGE"]="ws:onMessage";ct["ON_SOCKET_ERROR"]="ws:onSocketError";ct["EMIT"]="ws:Emit";ct["BROADCAST"]="ws:broadcast"})(ft=ut.WSEventTypeEnum||(ut.WSEventTypeEnum={}));function OnWSConnection(ct={}){return(ut,pt,_t)=>{(0,dt.attachClassMetadata)(dt.WS_EVENT_KEY,{eventType:ft.ON_CONNECTION,propertyName:pt,eventOptions:ct,descriptor:_t},ut.constructor)}}ut.OnWSConnection=OnWSConnection;function OnWSDisConnection(){return(ct,ut,pt)=>{(0,dt.attachClassMetadata)(dt.WS_EVENT_KEY,{eventType:ft.ON_DISCONNECTION,propertyName:ut,descriptor:pt},ct.constructor)}}ut.OnWSDisConnection=OnWSDisConnection;function OnWSMessage(ct,ut={}){return(pt,_t,mt)=>{(0,dt.attachClassMetadata)(dt.WS_EVENT_KEY,{eventType:ft.ON_MESSAGE,messageEventName:ct,propertyName:_t,eventOptions:ut,descriptor:mt},pt.constructor)}}ut.OnWSMessage=OnWSMessage;function WSEmit(ct,ut=[]){return(pt,_t,mt)=>{(0,dt.attachClassMetadata)(dt.WS_EVENT_KEY,{eventType:ft.EMIT,propertyName:_t,messageEventName:ct,roomName:[].concat(ut),descriptor:mt},pt.constructor)}}ut.WSEmit=WSEmit;function WSBroadCast(ct="",ut=[]){return(pt,_t,mt)=>{(0,dt.attachClassMetadata)(dt.WS_EVENT_KEY,{eventType:ft.BROADCAST,propertyName:_t,messageEventName:ct,roomName:[].concat(ut),descriptor:mt},pt.constructor)}}ut.WSBroadCast=WSBroadCast;ut.OnMessage=OnWSMessage;ut.Emit=WSEmit;ut.OnDisConnection=OnWSDisConnection;ut.OnConnection=OnWSConnection},34881:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.FunctionDefinition=void 0;const dt=pt(6192);const ft=pt(59327);class FunctionWrapperCreator extends ft.ObjectCreator{doConstruct(ct,ut,pt){if(!ct){return null}return ct(pt,ut)}async doConstructAsync(ct,ut,pt){if(!ct){return null}return ct(pt,ut)}}class FunctionDefinition{constructor(){this.constructorArgs=[];this.namespace="";this.asynchronous=true;this.handlerProps=[];this.allowDowngrade=false;this.innerAutowire=false;this.innerScope=dt.ScopeEnum.Singleton;this.creator=new FunctionWrapperCreator(this)}getAttr(ct){}hasAttr(ct){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(ct){this.innerScope=ct}isSingletonScope(){return this.innerScope===dt.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===dt.ScopeEnum.Request}setAttr(ct,ut){}}ut.FunctionDefinition=FunctionDefinition},59327:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ObjectCreator=void 0;const dt=pt(86314);const ft=pt(63289);class ObjectCreator{constructor(ct){this.definition=ct}load(){let ct=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return ct}const ut=this.definition.path;if(this.definition.export){ct=require(ut)[this.definition.export]}else{ct=require(ut)}}else{ct=this.definition.path}return ct}doConstruct(ct,ut){if(!ct){return Object.create(null)}let pt;if(this.definition.constructMethod){pt=ct[this.definition.constructMethod].apply(ct,ut)}else{pt=Reflect.construct(ct,ut)}return pt}async doConstructAsync(ct,ut){if(!ct){return Object.create(null)}let pt;if(this.definition.constructMethod){const dt=ct[this.definition.constructMethod];if(ft.Types.isAsyncFunction(dt)){pt=await dt.apply(ct,ut)}else{pt=dt.apply(ct,ut)}}else{pt=Reflect.construct(ct,ut)}return pt}doInit(ct){const ut=ct;if(this.definition.initMethod&&ut[this.definition.initMethod]){if(ft.Types.isGeneratorFunction(ut[this.definition.initMethod])||ft.Types.isAsyncFunction(ut[this.definition.initMethod])){throw new dt.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const ct=ut[this.definition.initMethod].call(ut);if(ft.Types.isPromise(ct)){throw new dt.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(ct){const ut=ct;if(this.definition.initMethod&&ut[this.definition.initMethod]){const ct=ut[this.definition.initMethod];if(ft.Types.isAsyncFunction(ct)){await ct.call(ut)}else{if(ct.length===1){await new Promise((pt=>{ct.call(ut,pt)}))}else{ct.call(ut)}}}}doDestroy(ct){if(this.definition.destroyMethod&&ct[this.definition.destroyMethod]){ct[this.definition.destroyMethod].call(ct)}}async doDestroyAsync(ct){if(this.definition.destroyMethod&&ct[this.definition.destroyMethod]){const ut=ct[this.definition.destroyMethod];if(ft.Types.isAsyncFunction(ut)){await ut.call(ct)}else{if(ut.length===1){await new Promise((pt=>{ut.call(ct,pt)}))}else{ut.call(ct)}}}}}ut.ObjectCreator=ObjectCreator},47698:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ObjectDefinition=void 0;const dt=pt(6192);const ft=pt(74701);const _t=pt(59327);class ObjectDefinition{constructor(){this._attrs=new Map;this._asynchronous=false;this.scope=dt.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 ft.ObjectProperties;this.namespace="";this.handlerProps=[];this.allowDowngrade=false;this.creator=new _t.ObjectCreator(this)}set asynchronous(ct){this._asynchronous=ct}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===dt.ScopeEnum.Singleton}isRequestScope(){return this.scope===dt.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(ct){return this._attrs.get(ct)}hasAttr(ct){return this._attrs.has(ct)}setAttr(ct,ut){this._attrs.set(ct,ut)}}ut.ObjectDefinition=ObjectDefinition},74701:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ObjectProperties=void 0;class ObjectProperties extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(ct,ut){if(this.has(ct)){return this.get(ct)}return ut}setProperty(ct,ut){return this.set(ct,ut)}}ut.ObjectProperties=ObjectProperties},21769:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayHttpError=ut.MidwayError=ut.registerErrorCode=void 0;const dt=pt(58611);const ft=new Set;function registerErrorCode(ct,ut){if(ft.has(ct)){throw new MidwayError(`Error group ${ct} is duplicated, please check before adding.`)}else{ft.add(ct)}const pt={};for(const dt in ut){pt[dt]=ct.toUpperCase()+"_"+String(ut[dt]).toUpperCase()}return pt}ut.registerErrorCode=registerErrorCode;class MidwayError extends Error{constructor(ct,ut,pt){super(ct);if(!ut||typeof ut==="object"){pt=ut;ut="MIDWAY_10000"}this.name=this.constructor.name;this.code=ut;this.cause=pt===null||pt===void 0?void 0:pt.cause}}ut.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{constructor(ct,ut,pt,ft){super(ct?typeof ct==="string"?ct:ct.message:dt.STATUS_CODES[ut],pt!==null&&pt!==void 0?pt:String(ut),ft);if(ct&&ct["stack"]){this.stack=ct["stack"]}this.status=ut}}ut.MidwayHttpError=MidwayHttpError},37198:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayEmptyValueError=ut.MidwayInvalidConfigPropertyError=ut.MidwayMainFrameworkMissingError=ut.MidwayCodeInvokeTimeoutError=ut.MidwayInvokeForbiddenError=ut.MidwayRetryExceededMaxTimesError=ut.MidwayDuplicateControllerOptionsError=ut.MidwayDuplicateClassNameError=ut.MidwayInconsistentVersionError=ut.MidwayUtilHttpClientTimeoutError=ut.MidwayMissingImportComponentError=ut.MidwaySingletonInjectRequestError=ut.MidwayUseWrongMethodError=ut.MidwayDuplicateRouteError=ut.MidwayResolverMissingError=ut.MidwayInvalidConfigError=ut.MidwayConfigMissingError=ut.MidwayFeatureNotImplementedError=ut.MidwayFeatureNoLongerSupportedError=ut.MidwayDefinitionNotFoundError=ut.MidwayParameterError=ut.MidwayCommonError=ut.FrameworkErrorEnum=void 0;const dt=pt(21769);ut.FrameworkErrorEnum=(0,dt.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 dt.MidwayError{constructor(ct){super(ct,ut.FrameworkErrorEnum.COMMON)}}ut.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends dt.MidwayError{constructor(ct){super(ct!==null&&ct!==void 0?ct:"Parameter type not match",ut.FrameworkErrorEnum.PARAM_TYPE)}}ut.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends dt.MidwayError{static isClosePrototypeOf(ct){return ct?ct[MidwayDefinitionNotFoundError.type]===MidwayDefinitionNotFoundError.type:false}constructor(ct){super(`${ct} is not valid in current context`,ut.FrameworkErrorEnum.DEFINITION_NOT_FOUND);this[MidwayDefinitionNotFoundError.type]=MidwayDefinitionNotFoundError.type}updateErrorMsg(ct){const ut=this.message.split(" is not valid in current context")[0];this.message=`${ut} in class ${ct} is not valid in current context`}}ut.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;MidwayDefinitionNotFoundError.type=Symbol.for("#NotFoundError");class MidwayFeatureNoLongerSupportedError extends dt.MidwayError{constructor(ct){super("This feature no longer supported \n"+ct,ut.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}ut.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends dt.MidwayError{constructor(ct){super("This feature not implemented \n"+ct,ut.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}ut.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends dt.MidwayError{constructor(ct){super(`Can't found config key "${ct}" in your config, please set it first`,ut.FrameworkErrorEnum.MISSING_CONFIG)}}ut.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends dt.MidwayError{constructor(ct){super("Invalid config file \n"+ct,ut.FrameworkErrorEnum.INVALID_CONFIG)}}ut.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayResolverMissingError extends dt.MidwayError{constructor(ct){super(`Resolver "${ct}" is missing.`,ut.FrameworkErrorEnum.MISSING_RESOLVER)}}ut.MidwayResolverMissingError=MidwayResolverMissingError;class MidwayDuplicateRouteError extends dt.MidwayError{constructor(ct,pt,dt){super(`Duplicate router "${ct}" at "${pt}" and "${dt}"`,ut.FrameworkErrorEnum.DUPLICATE_ROUTER)}}ut.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends dt.MidwayError{constructor(ct,pt,dt){const ft=dt?`${dt} not valid by ${ct}, Use ${pt} instead!`:`You should not invoked by ${ct}, Use ${pt} instead!`;super(ft,ut.FrameworkErrorEnum.USE_WRONG_METHOD)}}ut.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends dt.MidwayError{constructor(ct,pt){const dt=`${ct} with singleton scope can't implicitly inject ${pt} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${pt} or use "ctx.requestContext.getAsync(${pt})".`;super(dt,ut.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}ut.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends dt.MidwayError{constructor(ct){const pt=`"${ct}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(pt,ut.FrameworkErrorEnum.MISSING_IMPORTS)}}ut.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends dt.MidwayError{constructor(ct){super(ct,ut.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}ut.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends dt.MidwayError{constructor(){const ct='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(ct,ut.FrameworkErrorEnum.INCONSISTENT_VERSION)}}ut.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends dt.MidwayError{constructor(ct,pt,dt){super(`"${ct}" duplicated between "${pt}" and "${dt}"`,ut.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}ut.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends dt.MidwayError{constructor(ct,pt,dt){super(`"Prefix ${ct}" with duplicated controller options between "${pt}" and "${dt}"`,ut.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}ut.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends dt.MidwayError{constructor(ct,pt,dt){super(`Invoke "${ct}" retries exceeded the maximum number of times(${pt}), error: ${dt.message}`,ut.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:dt})}}ut.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends dt.MidwayError{constructor(ct,pt){super(`Invoke "${pt?pt.name:"unknown"}.${ct}" is forbidden.`,ut.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}ut.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends dt.MidwayError{constructor(ct,pt){super(`Invoke "${ct}" running timeout(${pt}ms)`,ut.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}ut.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends dt.MidwayError{constructor(){super("Main framework missing, please check your configuration.",ut.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}ut.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends dt.MidwayError{constructor(ct,pt){super(`Invalid config property "${ct}", ${pt?`only ${pt.join(",")} can be set`:"please check your configuration"}.`,ut.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}ut.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends dt.MidwayError{constructor(ct){super(ct!==null&&ct!==void 0?ct:"There is an empty value got and it is not allowed.",ut.FrameworkErrorEnum.EMPTY_VALUE)}}ut.MidwayEmptyValueError=MidwayEmptyValueError},9504:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.httpError=ut.GatewayTimeoutError=ut.ServiceUnavailableError=ut.BadGatewayError=ut.NotImplementedError=ut.InternalServerErrorError=ut.TooManyRequestsError=ut.UnprocessableEntityError=ut.UnsupportedMediaTypeError=ut.PayloadTooLargeError=ut.GoneError=ut.ConflictError=ut.RequestTimeoutError=ut.NotAcceptableError=ut.ForbiddenError=ut.NotFoundError=ut.UnauthorizedError=ut.BadRequestError=ut.HttpStatus=void 0;const dt=pt(21769);var ft;(function(ct){ct[ct["CONTINUE"]=100]="CONTINUE";ct[ct["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";ct[ct["PROCESSING"]=102]="PROCESSING";ct[ct["EARLYHINTS"]=103]="EARLYHINTS";ct[ct["OK"]=200]="OK";ct[ct["CREATED"]=201]="CREATED";ct[ct["ACCEPTED"]=202]="ACCEPTED";ct[ct["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";ct[ct["NO_CONTENT"]=204]="NO_CONTENT";ct[ct["RESET_CONTENT"]=205]="RESET_CONTENT";ct[ct["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";ct[ct["AMBIGUOUS"]=300]="AMBIGUOUS";ct[ct["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";ct[ct["FOUND"]=302]="FOUND";ct[ct["SEE_OTHER"]=303]="SEE_OTHER";ct[ct["NOT_MODIFIED"]=304]="NOT_MODIFIED";ct[ct["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";ct[ct["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";ct[ct["BAD_REQUEST"]=400]="BAD_REQUEST";ct[ct["UNAUTHORIZED"]=401]="UNAUTHORIZED";ct[ct["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";ct[ct["FORBIDDEN"]=403]="FORBIDDEN";ct[ct["NOT_FOUND"]=404]="NOT_FOUND";ct[ct["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";ct[ct["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";ct[ct["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";ct[ct["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";ct[ct["CONFLICT"]=409]="CONFLICT";ct[ct["GONE"]=410]="GONE";ct[ct["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";ct[ct["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";ct[ct["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";ct[ct["URI_TOO_LONG"]=414]="URI_TOO_LONG";ct[ct["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";ct[ct["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";ct[ct["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";ct[ct["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";ct[ct["MISDIRECTED"]=421]="MISDIRECTED";ct[ct["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";ct[ct["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";ct[ct["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";ct[ct["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";ct[ct["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";ct[ct["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";ct[ct["BAD_GATEWAY"]=502]="BAD_GATEWAY";ct[ct["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";ct[ct["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";ct[ct["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(ft=ut.HttpStatus||(ut.HttpStatus={}));class BadRequestError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.BAD_REQUEST)}}ut.BadRequestError=BadRequestError;class UnauthorizedError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.UNAUTHORIZED)}}ut.UnauthorizedError=UnauthorizedError;class NotFoundError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.NOT_FOUND)}}ut.NotFoundError=NotFoundError;class ForbiddenError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.FORBIDDEN)}}ut.ForbiddenError=ForbiddenError;class NotAcceptableError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.NOT_ACCEPTABLE)}}ut.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.REQUEST_TIMEOUT)}}ut.RequestTimeoutError=RequestTimeoutError;class ConflictError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.CONFLICT)}}ut.ConflictError=ConflictError;class GoneError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.GONE)}}ut.GoneError=GoneError;class PayloadTooLargeError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.PAYLOAD_TOO_LARGE)}}ut.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.UNSUPPORTED_MEDIA_TYPE)}}ut.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.UNPROCESSABLE_ENTITY)}}ut.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.TOO_MANY_REQUESTS)}}ut.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.INTERNAL_SERVER_ERROR)}}ut.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.NOT_IMPLEMENTED)}}ut.NotImplementedError=NotImplementedError;class BadGatewayError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.BAD_GATEWAY)}}ut.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.SERVICE_UNAVAILABLE)}}ut.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends dt.MidwayHttpError{constructor(ct){super(ct,ft.GATEWAY_TIMEOUT)}}ut.GatewayTimeoutError=GatewayTimeoutError;ut.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(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.httpError=ut.HttpStatus=void 0;ft(pt(21769),ut);var _t=pt(9504);Object.defineProperty(ut,"HttpStatus",{enumerable:true,get:function(){return _t.HttpStatus}});Object.defineProperty(ut,"httpError",{enumerable:true,get:function(){return _t.httpError}});ft(pt(37198),ut)},24451:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createConfiguration=ut.FunctionalConfiguration=void 0;class FunctionalConfiguration{constructor(ct){this.options=ct;this.readyHandler=()=>{};this.stopHandler=()=>{};this.configLoadHandler=()=>{};this.serverReadyHandler=()=>{}}onConfigLoad(ct,ut){if(typeof ct==="function"){this.configLoadHandler=ct}else{return this.configLoadHandler(ct,ut)}return this}onReady(ct,ut){if(typeof ct==="function"){this.readyHandler=ct}else{return this.readyHandler(ct,ut)}return this}onServerReady(ct,ut){if(typeof ct==="function"){this.serverReadyHandler=ct}else{return this.serverReadyHandler(ct,ut)}return this}onStop(ct,ut){if(typeof ct==="function"){this.stopHandler=ct}else{return this.stopHandler(ct,ut)}return this}getConfigurationOptions(){return this.options}}ut.FunctionalConfiguration=FunctionalConfiguration;const createConfiguration=ct=>new FunctionalConfiguration(ct);ut.createConfiguration=createConfiguration},46123:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayPerformanceManager=ut.TypedResourceManager=ut.HttpServerResponse=ut.ServerResponse=ut.FORMAT=ut.FileUtils=ut.PathFileUtil=ut.Types=ut.retryWith=ut.retryWithAsync=ut.extend=ut.Utils=ut.sleep=ut.isTypeScriptEnvironment=ut.wrapAsync=ut.wrapMiddleware=ut.pathMatching=ut.transformRequestObjectByType=ut.deprecatedOutput=ut.delegateTargetAllPrototypeMethod=ut.delegateTargetProperties=ut.delegateTargetMethod=ut.delegateTargetPrototypeMethod=ut.loadModule=ut.safeRequire=ut.safelyGet=ut.ASYNC_ROOT_CONTEXT=ut.MidwayPriorityManager=ut.DEFAULT_PRIORITY=ut.DataSourceManager=ut.WebRouterCollector=ut.MidwayServerlessFunctionService=ut.MidwayWebRouterService=ut.MidwayHealthService=ut.MidwayMockService=ut.MidwayDecoratorService=ut.MidwayMiddlewareService=ut.MidwayLifeCycleService=ut.MidwayAspectService=ut.MidwayFrameworkService=ut.MidwayLoggerService=ut.MidwayInformationService=ut.MidwayEnvironmentService=ut.MidwayConfigService=ut.FunctionalConfiguration=ut.createConfiguration=ut.BaseFramework=ut.MidwayRequestContainer=void 0;ft(pt(6192),ut);ft(pt(9288),ut);var _t=pt(97983);Object.defineProperty(ut,"MidwayRequestContainer",{enumerable:true,get:function(){return _t.MidwayRequestContainer}});var mt=pt(83872);Object.defineProperty(ut,"BaseFramework",{enumerable:true,get:function(){return mt.BaseFramework}});ft(pt(28695),ut);ft(pt(2222),ut);var ht=pt(24451);Object.defineProperty(ut,"createConfiguration",{enumerable:true,get:function(){return ht.createConfiguration}});Object.defineProperty(ut,"FunctionalConfiguration",{enumerable:true,get:function(){return ht.FunctionalConfiguration}});var yt=pt(78842);Object.defineProperty(ut,"MidwayConfigService",{enumerable:true,get:function(){return yt.MidwayConfigService}});var vt=pt(70275);Object.defineProperty(ut,"MidwayEnvironmentService",{enumerable:true,get:function(){return vt.MidwayEnvironmentService}});var St=pt(37482);Object.defineProperty(ut,"MidwayInformationService",{enumerable:true,get:function(){return St.MidwayInformationService}});var bt=pt(34888);Object.defineProperty(ut,"MidwayLoggerService",{enumerable:true,get:function(){return bt.MidwayLoggerService}});var xt=pt(33332);Object.defineProperty(ut,"MidwayFrameworkService",{enumerable:true,get:function(){return xt.MidwayFrameworkService}});var $t=pt(70812);Object.defineProperty(ut,"MidwayAspectService",{enumerable:true,get:function(){return $t.MidwayAspectService}});var Et=pt(13328);Object.defineProperty(ut,"MidwayLifeCycleService",{enumerable:true,get:function(){return Et.MidwayLifeCycleService}});var Ct=pt(68220);Object.defineProperty(ut,"MidwayMiddlewareService",{enumerable:true,get:function(){return Ct.MidwayMiddlewareService}});var Tt=pt(96367);Object.defineProperty(ut,"MidwayDecoratorService",{enumerable:true,get:function(){return Tt.MidwayDecoratorService}});var wt=pt(77306);Object.defineProperty(ut,"MidwayMockService",{enumerable:true,get:function(){return wt.MidwayMockService}});var At=pt(658);Object.defineProperty(ut,"MidwayHealthService",{enumerable:true,get:function(){return At.MidwayHealthService}});var kt=pt(19985);Object.defineProperty(ut,"MidwayWebRouterService",{enumerable:true,get:function(){return kt.MidwayWebRouterService}});var It=pt(42592);Object.defineProperty(ut,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return It.MidwayServerlessFunctionService}});Object.defineProperty(ut,"WebRouterCollector",{enumerable:true,get:function(){return It.WebRouterCollector}});var Nt=pt(12849);Object.defineProperty(ut,"DataSourceManager",{enumerable:true,get:function(){return Nt.DataSourceManager}});var Pt=pt(67934);Object.defineProperty(ut,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return Pt.DEFAULT_PRIORITY}});Object.defineProperty(ut,"MidwayPriorityManager",{enumerable:true,get:function(){return Pt.MidwayPriorityManager}});ft(pt(28602),ut);ft(pt(82535),ut);ft(pt(64842),ut);ft(pt(46673),ut);ft(pt(1845),ut);ft(pt(11026),ut);ft(pt(12738),ut);ft(pt(39408),ut);ft(pt(43436),ut);ft(pt(29222),ut);ft(pt(86314),ut);var Ot=pt(75351);Object.defineProperty(ut,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return Ot.ASYNC_ROOT_CONTEXT}});ft(pt(49757),ut);ft(pt(45317),ut);ft(pt(75105),ut);var Dt=pt(65308);Object.defineProperty(ut,"safelyGet",{enumerable:true,get:function(){return Dt.safelyGet}});Object.defineProperty(ut,"safeRequire",{enumerable:true,get:function(){return Dt.safeRequire}});Object.defineProperty(ut,"loadModule",{enumerable:true,get:function(){return Dt.loadModule}});Object.defineProperty(ut,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return Dt.delegateTargetPrototypeMethod}});Object.defineProperty(ut,"delegateTargetMethod",{enumerable:true,get:function(){return Dt.delegateTargetMethod}});Object.defineProperty(ut,"delegateTargetProperties",{enumerable:true,get:function(){return Dt.delegateTargetProperties}});Object.defineProperty(ut,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return Dt.delegateTargetAllPrototypeMethod}});Object.defineProperty(ut,"deprecatedOutput",{enumerable:true,get:function(){return Dt.deprecatedOutput}});Object.defineProperty(ut,"transformRequestObjectByType",{enumerable:true,get:function(){return Dt.transformRequestObjectByType}});Object.defineProperty(ut,"pathMatching",{enumerable:true,get:function(){return Dt.pathMatching}});Object.defineProperty(ut,"wrapMiddleware",{enumerable:true,get:function(){return Dt.wrapMiddleware}});Object.defineProperty(ut,"wrapAsync",{enumerable:true,get:function(){return Dt.wrapAsync}});Object.defineProperty(ut,"isTypeScriptEnvironment",{enumerable:true,get:function(){return Dt.isTypeScriptEnvironment}});Object.defineProperty(ut,"sleep",{enumerable:true,get:function(){return Dt.sleep}});Object.defineProperty(ut,"Utils",{enumerable:true,get:function(){return Dt.Utils}});var Ft=pt(83486);Object.defineProperty(ut,"extend",{enumerable:true,get:function(){return Ft.extend}});ft(pt(46422),ut);ft(pt(50539),ut);ft(pt(73861),ut);ft(pt(87653),ut);var Mt=pt(25198);Object.defineProperty(ut,"retryWithAsync",{enumerable:true,get:function(){return Mt.retryWithAsync}});Object.defineProperty(ut,"retryWith",{enumerable:true,get:function(){return Mt.retryWith}});var Rt=pt(63289);Object.defineProperty(ut,"Types",{enumerable:true,get:function(){return Rt.Types}});var Lt=pt(61327);Object.defineProperty(ut,"PathFileUtil",{enumerable:true,get:function(){return Lt.PathFileUtil}});var Bt=pt(7589);Object.defineProperty(ut,"FileUtils",{enumerable:true,get:function(){return Bt.FileUtils}});var Vt=pt(30001);Object.defineProperty(ut,"FORMAT",{enumerable:true,get:function(){return Vt.FORMAT}});var jt=pt(89995);Object.defineProperty(ut,"ServerResponse",{enumerable:true,get:function(){return jt.ServerResponse}});Object.defineProperty(ut,"HttpServerResponse",{enumerable:true,get:function(){return jt.HttpServerResponse}});var Ut=pt(11330);Object.defineProperty(ut,"TypedResourceManager",{enumerable:true,get:function(){return Ut.TypedResourceManager}});var Jt=pt(70032);Object.defineProperty(ut,"MidwayPerformanceManager",{enumerable:true,get:function(){return Jt.MidwayPerformanceManager}})},6192:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayProcessTypeEnum=ut.ObjectLifeCycleEvent=ut.ServerlessTriggerType=ut.MidwayFrameworkType=ut.FrameworkType=ut.MSListenerType=ut.MSProviderType=ut.InjectModeEnum=ut.ScopeEnum=void 0;var pt;(function(ct){ct["Singleton"]="Singleton";ct["Request"]="Request";ct["Prototype"]="Prototype"})(pt=ut.ScopeEnum||(ut.ScopeEnum={}));var dt;(function(ct){ct["Identifier"]="Identifier";ct["Class"]="Class";ct["PropertyName"]="PropertyName"})(dt=ut.InjectModeEnum||(ut.InjectModeEnum={}));var ft;(function(ct){ct["DUBBO"]="dubbo";ct["GRPC"]="gRPC"})(ft=ut.MSProviderType||(ut.MSProviderType={}));var _t;(function(ct){ct["RABBITMQ"]="rabbitmq";ct["MQTT"]="mqtt";ct["KAFKA"]="kafka";ct["REDIS"]="redis"})(_t=ut.MSListenerType||(ut.MSListenerType={}));class FrameworkType{}ut.FrameworkType=FrameworkType;class MidwayFrameworkType extends FrameworkType{constructor(ct){super();this.name=ct}}ut.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 mt;(function(ct){ct["EVENT"]="event";ct["HTTP"]="http";ct["API_GATEWAY"]="apigw";ct["OS"]="os";ct["CDN"]="cdn";ct["LOG"]="log";ct["TIMER"]="timer";ct["MQ"]="mq";ct["KAFKA"]="kafka";ct["HSF"]="hsf";ct["MTOP"]="mtop";ct["SSR"]="ssr"})(mt=ut.ServerlessTriggerType||(ut.ServerlessTriggerType={}));var ht;(function(ct){ct["BEFORE_BIND"]="beforeBind";ct["BEFORE_CREATED"]="beforeObjectCreated";ct["AFTER_CREATED"]="afterObjectCreated";ct["AFTER_INIT"]="afterObjectInit";ct["BEFORE_DESTROY"]="beforeObjectDestroy"})(ht=ut.ObjectLifeCycleEvent||(ut.ObjectLifeCycleEvent={}));var yt;(function(ct){ct["APPLICATION"]="APPLICATION";ct["AGENT"]="AGENT"})(yt=ut.MidwayProcessTypeEnum||(ut.MidwayProcessTypeEnum={}))},72838:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ServerResponse=void 0;class ServerResponse{constructor(ct){this.isSuccess=true;this.ctx=ct}json(ct){return Object.getPrototypeOf(this).constructor.JSON_TPL(ct,this.isSuccess,this.ctx)}text(ct){return Object.getPrototypeOf(this).constructor.TEXT_TPL(ct,this.isSuccess,this.ctx)}blob(ct){return Object.getPrototypeOf(this).constructor.BLOB_TPL(ct,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}ut.ServerResponse=ServerResponse;ServerResponse.TEXT_TPL=(ct,ut,pt)=>ct;ServerResponse.JSON_TPL=(ct,ut,pt)=>{if(ut){return{success:"true",data:ct}}else{return{success:"false",message:ct||"fail"}}};ServerResponse.BLOB_TPL=(ct,ut,pt)=>ct},91959:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.HttpServerResponse=void 0;const dt=pt(79896);const ft=pt(72838);const _t=pt(82738);const mt=pt(37407);const ht=pt(16928);class HttpServerResponse extends ft.ServerResponse{constructor(ct){super(ct)}status(ct){this.ctx.res.statusCode=ct;return this}header(ct,ut){this.ctx.res.setHeader(ct,ut);return this}headers(ct){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(ct)))}else{for(const ut in ct){this.header(ut,ct[ut])}}return this}json(ct){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(ct,this.isSuccess,this.ctx)}text(ct){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(ct,this.isSuccess,this.ctx)}file(ct,ut){this.header("Content-Type",ut||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,ht.basename)(ct)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof ct==="string"?(0,dt.createReadStream)(ct):ct,this.isSuccess,this.ctx)}blob(ct,ut){this.header("Content-Type",ut||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(ct,this.isSuccess,this.ctx)}html(ct){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(ct,this.isSuccess,this.ctx)}redirect(ct,ut=302){this.status(ut);if(this.ctx.redirect){return this.ctx.redirect(ct)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(ct)}else{this.header("Location",ct)}}sse(ct={}){return new _t.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...ct})}stream(ct={}){return new mt.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...ct})}}ut.HttpServerResponse=HttpServerResponse;HttpServerResponse.FILE_TPL=(ct,ut,pt)=>ct;HttpServerResponse.SSE_TPL=(ct,ut)=>ct;HttpServerResponse.STREAM_TPL=(ct,ut)=>ct;HttpServerResponse.HTML_TPL=(ct,ut,pt)=>ct},89995:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.HttpServerResponse=ut.ServerResponse=void 0;var dt=pt(72838);Object.defineProperty(ut,"ServerResponse",{enumerable:true,get:function(){return dt.ServerResponse}});var ft=pt(91959);Object.defineProperty(ut,"HttpServerResponse",{enumerable:true,get:function(){return ft.HttpServerResponse}})},82738:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ServerSendEventStream=void 0;const dt=pt(2203);class ServerSendEventStream extends dt.Transform{constructor(ct,ut={}){super({objectMode:true,...ut});this.isActive=false;this.ctx=ct;this.closeEvent=ut.closeEvent||"close";this.options=ut;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(ct,ut,pt){try{let ut,dt="data: ";const ft=/^\s*:\s*/;const _t=[];if(!this.isActive){this.isActive=true;const ct={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const ut in ct){this.ctx.res.setHeader(ut,ct[ut])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);_t.push(": ok")}const mt=ct;if(mt.event)_t.push("event: "+mt.event);if(mt.retry)_t.push("retry: "+mt.retry);if(mt.id)_t.push("id: "+mt.id);if(typeof mt.data==="object"){ut=JSON.stringify(mt.data);_t.push(dt+ut)}else if(typeof mt.data==="undefined"){_t.push(dt)}else{mt.data=String(mt.data);if(mt.data.search(ft)!==-1){mt.data=mt.data.replace(ft,"");dt=": "}mt.data=mt.data.replace(/(\r\n|\r|\n)/g,"\n");ut=mt.data.split(/\n/);for(let ct=0,pt=ut.length;ct<pt;++ct){const ft=ut[ct];if(ct+1===pt){_t.push(dt+ft)}else{_t.push(dt+ft)}}}this.push(_t.join("\n")+"\n\n");pt()}catch(ct){this.ctx.logger.error(ct);this.sendError(ct);this.end();pt(ct)}}sendError(ct){this.send({event:"error",data:ct.message||"An error occurred"})}sendEnd(ct){ct.event=this.closeEvent;this.send(ct)}send(ct){super.write(this.options.tpl(ct,this.ctx))}handleClose(){this.end()}}ut.ServerSendEventStream=ServerSendEventStream},37407:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.HttpStreamResponse=void 0;const dt=pt(2203);class HttpStreamResponse extends dt.Transform{constructor(ct,ut={}){super({objectMode:true,...ut});this.isActive=false;this.ctx=ct;this.options=ut}_transform(ct,ut,pt){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 ct==="string"){this.ctx.res.write(ct)}else{this.ctx.res.write(JSON.stringify(ct))}pt()}catch(ct){this.ctx.logger.error(ct);this.end();this.ctx.res.end();pt(ct)}}send(ct){if(!this.writable){return}this.write(this.options.tpl(ct,this.ctx))}sendError(ct){this.ctx.logger.error(ct);this.end();this.ctx.res.end()}_flush(ct){this.ctx.res.end();ct()}}ut.HttpStreamResponse=HttpStreamResponse},70812:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayAspectService=void 0;const _t=pt(65675);const mt=pt(6192);const ht=pt(49757);const yt=pt(63289);let vt=class MidwayAspectService{constructor(ct){this.applicationContext=ct}async loadAspect(){const ct=(0,ht.listModule)(ht.ASPECT_KEY);let ut=[];for(const pt of ct){const ct=(0,ht.getClassMetadata)(ht.ASPECT_KEY,pt);ut=ut.concat(ct.map((ct=>{ct.aspectModule=pt;return ct})))}ut.sort(((ct,ut)=>(ut.priority||0)-(ct.priority||0)));for(const ct of ut){const ut=await this.applicationContext.getAsync(ct.aspectModule);await this.addAspect(ut,ct)}}async addAspect(ct,ut){const pt=ut.aspectTarget;const dt=Object.getOwnPropertyNames(pt.prototype);const ft=ut.match?_t(ut.match):()=>true;for(const ut of dt){if(ut==="constructor"||!ft(ut)){continue}const dt=Object.getOwnPropertyDescriptor(pt.prototype,ut);if(!dt||dt.writable===false){continue}this.interceptPrototypeMethod(pt,ut,ct)}}interceptPrototypeMethod(ct,ut,pt){const dt=ct.prototype[ut];if(yt.Types.isAsyncFunction(ct.prototype[ut])){ct.prototype[ut]=async function(...ct){var ft,_t,mt;let ht,yt;const newProceed=(...ct)=>dt.apply(this,ct);const vt={methodName:ut,target:this,args:ct,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof pt==="function"){pt=pt()}try{await((ft=pt.before)===null||ft===void 0?void 0:ft.call(pt,vt));if(pt.around){yt=await pt.around(vt)}else{yt=await dt.call(this,...vt.args)}vt.proceed=undefined;const ct=await((_t=pt.afterReturn)===null||_t===void 0?void 0:_t.call(pt,vt,yt));yt=typeof ct==="undefined"?yt:ct;return yt}catch(ct){vt.proceed=undefined;ht=ct;if(pt.afterThrow){await pt.afterThrow(vt,ht)}else{throw ct}}finally{await((mt=pt.after)===null||mt===void 0?void 0:mt.call(pt,vt,yt,ht))}}}else{ct.prototype[ut]=function(...ct){var ft,_t,mt;let ht,yt;const newProceed=(...ct)=>dt.apply(this,ct);const vt={methodName:ut,target:this,args:ct,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof pt==="function"){pt=pt()}try{(ft=pt.before)===null||ft===void 0?void 0:ft.call(pt,vt);if(pt.around){yt=pt.around(vt)}else{yt=dt.call(this,...vt.args)}vt.proceed=undefined;const ct=(_t=pt.afterReturn)===null||_t===void 0?void 0:_t.call(pt,vt,yt);yt=typeof ct==="undefined"?yt:ct;return yt}catch(ct){vt.proceed=undefined;ht=ct;if(pt.afterThrow){pt.afterThrow(vt,ht)}else{throw ct}}finally{(mt=pt.after)===null||mt===void 0?void 0:mt.call(pt,vt,yt,ht)}}}}};vt=dt([(0,ht.Provide)(),(0,ht.Scope)(mt.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],vt);ut.MidwayAspectService=vt},78842:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayConfigService=void 0;const _t=pt(16928);const mt=pt(6192);const ht=pt(65308);const yt=pt(79896);const vt=pt(39023);const St=pt(70275);const bt=pt(37482);const xt=pt(83486);const $t=pt(86314);const Et=pt(49757);const Ct=pt(63289);const Tt=vt.debuglog("midway:debug");let wt=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(ct){for(const ut of ct){if(typeof ut==="string"){if(/\.\w+$/.test(ut)){const ct=this.getConfigEnv(ut);const pt=this.getEnvSet(ct);pt.add(ut);if(this.aliasMap[ct]){this.getEnvSet(this.aliasMap[ct]).add(ut)}}else{const ct=(0,yt.statSync)(ut);if(ct.isDirectory()){const ct=(0,yt.readdirSync)(ut);this.add(ct.map((ct=>(0,_t.join)(ut,ct))))}}}else{for(const ct in ut){this.getEnvSet(ct).add(ut[ct]);if(this.aliasMap[ct]){this.getEnvSet(this.aliasMap[ct]).add(ut[ct])}}}}}addObject(ct,ut=false){if(this.isReady){ct=this.runWithFilter(ct);if(!ct){Tt("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:ct});if(ut){this.configuration=(0,xt.extend)(true,ct,this.configuration)}else{(0,xt.extend)(true,this.configuration,ct)}}else{this.externalObject.push(ct)}}getEnvSet(ct){if(!this.envDirMap.has(ct)){this.envDirMap.set(ct,new Set)}return this.envDirMap.get(ct)}getConfigEnv(ct){const ut=(0,_t.basename)(ct);const pt=ut.split(".");const dt=pt.pop();if(dt!=="js"&&dt!=="ts"){return dt}return pt.pop()}load(){if(this.isReady)return;const ct=this.getEnvSet("default");const ut=this.getEnvSet(this.environmentService.getCurrentEnvironment());const pt={};const dt=ct.size;for(const[ft,_t]of[...ct,...ut].entries()){let ct=this.loadConfig(_t);if(Ct.Types.isFunction(ct)){ct=ct.apply(null,[this.appInfo,pt])}if(!ct){continue}ct=this.runWithFilter(ct);if(!ct){Tt("[config]: Filter config and got undefined will be drop it");continue}if(typeof _t==="string"){Tt("[config]: Loaded config %s, %j",_t,ct)}else{Tt("[config]: Loaded config %j",ct)}this.configMergeOrder.push({env:ft<dt?"default":this.environmentService.getCurrentEnvironment(),extraPath:_t,value:ct});(0,xt.extend)(true,pt,ct)}if(this.externalObject.length){for(let ct of this.externalObject){if(ct){ct=this.runWithFilter(ct);if(!ct){Tt("[config]: Filter config and got undefined will be drop it");continue}Tt("[config]: Loaded external object %j",ct);(0,xt.extend)(true,pt,ct);this.configMergeOrder.push({env:"default",extraPath:"",value:ct})}}}this.configuration=pt;this.isReady=true}getConfiguration(ct){if(ct){return(0,ht.safelyGet)(ct,this.configuration)}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(ct){let ut=typeof ct==="string"?require(ct):ct;if(ut&&ut.__esModule){if(ut&&ut.default){if(Object.keys(ut).length>1){throw new $t.MidwayInvalidConfigError(`${ct} should not have both a default export and named export`)}ut=ut.default}}return ut}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(ct){this.configFilterList.push(ct)}runWithFilter(ct){for(const ut of this.configFilterList){Tt(`[config]: Filter config by filter = "${ut.name||"anonymous filter"}"`);ct=ut(ct);Tt("[config]: Filter config result = %j",ct)}return ct}getAppInfo(){return this.appInfo}};dt([(0,Et.Inject)(),ft("design:type",St.MidwayEnvironmentService)],wt.prototype,"environmentService",void 0);dt([(0,Et.Inject)(),ft("design:type",bt.MidwayInformationService)],wt.prototype,"informationService",void 0);dt([(0,Et.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],wt.prototype,"init",null);wt=dt([(0,Et.Provide)(),(0,Et.Scope)(mt.ScopeEnum.Singleton)],wt);ut.MidwayConfigService=wt},96367:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayDecoratorService=void 0;const _t=pt(49757);const mt=pt(6192);const ht=pt(70812);const yt=pt(86314);const vt=pt(39023);const St=pt(63289);const bt=vt.debuglog("midway:debug");let xt=class MidwayDecoratorService{constructor(ct){this.applicationContext=ct;this.propertyHandlerMap=new Map;this.methodDecoratorMap=new Map;this.parameterDecoratorMap=new Map;this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind((ct=>{const ut=(0,_t.getClassMetadata)(_t.INJECT_CUSTOM_METHOD,ct);if(ut){for(const pt of ut){const{propertyName:ut,key:dt,metadata:ft,options:_t}=pt;if(!_t||!_t.impl){continue}this.aspectService.interceptPrototypeMethod(ct,ut,(()=>{const pt=this.methodDecoratorMap.get(dt);if(!pt){throw new yt.MidwayCommonError(`Method Decorator "${dt}" handler not found, please register first.`)}return pt({target:ct,propertyName:ut,metadata:ft})}))}}const pt=(0,_t.getClassMetadata)(_t.INJECT_CUSTOM_PARAM,ct);if(pt){for(const ut of Object.keys(pt)){this.aspectService.interceptPrototypeMethod(ct,ut,(()=>({before:async dt=>{const ft=[...dt.args];for(const mt of pt[ut]){const{propertyName:ut,key:pt,metadata:ht,parameterIndex:vt,options:xt}=mt;let $t;if(xt&&xt.impl){$t=this.parameterDecoratorMap.get(pt);if(!$t){throw new yt.MidwayCommonError(`Parameter Decorator "${pt}" handler not found, please register first.`)}}else{$t=async({parameterIndex:ct,originArgs:ut})=>ut[ct]}const Et=(0,_t.getMethodParamTypes)(ct,ut);let Ct=false;try{ft[vt]=await $t({metadata:ht,propertyName:ut,parameterIndex:vt,target:ct,originArgs:ft,originParamType:Et[vt],instance:dt.target})}catch(ct){Ct=true;if((xt===null||xt===void 0?void 0:xt.throwError)===true){throw ct}else{bt(`[core]: Parameter decorator throw error and use origin args, ${ct.stack}`)}}if(Ct){continue}const Tt=[...this.parameterDecoratorPipes.get(pt)||[],...(xt===null||xt===void 0?void 0:xt.pipes)||[]];for(const ct of Tt){let ut;if("transform"in ct){ut=ct["transform"].bind(ct)}else if((0,St.isClass)(ct)){const pt=await this.applicationContext.getAsync(ct);ut=pt.transform.bind(pt)}else if(typeof ct==="function"){ut=ct}else{throw new yt.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}ft[vt]=await ut(ft[vt],{metaType:(0,_t.transformTypeFromTSDesign)(Et[vt]),metadata:ht,target:dt.target,methodName:dt.methodName})}}dt.args=ft}})))}}}));this.applicationContext.onObjectCreated(((ct,ut)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(ut.definition.handlerProps)){for(const pt of ut.definition.handlerProps){this.defineGetterPropertyValue(pt,ct,this.getHandler(pt.key))}}}));this.registerPropertyHandler(_t.APPLICATION_CONTEXT_KEY,((ct,ut)=>this.applicationContext))}registerPropertyHandler(ct,ut){bt(`[core]: Register property decorator key="${ct}"`);this.propertyHandlerMap.set(ct,ut)}registerMethodHandler(ct,ut){bt(`[core]: Register method decorator key="${ct}"`);this.methodDecoratorMap.set(ct,ut)}registerParameterHandler(ct,ut){bt(`[core]: Register parameter decorator key="${ct}"`);this.parameterDecoratorMap.set(ct,ut)}registerParameterPipes(ct,ut){if(!this.parameterDecoratorPipes.has(ct)){this.parameterDecoratorPipes.set(ct,[])}this.parameterDecoratorPipes.set(ct,this.parameterDecoratorPipes.get(ct).concat(ut))}defineGetterPropertyValue(ct,ut,pt){if(ct&&pt){if(ct.propertyName){Object.defineProperty(ut,ct.propertyName,{get:()=>{var dt;return pt(ct.propertyName,(dt=ct.metadata)!==null&&dt!==void 0?dt:{},ut)},configurable:true,enumerable:true})}}}getHandler(ct){if(this.propertyHandlerMap.has(ct)){return this.propertyHandlerMap.get(ct)}}};dt([(0,_t.Inject)(),ft("design:type",ht.MidwayAspectService)],xt.prototype,"aspectService",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],xt.prototype,"init",null);xt=dt([(0,_t.Provide)(),(0,_t.Scope)(mt.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],xt);ut.MidwayDecoratorService=xt},70275:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayEnvironmentService=void 0;const ft=pt(6192);const _t=pt(65308);const mt=pt(49757);let ht=class MidwayEnvironmentService{constructor(){this.moduleLoadType="commonjs"}getCurrentEnvironment(){if(!this.environment){this.environment=(0,_t.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(ct){this.environment=ct}isDevelopmentEnvironment(){return(0,_t.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(ct){this.moduleLoadType=ct}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};ht=dt([(0,mt.Provide)(),(0,mt.Scope)(ft.ScopeEnum.Singleton)],ht);ut.MidwayEnvironmentService=ht},33332:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayFrameworkService=void 0;const _t=pt(49757);const mt=pt(6192);const ht=pt(78842);const yt=pt(34888);const vt=pt(83872);const St=pt(28602);const bt=pt(96367);const xt=pt(70812);const $t=pt(43436);const Et=pt(39023);const Ct=pt(86314);const Tt=pt(2222);const wt=pt(70032);const At=Et.debuglog("midway:debug");let kt=class MidwayFrameworkService{constructor(ct,ut){this.applicationContext=ct;this.globalOptions=ut;this.globalFrameworkList=[]}async init(){var ct,ut;this.decoratorService.registerPropertyHandler(_t.CONFIG_KEY,((ct,ut)=>{var pt;if(ut.identifier===_t.ALL){return this.configService.getConfiguration()}else{return this.configService.getConfiguration((pt=ut.identifier)!==null&&pt!==void 0?pt:ct)}}));this.decoratorService.registerPropertyHandler(_t.LOGGER_KEY,((ct,ut)=>{var pt;return this.loggerService.getLogger((pt=ut.identifier)!==null&&pt!==void 0?pt:ct)}));this.decoratorService.registerPropertyHandler(_t.PIPELINE_IDENTIFIER,((ct,ut,pt)=>{var dt,ft;return new St.MidwayPipelineService((ft=(dt=pt[Tt.REQUEST_OBJ_CTX_KEY])===null||dt===void 0?void 0:dt.requestContext)!==null&&ft!==void 0?ft:this.applicationContext,ut.valves)}));this.decoratorService.registerPropertyHandler(_t.APPLICATION_KEY,((ct,ut)=>{if(ut.type){const ct=this.applicationManager.getApplication(ut.type);if(!ct){throw new Ct.MidwayCommonError(`Framework ${ut.type} not Found`)}return ct}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(_t.PLUGIN_KEY,((ct,ut)=>{var pt;return this.getMainApp()[(pt=ut.identifier)!==null&&pt!==void 0?pt:ct]}));this.decoratorService.registerPropertyHandler(_t.FACTORY_SERVICE_CLIENT_KEY,((ct,ut)=>{const pt=this.applicationContext.get(ut.serviceFactoryClz);const dt=ut.clientName||pt.getDefaultClientName();if(dt&&pt.has(dt)){return pt.get(dt)}else{if(!dt){throw new Ct.MidwayParameterError(`Please set clientName or options.defaultClientName for ${ut.serviceFactoryClz.name}).`)}else{throw new Ct.MidwayParameterError(`ClientName(${dt} not found in ${ut.serviceFactoryClz.name}).`)}}}));let pt=(0,_t.listModule)(_t.FRAMEWORK_KEY);pt=filterProtoFramework(pt);At(`[core]: Found Framework length = ${pt.length}`);if(pt.length){for(const ut of pt){if(!this.applicationContext.hasDefinition((0,_t.getProviderUUId)(ut))){At(`[core]: Found Framework "${ut.name}" but missing definition, skip initialize.`);continue}const pt=await this.applicationContext.getAsync(ut,[this.applicationContext]);if(pt.isEnable()){wt.MidwayInitializerPerformanceManager.frameworkInitializeStart(pt.getFrameworkName());await pt.initialize({applicationContext:this.applicationContext,namespace:pt.getNamespace(),...this.globalOptions});wt.MidwayInitializerPerformanceManager.frameworkInitializeEnd(pt.getFrameworkName());At(`[core]: Found Framework "${pt.getFrameworkName()}" and initialize.`)}else{At(`[core]: Found Framework "${pt.getFrameworkName()}" and delay initialize.`)}const dt=this.applicationContext.registry.getDefinition((0,_t.getProviderUUId)(ut));pt.setNamespace(dt===null||dt===void 0?void 0:dt.namespace);this.applicationManager.addFramework((ct=dt===null||dt===void 0?void 0:dt.namespace)!==null&&ct!==void 0?ct:pt.getFrameworkName(),pt);this.globalFrameworkList.push(pt)}let dt;const ft=this.applicationContext.getNamespaceList();for(const ct of ft){const ut=this.applicationManager.getApplication(ct);if(ut){dt=ct;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=(ut=this.applicationManager.getFramework(dt))!==null&&ut!==void 0?ut:this.globalFrameworkList[0];At(`[core]: Current main Framework is "${dt}".`)}await this.aspectService.loadAspect()}getMainApp(){var ct;return(ct=this.mainFramework)===null||ct===void 0?void 0:ct.getApplication()}getMainFramework(){return this.mainFramework}getFramework(ct){return this.applicationManager.getFramework(ct)}async runFramework(){const ct=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((ut,pt)=>ct.indexOf(ut.getNamespace())-ct.indexOf(pt.getNamespace())));for(const ct of this.globalFrameworkList){if(ct.isEnable()){wt.MidwayInitializerPerformanceManager.frameworkRunStart(ct.getFrameworkName());await ct.run();At(`[core]: Found Framework "${ct.getFrameworkName()}" and run.`);wt.MidwayInitializerPerformanceManager.frameworkRunEnd(ct.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((ct=>ct.stop())))}};dt([(0,_t.Inject)(),ft("design:type",ht.MidwayConfigService)],kt.prototype,"configService",void 0);dt([(0,_t.Inject)(),ft("design:type",yt.MidwayLoggerService)],kt.prototype,"loggerService",void 0);dt([(0,_t.Inject)(),ft("design:type",xt.MidwayAspectService)],kt.prototype,"aspectService",void 0);dt([(0,_t.Inject)(),ft("design:type",bt.MidwayDecoratorService)],kt.prototype,"decoratorService",void 0);dt([(0,_t.Inject)(),ft("design:type",$t.MidwayApplicationManager)],kt.prototype,"applicationManager",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],kt.prototype,"init",null);kt=dt([(0,_t.Provide)(),(0,_t.Scope)(mt.ScopeEnum.Singleton),ft("design:paramtypes",[Object,Object])],kt);ut.MidwayFrameworkService=kt;function filterProtoFramework(ct){const ut=[];for(const pt of ct){let ct=Object.getPrototypeOf(pt);while(ct.name&&ct.name!==vt.BaseFramework.name){ut.push(ct);ct=Object.getPrototypeOf(ct)}}return ct.filter((ct=>!ut.includes(ct)))}},658:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayHealthService=void 0;const _t=pt(49757);const mt=pt(6192);const ht=pt(78842);const yt=pt(65308);let vt=class MidwayHealthService{constructor(){this.healthCheckTimeout=1e3;this.healthCheckMethods=[]}async init(ct){const ut=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(ut);for(const ut of ct){if(ut.instance&&ut.instance["onHealthCheck"]){this.healthCheckMethods.push({item:ut.instance["onHealthCheck"].bind(ut.instance),meta:{namespace:ut.namespace}})}}}async getStatus(){const ct=await(0,yt.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((ct=>({item:ct.item(this.applicationContext),meta:ct.meta}))),timeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(ct,ut)=>{if(ct["status"]!==undefined){return{namespace:ut.namespace,...ct}}else{return{status:false,namespace:ut.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(ct,ut)=>({status:false,namespace:ut.namespace,reason:ct.message})});const ut=ct.find((ct=>!ct.status));return{status:!ut,namespace:ut===null||ut===void 0?void 0:ut.namespace,reason:ut===null||ut===void 0?void 0:ut.reason,results:ct}}setCheckTimeout(ct){this.healthCheckTimeout=ct}};dt([(0,_t.Inject)(),ft("design:type",ht.MidwayConfigService)],vt.prototype,"configService",void 0);dt([(0,_t.ApplicationContext)(),ft("design:type",Object)],vt.prototype,"applicationContext",void 0);vt=dt([(0,_t.Provide)(),(0,_t.Scope)(mt.ScopeEnum.Singleton)],vt);ut.MidwayHealthService=vt},37482:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayInformationService=void 0;const _t=pt(6192);const mt=pt(65308);const ht=pt(16928);const yt=pt(49757);const vt=pt(79896);let St=class MidwayInformationService{init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,ht.dirname)(this.baseDir)}const ct=(0,ht.join)(this.appDir,"package.json");if((0,vt.existsSync)(ct)){const ut=(0,vt.readFileSync)(ct,{encoding:"utf-8"});this.pkg=JSON.parse(ut)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,mt.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var ct;return((ct=this.pkg)===null||ct===void 0?void 0:ct["name"])||""}getRoot(){const ct=(0,mt.isDevelopmentEnvironment)((0,mt.getCurrentEnvironment)());return ct?this.getAppDir():this.getHome()}};dt([(0,yt.Inject)(),ft("design:type",String)],St.prototype,"appDir",void 0);dt([(0,yt.Inject)(),ft("design:type",String)],St.prototype,"baseDir",void 0);dt([(0,yt.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],St.prototype,"init",null);St=dt([(0,yt.Provide)(),(0,yt.Scope)(_t.ScopeEnum.Singleton)],St);ut.MidwayInformationService=St},13328:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayLifeCycleService=void 0;const _t=pt(6192);const mt=pt(49757);const ht=pt(24451);const yt=pt(33332);const vt=pt(78842);const St=pt(39023);const bt=pt(77306);const xt=pt(658);const $t=pt(70032);const Et=(0,St.debuglog)("midway:debug");let Ct=class MidwayLifeCycleService{constructor(ct){this.applicationContext=ct;this.lifecycleInstanceList=[]}async init(){await this.mockService.initSimulation();const ct=(0,mt.listModule)(mt.CONFIGURATION_KEY);Et(`[core]: Found Configuration length = ${ct.length}`);for(const ut of ct){if(ut.target instanceof ht.FunctionalConfiguration){ut.instance=ut.target}else{Et(`[core]: Lifecycle run ${ut.namespace} init`);ut.instance=await this.applicationContext.getAsync(ut.target)}ut.instance&&this.lifecycleInstanceList.push(ut)}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",(ct=>{if(ct){this.configService.addObject(ct)}}));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 ct=(0,mt.listModule)(mt.CONFIGURATION_KEY)||[];for(const ut of ct.reverse()){let ct;if(ut.target instanceof ht.FunctionalConfiguration){ct=ut.target}else{ct=await this.applicationContext.getAsync(ut.target)}await this.runContainerLifeCycle(ct,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(ct,ut,pt){if(Array.isArray(ct)){for(const dt of ct){if(typeof dt.instance[ut]==="function"){Et(`[core]: Lifecycle run ${dt.instance.constructor.name} ${ut}`);$t.MidwayInitializerPerformanceManager.lifecycleStart(dt.namespace,ut);const ct=await dt.instance[ut](this.applicationContext,this.frameworkService.getMainApp());if(pt){pt(ct)}$t.MidwayInitializerPerformanceManager.lifecycleEnd(dt.namespace,ut)}}}else{if(typeof ct[ut]==="function"){const dt=ct.constructor.name;Et(`[core]: Lifecycle run ${dt} ${ut}`);$t.MidwayInitializerPerformanceManager.lifecycleStart(dt,ut);const ft=await ct[ut](this.applicationContext,this.frameworkService.getMainApp());if(pt){pt(ft)}$t.MidwayInitializerPerformanceManager.lifecycleEnd(dt,ut)}}}async runObjectLifeCycle(ct,ut){for(const pt of ct){if(typeof pt.instance[ut]==="function"){Et(`[core]: Lifecycle run ${pt.instance.constructor.name} ${ut}`);return await this.applicationContext[ut](pt.instance[ut].bind(pt.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};dt([(0,mt.Inject)(),ft("design:type",yt.MidwayFrameworkService)],Ct.prototype,"frameworkService",void 0);dt([(0,mt.Inject)(),ft("design:type",vt.MidwayConfigService)],Ct.prototype,"configService",void 0);dt([(0,mt.Inject)(),ft("design:type",bt.MidwayMockService)],Ct.prototype,"mockService",void 0);dt([(0,mt.Inject)(),ft("design:type",xt.MidwayHealthService)],Ct.prototype,"healthService",void 0);dt([(0,mt.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],Ct.prototype,"init",null);Ct=dt([(0,mt.Provide)(),(0,mt.Scope)(_t.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],Ct);ut.MidwayLifeCycleService=Ct},34888:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayLoggerService=void 0;const _t=pt(49757);const mt=pt(78842);const ht=pt(64842);const yt=pt(6192);const vt=pt(82535);const St=pt(86314);let bt=class MidwayLoggerService extends ht.ServiceFactory{constructor(ct,ut={}){super();this.applicationContext=ct;this.globalOptions=ut;this.lazyLoggerConfigMap=new Map;this.aliasLoggerMap=new Map}init(){var ct;const ut=this.configService.getConfiguration("loggerFactory");this.loggerFactory=ut||this.globalOptions["loggerFactory"]||new vt.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new St.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const pt=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(pt,true);this.initClients(this.configService.getConfiguration("midwayLogger"));(ct=this.applicationContext)===null||ct===void 0?void 0:ct.registerObject("logger",this.getLogger("appLogger"))}createClient(ct,ut){if(ct.aliasName){this.aliasLoggerMap.set(ct.aliasName,ut)}if(!ct.lazyLoad){this.loggerFactory.createLogger(ut,ct)}else{delete ct["lazyLoad"];this.lazyLoggerConfigMap.set(ut,ct)}}getName(){return"logger"}createLogger(ct,ut){delete ut["aliasName"];return this.loggerFactory.createLogger(ct,ut)}getLogger(ct){if(this.aliasLoggerMap.has(ct)){ct=this.aliasLoggerMap.get(ct)}const ut=this.loggerFactory.getLogger(ct);if(ut){return ut}if(this.lazyLoggerConfigMap.has(ct)){this.createClient(this.lazyLoggerConfigMap.get(ct),ct);this.lazyLoggerConfigMap.delete(ct)}return this.loggerFactory.getLogger(ct)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(ct,ut,pt){return this.loggerFactory.createContextLogger(ct,ut,pt)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};dt([(0,_t.Inject)(),ft("design:type",mt.MidwayConfigService)],bt.prototype,"configService",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],bt.prototype,"init",null);bt=dt([(0,_t.Provide)(),(0,_t.Scope)(yt.ScopeEnum.Singleton),ft("design:paramtypes",[Object,Object])],bt);ut.MidwayLoggerService=bt},68220:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayMiddlewareService=void 0;const _t=pt(49757);const mt=pt(6192);const ht=pt(86314);const yt=pt(65308);const vt=pt(63289);const St=pt(39023);const bt=(0,St.debuglog)("midway:debug");let xt=class MidwayMiddlewareService{constructor(ct){this.applicationContext=ct}async compose(ct,ut,pt){var dt;if(!Array.isArray(ct)){throw new ht.MidwayParameterError("Middleware stack must be an array")}const ft=[];for(let pt of ct){if(vt.Types.isClass(pt)||typeof pt==="string"||(pt===null||pt===void 0?void 0:pt["middleware"])){let ct=(dt=pt===null||pt===void 0?void 0:pt["middleware"])!==null&&dt!==void 0?dt:pt;const _t=pt===null||pt===void 0?void 0:pt["options"];let mt=pt===null||pt===void 0?void 0:pt["name"];if(typeof ct==="string"&&!this.applicationContext.hasDefinition(ct)){throw new ht.MidwayCommonError(`Middleware definition of "${ct}" not found in midway container`)}const vt=await this.applicationContext.getAsync(ct);if(vt){mt=mt!==null&&mt!==void 0?mt:vt.constructor.name;ct=await vt.resolve(ut,_t);if(!ct){continue}if(!vt.match&&!vt.ignore){if(!ct.name){ct._name=mt}ft.push(ct)}else{const ut=(0,yt.pathMatching)({match:vt.match,ignore:vt.ignore,thisResolver:vt});pt=(pt,dt,ft)=>{if(!ut(pt))return dt();return ct(pt,dt,ft)};pt._name=mt;ft.push(pt)}}else{throw new ht.MidwayCommonError("Middleware must have resolve method!")}}else{ft.push(pt)}}const composeFn=(ct,ut)=>{const dt=(0,yt.isIncludeProperty)(ct,"body");let _t=-1;return dispatch(0);function dispatch(mt){if(mt<=_t)return Promise.reject(new ht.MidwayCommonError("next() called multiple times"));_t=mt;let yt=ft[mt];if(mt===ft.length)yt=ut;if(!yt)return Promise.resolve();const vt=`${pt?`${pt}.`:""}${_t} ${yt._name||yt.name||"anonymous"}`;const St=Date.now();bt(`[middleware]: in ${vt} +0`);try{if(dt){return Promise.resolve(yt(ct,dispatch.bind(null,mt+1),{index:_t})).then((ut=>{if(ut!==undefined&&ut!==ct["body"]){ct["body"]=ut}else if(ct["body"]!==undefined){ut=ct["body"]}bt(`[middleware]: out ${vt} +${Date.now()-St} with body`);return ut}))}else{return Promise.resolve(yt(ct,dispatch.bind(null,mt+1),{index:_t})).then((ct=>{bt(`[middleware]: out ${vt} +${Date.now()-St}`);return ct}))}}catch(ct){bt(`[middleware]: out ${vt} +${Date.now()-St} with err ${ct.message}`);return Promise.reject(ct)}}};if(pt){composeFn._name=pt}return composeFn}};xt=dt([(0,_t.Provide)(),(0,_t.Scope)(mt.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],xt);ut.MidwayMiddlewareService=xt},77306:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};var _t;Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayMockService=void 0;const mt=pt(6192);const ht=pt(49757);const yt=pt(63289);let vt=_t=class MidwayMockService{constructor(ct){this.applicationContext=ct;this.mocks=new Map;this.contextMocks=new Map;this.cache=new Map;this.simulatorList=[]}async init(){if(_t.prepareMocks.length>0){for(const ct of _t.prepareMocks){this.mockProperty(ct.obj,ct.key,ct.value,ct.group)}_t.prepareMocks=[]}}static mockClassProperty(ct,ut,pt,dt="default"){this.mockProperty(ct.prototype,ut,pt,dt)}static mockProperty(ct,ut,pt,dt="default"){this.prepareMocks.push({obj:ct,key:ut,value:pt,group:dt})}mockClassProperty(ct,ut,pt,dt="default"){return this.mockProperty(ct.prototype,ut,pt,dt)}mockProperty(ct,ut,pt,dt="default"){const ft=ct.hasOwnProperty(ut);const _t={obj:ct,key:ut,descriptor:Object.getOwnPropertyDescriptor(ct,ut),hasOwnProperty:ft};if(!this.mocks.has(dt)){this.mocks.set(dt,[])}this.mocks.get(dt).push(_t);if(ft){delete ct[ut]}let mt=this.cache.get(dt);if(!mt){mt=new Map;this.cache.set(dt,mt)}let ht=mt.get(ct);if(!ht){ht=new Set;mt.set(ct,ht)}ht.add(ut);const yt=this.overridePropertyDescriptor(pt);Object.defineProperty(ct,ut,yt)}mockContext(ct,ut,pt,dt="default"){if(!this.contextMocks.has(dt)){this.contextMocks.set(dt,[])}this.contextMocks.get(dt).push({app:ct,key:ut,value:pt})}restore(ct="default"){this.restoreGroup(ct)}restoreAll(){const ct=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const ut of ct){this.restoreGroup(ut)}this.simulatorList=[]}restoreGroup(ct){const ut=this.mocks.get(ct)||[];for(let ct=ut.length-1;ct>=0;ct--){const pt=ut[ct];if(!pt.hasOwnProperty){delete pt.obj[pt.key]}else{Object.defineProperty(pt.obj,pt.key,pt.descriptor)}}this.mocks.delete(ct);this.contextMocks.delete(ct);this.cache.delete(ct);this.simulatorList=this.simulatorList.filter((ut=>ut["group"]!==ct))}isMocked(ct,ut,pt="default"){if((0,yt.isClass)(ct)){ct=ct.prototype}const dt=this.cache.get(pt);const ft=dt?dt.get(ct):undefined;return ft?ft.has(ut):false}applyContextMocks(ct,ut){for(const[,pt]of this.contextMocks){for(const dt of pt){if(dt.app===ct){const ct=this.overridePropertyDescriptor(dt.value);if(typeof dt.key==="string"){Object.defineProperty(ut,dt.key,ct)}else{dt.key(ut)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((ct,ut)=>ct+ut.length),0)}overridePropertyDescriptor(ct){const ut={configurable:true,enumerable:true};if(ct&&(ct.get||ct.set)){ut.get=ct.get;ut.set=ct.set}else{ut.value=ct;ut.writable=true}return ut}async initSimulation(ct="default"){const ut=(0,ht.listModule)(ht.MOCK_KEY);for(const pt of ut){const ut=await this.applicationContext.getAsync(pt);if(await ut.enableCondition()){ut["group"]=ct;this.simulatorList.push(ut)}}}async runSimulatorSetup(){var ct;for(const ut of this.simulatorList){await((ct=ut.setup)===null||ct===void 0?void 0:ct.call(ut))}}async runSimulatorTearDown(){var ct;for(let ut=this.simulatorList.length-1;ut>=0;ut--){const pt=this.simulatorList[ut];await((ct=pt.tearDown)===null||ct===void 0?void 0:ct.call(pt))}}async runSimulatorAppSetup(ct){var ut;for(const pt of this.simulatorList){await((ut=pt.appSetup)===null||ut===void 0?void 0:ut.call(pt,ct))}}async runSimulatorAppTearDown(ct){var ut;for(let pt=this.simulatorList.length-1;pt>=0;pt--){const dt=this.simulatorList[pt];await((ut=dt.appTearDown)===null||ut===void 0?void 0:ut.call(dt,ct))}}async runSimulatorContextSetup(ct,ut){var pt;for(const dt of this.simulatorList){await((pt=dt.contextSetup)===null||pt===void 0?void 0:pt.call(dt,ct,ut))}}async runSimulatorContextTearDown(ct,ut){var pt;for(let dt=this.simulatorList.length-1;dt>=0;dt--){const ft=this.simulatorList[dt];await((pt=ft===null||ft===void 0?void 0:ft.contextTearDown)===null||pt===void 0?void 0:pt.call(ft,ct,ut))}}};vt.prepareMocks=[];dt([(0,ht.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],vt.prototype,"init",null);dt([(0,ht.Destroy)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],vt.prototype,"restoreAll",null);vt=_t=dt([(0,ht.Provide)(),(0,ht.Scope)(mt.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],vt);ut.MidwayMockService=vt},28602:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayPipelineService=ut.PipelineContext=void 0;const dt=pt(49757);class PipelineContext{constructor(ct){this.info={current:null,currentName:null};this.data=new Map;this.args=ct}get(ct){return this.data.get(ct)}set(ct,ut){this.data.set(ct,ut)}keys(){const ct=[];const ut=this.data.keys();for(const pt of ut){ct.push(pt)}return ct}}ut.PipelineContext=PipelineContext;class MidwayPipelineService{constructor(ct,ut){this.applicationContext=ct;this.valves=ut}async parallel(ct){const ut=this.prepareParallelValves(ct);const pt=await Promise.all(ut);return this.packResult(pt,false)}async concat(ct){const ut=this.prepareParallelValves(ct);const pt=await Promise.all(ut);return this.packResult(pt,true)}async series(ct){const ut=this.mergeValves(ct.valves);const pt=new PipelineContext(ct.args);const dt={success:true,result:null};const ft={};const _t={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let mt=1;for(const ct of ut){_t.prev=_t.current;_t.prevName=getName(_t.prev);_t.current=ct;_t.currentName=getName(_t.current);if(mt<ut.length){_t.next=ut[mt];_t.nextName=getName(_t.next)}else{_t.next=undefined;_t.nextName=undefined}mt+=1;pt.info=_t;try{const ut=await this.applicationContext.getAsync(ct);const dt=await ut.invoke(pt);let mt=ct;if(ut.alias){mt=ut.alias}ft[mt]=dt;_t.prevValue=dt}catch(ut){dt.success=false;dt.error={valveName:typeof ct==="string"?ct:ct.name,message:ut.message,error:ut};return dt}}dt.result=ft;return dt}async concatSeries(ct){const ut=this.mergeValves(ct.valves);const pt=new PipelineContext(ct.args);const dt={success:true,result:null};const ft=[];const _t={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let mt=1;for(const ct of ut){_t.prev=_t.current;_t.prevName=getName(_t.prev);_t.current=ct;_t.currentName=getName(_t.current);if(mt<ut.length){_t.next=ut[mt];_t.nextName=getName(_t.next)}else{_t.next=undefined;_t.nextName=undefined}mt+=1;pt.info=_t;try{const ut=await this.applicationContext.getAsync(ct);const dt=await ut.invoke(pt);ft.push(dt);_t.prevValue=dt}catch(ut){dt.success=false;dt.error={valveName:typeof ct==="string"?ct:ct.name,message:ut.message,error:ut};return dt}}dt.result=ft;return dt}async waterfall(ct){const ut=await this.concatSeries(ct);if(ut.success){const ct=ut.result;ut.result=ct[ct.length-1]}return ut}mergeValves(ct){let ut=[];if(this.valves&&this.valves.length>0){ut=this.valves}let pt=[];if(ct){for(const dt of ct){if(ut.includes(dt)){pt.push(dt)}}}else{pt=ut}return pt}prepareParallelValves(ct){const ut=this.mergeValves(ct.valves);const pt=new PipelineContext(ct.args);return ut.map((async ct=>{const ut={valveName:ct,dataKey:ct,data:null};try{const dt=await this.applicationContext.getAsync(ct);if(dt.alias){ut.dataKey=dt.alias}ut.data=await dt.invoke(pt)}catch(ct){ut.error=ct}return ut}))}packResult(ct,ut=false){const pt={success:true,result:null};let dt;if(ut){dt=[]}else{dt={}}for(const ft of ct){if(ft.error){pt.success=false;pt.error={valveName:typeof ft.valveName==="string"?ft.valveName:ft.valveName.name,message:ft.error.message,error:ft.error};return pt}else{if(ut){dt.push(ft.data)}else{dt[ft.dataKey]=ft.data}}}pt.result=dt;return pt}}ut.MidwayPipelineService=MidwayPipelineService;function getName(ct){if(ct){if(typeof ct==="string"){return ct}else{return(0,dt.getProviderName)(ct)}}return null}},42592:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.WebRouterCollector=ut.MidwayServerlessFunctionService=void 0;const _t=pt(49757);const mt=pt(19985);const ht=pt(9288);const yt=pt(1845);const vt=pt(50539);const St=pt(6192);let bt=class MidwayServerlessFunctionService extends mt.MidwayWebRouterService{constructor(ct={}){super(Object.assign({},ct,{includeFunctionRouter:true}));this.options=ct}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const ct of this.routes.values()){for(const ut of ct){if(ut.requestMethod==="all"){ut.functionTriggerMetadata=ut.functionTriggerMetadata||{};ut.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const ct=(0,_t.listModule)(_t.FUNC_KEY);for(const ut of ct){this.collectFunctionRoute(ut)}}collectFunctionRoute(ct){var ut,pt,dt,ft,mt,ht,yt,vt,St,bt,xt,$t,Et,Ct,Tt,wt,At;const kt=(0,_t.getClassMetadata)(_t.FUNC_KEY,ct);const It=(0,_t.getProviderName)(ct);const Nt=(0,_t.getProviderUUId)(ct);const Pt="/";if(!this.routes.has(Pt)){this.routes.set(Pt,[]);this.routesPriority.push({prefix:Pt,priority:-999,middleware:[],routerOptions:{},controllerId:It,routerModule:ct})}for(const Ot of kt){if((ut=Ot["metadata"])===null||ut===void 0?void 0:ut["path"]){const ut=(0,_t.getPropertyDataFromClass)(_t.WEB_ROUTER_PARAM_KEY,ct,Ot["methodName"])||[];const xt=(0,_t.getPropertyMetadata)(_t.WEB_RESPONSE_KEY,ct,Ot["methodName"])||[];const $t={id:Nt,prefix:Pt,routerName:"",url:Ot["metadata"]["path"],requestMethod:(dt=(pt=Ot["metadata"])===null||pt===void 0?void 0:pt["method"])!==null&&dt!==void 0?dt:"get",method:Ot["methodName"],description:"",summary:"",handlerName:`${It}.${Ot["methodName"]}`,funcHandlerName:`${It}.${Ot["methodName"]}`,controllerId:It,middleware:((ft=Ot["metadata"])===null||ft===void 0?void 0:ft["middleware"])||[],controllerMiddleware:[],requestMetadata:ut,responseMetadata:xt};const Et=(0,_t.getPropertyMetadata)(_t.SERVERLESS_FUNC_KEY,ct,Ot["methodName"])||{};const Ct=(yt=(mt=Et["functionName"])!==null&&mt!==void 0?mt:(ht=Ot===null||Ot===void 0?void 0:Ot["metadata"])===null||ht===void 0?void 0:ht["functionName"])!==null&&yt!==void 0?yt:createFunctionName(ct,Ot["methodName"]);const Tt=(bt=(vt=Et["handlerName"])!==null&&vt!==void 0?vt:(St=Ot===null||Ot===void 0?void 0:Ot["metadata"])===null||St===void 0?void 0:St["handlerName"])!==null&&bt!==void 0?bt:$t.funcHandlerName;$t.functionName=Ct;$t.funcHandlerName=Tt;$t.functionTriggerName=Ot["type"];$t.functionTriggerMetadata=Ot["metadata"];$t.functionMetadata={functionName:Ct,...Et};this.checkDuplicateAndPush(Pt,$t)}else{const ut=(0,_t.getPropertyMetadata)(_t.SERVERLESS_FUNC_KEY,ct,Ot["methodName"])||{};const pt=(Et=(xt=ut["functionName"])!==null&&xt!==void 0?xt:($t=Ot===null||Ot===void 0?void 0:Ot["metadata"])===null||$t===void 0?void 0:$t["functionName"])!==null&&Et!==void 0?Et:createFunctionName(ct,Ot["methodName"]);const dt=(wt=(Ct=ut["handlerName"])!==null&&Ct!==void 0?Ct:(Tt=Ot===null||Ot===void 0?void 0:Ot["metadata"])===null||Tt===void 0?void 0:Tt["handlerName"])!==null&&wt!==void 0?wt:`${It}.${Ot["methodName"]}`;this.checkDuplicateAndPush(Pt,{id:Nt,prefix:Pt,routerName:"",url:"",requestMethod:"",method:Ot["methodName"],description:"",summary:"",handlerName:`${It}.${Ot["methodName"]}`,funcHandlerName:dt,controllerId:It,middleware:((At=Ot["metadata"])===null||At===void 0?void 0:At["middleware"])||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:pt,functionTriggerName:Ot["type"],functionTriggerMetadata:Ot["metadata"],functionMetadata:{functionName:pt,...ut}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(ct,ut,pt={}){var dt,ft;const _t="";if(!this.routes.has(_t)){this.routes.set(_t,[]);this.routesPriority.push({prefix:_t,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const mt=(dt=ut.functionName)!==null&&dt!==void 0?dt:pt.functionName;this.checkDuplicateAndPush(_t,{id:null,method:ct,url:ut.metadata["path"]||"",requestMethod:ut.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:ut.handlerName||pt.handlerName,controllerId:"",middleware:((ft=ut.metadata)===null||ft===void 0?void 0:ft.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:mt,functionTriggerName:ut.metadata.name,functionTriggerMetadata:ut.metadata,functionMetadata:{functionName:mt,...pt}})}};bt=dt([(0,_t.Provide)(),(0,_t.Scope)(St.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],bt);ut.MidwayServerlessFunctionService=bt;function createFunctionName(ct,ut){return(0,_t.getProviderName)(ct).replace(/[:#]/g,"-")+"-"+ut}class WebRouterCollector{constructor(ct="",ut={}){this.baseDir=ct;this.options=ut}async init(){if(!this.proxy){if(this.baseDir){const ct=new ht.MidwayContainer;(0,_t.bindContainer)(ct);ct.setFileDetector(new yt.CommonJSFileDetector({loadDir:this.baseDir}));await ct.ready()}if(this.options.includeFunctionRouter){if((0,vt.getCurrentMainFramework)()){this.proxy=await(0,vt.getCurrentMainFramework)().getApplicationContext().getAsync(bt,[this.options])}else{this.proxy=new bt(this.options)}}else{if((0,vt.getCurrentMainFramework)()){this.proxy=await(0,vt.getCurrentMainFramework)().getApplicationContext().getAsync(mt.MidwayWebRouterService,[this.options])}else{this.proxy=new mt.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()}}ut.WebRouterCollector=WebRouterCollector},19985:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayWebRouterService=void 0;const _t=pt(49757);const mt=pt(65308);const ht=pt(86314);const yt=pt(39023);const vt=pt(73861);const St=pt(63289);const bt=pt(6192);const xt=yt.debuglog("midway:debug");let $t=class MidwayWebRouterService{constructor(ct={}){this.options=ct;this.isReady=false;this.routes=new Map;this.routesPriority=[]}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const ct=(0,_t.listModule)(_t.CONTROLLER_KEY);for(const ut of ct){const ct=(0,_t.getClassMetadata)(_t.CONTROLLER_KEY,ut);this.addController(ut,ct,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((ct=>{const ut=this.routes.get(ct.prefix);if(ut.length>0){return true}else{this.routes.delete(ct.prefix);return false}}));for(const ct of this.routes.keys()){const ut=this.routes.get(ct);this.routes.set(ct,this.sortRouter(ut))}this.routesPriority=this.routesPriority.sort(((ct,ut)=>ut.prefix.length-ct.prefix.length))}addController(ct,ut,pt={},dt=false){var ft;if(pt&&typeof pt==="boolean"){dt=pt;pt=undefined}if(!pt){pt={}}const yt=(0,_t.getProviderName)(ct);xt(`[core]: Found Controller ${yt}.`);const vt=(0,_t.getProviderUUId)(ct);ut.routerOptions=ut.routerOptions||{};let St;const $t=ut.routerOptions.middleware;const Et=!!((ft=ut.routerOptions)===null||ft===void 0?void 0:ft.ignoreGlobalPrefix);let Ct=(0,mt.joinURLPath)(this.options.globalPrefix,ut.prefix||"/");const Tt=ut.prefix||"/";if(Et){Ct=Tt}if(/\*/.test(Ct)){throw new ht.MidwayCommonError(`Router prefix ${Ct} can't set string with *`)}if(!this.routes.has(Ct)){this.routes.set(Ct,[]);this.routesPriority.push({prefix:Ct,priority:Ct==="/"&&St===undefined?-999:0,middleware:$t,routerOptions:ut.routerOptions,controllerId:yt,routerModule:ct})}else{if($t&&$t.length>0){const ct=this.routesPriority.filter((ct=>ct.prefix===Ct))[0];throw new ht.MidwayDuplicateControllerOptionsError(Ct,yt,ct.controllerId)}}if(!this.routes.has(Tt)){this.routes.set(Tt,[]);this.routesPriority.push({prefix:Tt,priority:Tt==="/"&&St===undefined?-999:0,middleware:$t,routerOptions:ut.routerOptions,controllerId:yt,routerModule:ct})}const wt=(0,_t.getClassMetadata)(_t.WEB_ROUTER_KEY,ct);if(wt&&typeof wt[Symbol.iterator]==="function"){for(const ut of wt){const ft=(0,_t.getPropertyDataFromClass)(_t.WEB_ROUTER_PARAM_KEY,ct,ut.method)||[];const ht=(0,_t.getPropertyMetadata)(_t.WEB_RESPONSE_KEY,ct,ut.method)||[];const St={id:vt,prefix:ut.ignoreGlobalPrefix?Tt:Ct,routerName:ut.routerName||"",url:ut.path,requestMethod:ut.requestMethod,method:ut.method,description:ut.description||"",summary:ut.summary||"",handlerName:`${yt}.${ut.method}`,funcHandlerName:`${yt}.${ut.method}`,controllerId:yt,controllerClz:ct,middleware:ut.middleware||[],controllerMiddleware:$t||[],requestMetadata:ft,responseMetadata:ht};if(dt){St.functionName=yt+"-"+ut.method;St.functionTriggerName=bt.ServerlessTriggerType.HTTP;St.functionTriggerMetadata={path:(0,mt.joinURLPath)(Ct,ut.path.toString()),method:ut.requestMethod};St.functionMetadata={functionName:St.functionName}}if(pt.resourceFilter&&!pt.resourceFilter(St)){continue}this.checkDuplicateAndPush(St.prefix,St)}}}addRouter(ct,ut){const pt=ut.prefix||"";ut.requestMethod=(ut.requestMethod||"GET").toUpperCase();if(!this.routes.has(pt)){this.routes.set(pt,[]);this.routesPriority.push({prefix:pt,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(pt,Object.assign(ut,{method:ct}));this.sortPrefixAndRouter()}sortRouter(ct){return ct.map((ct=>{const ut=ct.url.toString();const pt=St.Types.isRegExp(ct.url)?ut.split("\\/"):ut.split("/");let dt=0;for(const ct of pt){if(ct===""||ct.includes(":")||ct.includes("*")){dt+=0}else{dt+=1}}let ft=2;const _t=ut.includes(":")?ut.replace(/:.+$/,""):"";if(_t){ft=1}if(ut.includes("*")){ft=0}return{...ct,_pureRouter:ut.replace(/\**$/,"").replace(/:\w+/,"123"),_level:ut.split("/").length-1,_paramString:_t,_category:ft,_weight:dt}})).sort(((ct,ut)=>{if(ct._category!==ut._category){return ut._category-ct._category}if(ct._weight!==ut._weight){return ut._weight-ct._weight}if(ct._level===ut._level){if(ut._pureRouter===ct._pureRouter){return ct.url.toString().length-ut.url.toString().length}return ut._pureRouter.length-ct._pureRouter.length}return ut._level-ct._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(ct={}){if(!this.isReady){await this.analyze();this.isReady=true}let ut=[];for(const ct of this.routesPriority){ut=ut.concat(this.routes.get(ct.prefix))}if(ct.compileUrlPattern){for(const ct of ut){if(ct.fullUrlFlattenString){ct.fullUrlCompiledRegexp=vt.PathToRegexpUtil.toRegexp(ct.fullUrlFlattenString)}}}return ut}async getMatchedRouterInfo(ct,ut){const pt=await this.getFlattenRouterTable({compileUrlPattern:true});let dt;for(const ft of pt){if(ft.fullUrlCompiledRegexp){const pt=ft["requestMethod"].toUpperCase();if(("ALL"===pt||ut.toUpperCase()===pt)&&ft.fullUrlCompiledRegexp.test(ct)){dt=ft;break}}}return dt}checkDuplicateAndPush(ct,ut){const pt=this.routes.get(ct);const dt=pt.filter((ct=>ut.url&&ut.requestMethod&&ct.url===ut.url&&ct.requestMethod===ut.requestMethod));if(dt&&dt.length){throw new ht.MidwayDuplicateRouteError(`${ut.requestMethod} ${ut.url}`,`${dt[0].handlerName}`,`${ut.handlerName}`)}if(!ut.fullUrlFlattenString&&ut.url&&typeof ut.url==="string"){ut.fullUrl=(0,mt.joinURLPath)(ct,ut.url);if(/\*$/.test(ut.fullUrl)){ut.fullUrlFlattenString=ut.fullUrl.replace("*","(.*)")}else{ut.fullUrlFlattenString=ut.fullUrl}}pt.push(ut)}};$t=dt([(0,_t.Provide)(),(0,_t.Scope)(bt.ScopeEnum.Singleton),ft("design:paramtypes",[Object])],$t);ut.MidwayWebRouterService=$t},29222:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.prepareGlobalApplicationContext=ut.prepareGlobalApplicationContextAsync=ut.destroyGlobalApplicationContext=ut.initializeGlobalApplicationContext=void 0;const dt=pt(46123);const ft=pt(42193);const _t=pt(49757);const mt=pt(39023);const ht=pt(42592);const yt=pt(16928);const vt=pt(658);const St=pt(70032);const bt=mt.debuglog("midway:debug");let xt=1;function printStepDebugInfo(ct){bt(`\n\nStep ${xt++}: ${ct}\n`)}async function initializeGlobalApplicationContext(ct){St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const ut=await prepareGlobalApplicationContextAsync(ct);printStepDebugInfo("Init logger");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const pt=await ut.getAsync(dt.MidwayLoggerService,[ut,ct]);if(pt.getLogger("appLogger")){ut.registerObject("logger",pt.getLogger("appLogger"))}St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await ut.getAsync(dt.MidwayMockService,[ut]);printStepDebugInfo("Init framework");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await ut.getAsync(dt.MidwayFrameworkService,[ut,ct]);St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await ut.getAsync(dt.MidwayLifeCycleService,[ut]);St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init preload modules");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const ft=(0,_t.listPreloadModule)();for(const ct of ft){await ut.getAsync(ct)}St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return ut}ut.initializeGlobalApplicationContext=initializeGlobalApplicationContext;async function destroyGlobalApplicationContext(ct){const ut=await ct.getAsync(dt.MidwayLoggerService);const pt=ut.getCurrentLoggerFactory();const ft=await ct.getAsync(dt.MidwayLifeCycleService);await ft.stop();await ct.stop();(0,_t.clearBindContainer)();pt.close();St.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined}ut.destroyGlobalApplicationContext=destroyGlobalApplicationContext;async function prepareGlobalApplicationContextAsync(ct){var ut,pt,xt,$t,Et;printStepDebugInfo("Ready to create applicationContext");bt('[core]: start "initializeGlobalApplicationContext"');bt(`[core]: bootstrap options = ${mt.inspect(ct)}`);const Ct=(ut=ct.appDir)!==null&&ut!==void 0?ut:"";const Tt=(pt=ct.baseDir)!==null&&pt!==void 0?pt:"";St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const wt=(xt=ct.applicationContext)!==null&&xt!==void 0?xt:new dt.MidwayContainer;bt("[core]: delegate module map from decoratorManager");(0,_t.bindContainer)(wt);global["MIDWAY_APPLICATION_CONTEXT"]=wt;wt.registerObject("baseDir",Tt);wt.registerObject("appDir",Ct);St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);bt("[core]: set default file detector");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!ct.moduleLoadType){ct.moduleLoadType="commonjs"}if(ct.moduleDetector!==false){bt("[core]: set module load type = %s",ct.moduleLoadType);if(!ct.imports){ct.imports=[await(0,dt.loadModule)((0,yt.join)(Tt,`configuration${(0,dt.isTypeScriptEnvironment)()?".ts":".js"}`),{loadMode:ct.moduleLoadType,safeLoad:true})]}if(ct.moduleDetector===undefined){if(ct.moduleLoadType==="esm"){wt.setFileDetector(new dt.ESModuleFileDetector({loadDir:Tt,ignore:($t=ct.ignore)!==null&&$t!==void 0?$t:[]}));ct.moduleLoadType="esm"}else{wt.setFileDetector(new dt.CommonJSFileDetector({loadDir:Tt,ignore:(Et=ct.ignore)!==null&&Et!==void 0?Et:[]}))}}}St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");wt.bindClass(dt.MidwayEnvironmentService);wt.bindClass(dt.MidwayInformationService);wt.bindClass(dt.MidwayAspectService);wt.bindClass(dt.MidwayDecoratorService);wt.bindClass(dt.MidwayConfigService);wt.bindClass(dt.MidwayLoggerService);wt.bindClass(dt.MidwayApplicationManager);wt.bindClass(dt.MidwayFrameworkService);wt.bindClass(dt.MidwayMiddlewareService);wt.bindClass(dt.MidwayLifeCycleService);wt.bindClass(dt.MidwayMockService);wt.bindClass(dt.MidwayWebRouterService);wt.bindClass(ht.MidwayServerlessFunctionService);wt.bindClass(vt.MidwayHealthService);wt.bindClass(dt.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(ct.preloadModules&&ct.preloadModules.length){for(const ut of ct.preloadModules){wt.bindClass(ut)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const At=wt.get(dt.MidwayEnvironmentService);At.setModuleLoadType(ct.moduleLoadType);const kt=wt.get(dt.MidwayConfigService);kt.add([{default:ft.default}]);wt.get(dt.MidwayAspectService,[wt]);wt.get(dt.MidwayDecoratorService,[wt]);printStepDebugInfo("Load imports(component) and user code configuration module");wt.load([].concat(ct.imports).concat(ct.configurationModule));printStepDebugInfo("Run applicationContext ready method");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);await wt.ready();St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(ct.globalConfig){if(Array.isArray(ct.globalConfig)){kt.add(ct.globalConfig)}else{kt.addObject(ct.globalConfig)}}printStepDebugInfo("Load config file");kt.load();bt("[core]: Current config = %j",kt.getConfiguration());St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);wt.get(dt.MidwayMiddlewareService,[wt]);return wt}ut.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;function prepareGlobalApplicationContext(ct){var ut,pt,xt,$t;printStepDebugInfo("Ready to create applicationContext");bt('[core]: start "initializeGlobalApplicationContext"');bt(`[core]: bootstrap options = ${mt.inspect(ct)}`);const Et=(ut=ct.appDir)!==null&&ut!==void 0?ut:"";const Ct=(pt=ct.baseDir)!==null&&pt!==void 0?pt:"";St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Tt=(xt=ct.applicationContext)!==null&&xt!==void 0?xt:new dt.MidwayContainer;bt("[core]: delegate module map from decoratorManager");(0,_t.bindContainer)(Tt);global["MIDWAY_APPLICATION_CONTEXT"]=Tt;Tt.registerObject("baseDir",Ct);Tt.registerObject("appDir",Et);St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);printStepDebugInfo("Ready module detector");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);if(!ct.moduleLoadType){ct.moduleLoadType="commonjs"}if(ct.moduleDetector!==false){if(ct.moduleDetector===undefined){Tt.setFileDetector(new dt.CommonJSFileDetector({ignore:($t=ct.ignore)!==null&&$t!==void 0?$t:[]}))}else if(ct.moduleDetector){Tt.setFileDetector(ct.moduleDetector)}}St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");Tt.bindClass(dt.MidwayEnvironmentService);Tt.bindClass(dt.MidwayInformationService);Tt.bindClass(dt.MidwayAspectService);Tt.bindClass(dt.MidwayDecoratorService);Tt.bindClass(dt.MidwayConfigService);Tt.bindClass(dt.MidwayLoggerService);Tt.bindClass(dt.MidwayApplicationManager);Tt.bindClass(dt.MidwayFrameworkService);Tt.bindClass(dt.MidwayMiddlewareService);Tt.bindClass(dt.MidwayLifeCycleService);Tt.bindClass(dt.MidwayMockService);Tt.bindClass(dt.MidwayWebRouterService);Tt.bindClass(ht.MidwayServerlessFunctionService);Tt.bindClass(vt.MidwayHealthService);Tt.bindClass(dt.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(ct.preloadModules&&ct.preloadModules.length){for(const ut of ct.preloadModules){Tt.bindClass(ut)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const wt=Tt.get(dt.MidwayEnvironmentService);wt.setModuleLoadType(ct.moduleLoadType);const At=Tt.get(dt.MidwayConfigService);At.add([{default:ft.default}]);Tt.get(dt.MidwayAspectService,[Tt]);Tt.get(dt.MidwayDecoratorService,[Tt]);printStepDebugInfo("Load imports(component) and user code configuration module");if(!ct.imports){ct.imports=[(0,dt.safeRequire)((0,yt.join)(ct.baseDir,"configuration"))]}Tt.load([].concat(ct.imports).concat(ct.configurationModule));printStepDebugInfo("Run applicationContext ready method");St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Tt.ready();St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);St.MidwayInitializerPerformanceManager.markStart(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(ct.globalConfig){if(Array.isArray(ct.globalConfig)){At.add(ct.globalConfig)}else{At.addObject(ct.globalConfig)}}printStepDebugInfo("Load config file");At.load();bt("[core]: Current config = %j",At.getConfiguration());St.MidwayInitializerPerformanceManager.markEnd(St.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Tt.get(dt.MidwayMiddlewareService,[Tt]);return Tt}ut.prepareGlobalApplicationContext=prepareGlobalApplicationContext},90406:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.pascalCase=ut.camelCase=void 0;const pt=/[\p{Lu}]/u;const dt=/[\p{Ll}]/u;const ft=/([\p{Alpha}\p{N}_]|$)/u;const _t=/[_.\- ]+/;const mt=new RegExp("^"+_t.source);const ht=new RegExp(_t.source+ft.source,"gu");const yt=new RegExp("\\d+"+ft.source,"gu");const preserveCamelCase=(ct,ut,ft)=>{let _t=false;let mt=false;let ht=false;for(let yt=0;yt<ct.length;yt++){const vt=ct[yt];if(_t&&pt.test(vt)){ct=ct.slice(0,yt)+"-"+ct.slice(yt);_t=false;ht=mt;mt=true;yt++}else if(mt&&ht&&dt.test(vt)){ct=ct.slice(0,yt-1)+"-"+ct.slice(yt-1);ht=mt;mt=false;_t=true}else{_t=ut(vt)===vt&&ft(vt)!==vt;ht=mt;mt=ft(vt)===vt&&ut(vt)!==vt}}return ct};const postProcess=(ct,ut)=>{ht.lastIndex=0;yt.lastIndex=0;return ct.replace(ht,((ct,pt)=>ut(pt))).replace(yt,(ct=>ut(ct)))};function camelCaseOrigin(ct,ut){ut={pascalCase:false,...ut};ct=ct.trim();if(ct.length===0){return""}const toLowerCase=ct=>ct.toLowerCase();const toUpperCase=ct=>ct.toUpperCase();if(ct.length===1){if(_t.test(ct)){return""}return ut.pascalCase?toUpperCase(ct):toLowerCase(ct)}const pt=ct!==toLowerCase(ct);if(pt){ct=preserveCamelCase(ct,toLowerCase,toUpperCase)}ct=ct.replace(mt,"");ct=toLowerCase(ct);if(ut.pascalCase){ct=toUpperCase(ct.charAt(0))+ct.slice(1)}return postProcess(ct,toUpperCase)}function camelCase(ct){return camelCaseOrigin(ct,{pascalCase:false})}ut.camelCase=camelCase;function pascalCase(ct){return camelCaseOrigin(ct,{pascalCase:true})}ut.pascalCase=pascalCase},50539:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.getCurrentAsyncContextManager=ut.getCurrentMainApp=ut.getCurrentMainFramework=ut.getCurrentApplicationContext=void 0;const dt=pt(2222);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];ut.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];ut.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const ct=(0,ut.getCurrentMainFramework)();if(ct){return ct.getApplication()}return undefined};ut.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,ut.getCurrentApplicationContext)().get(dt.ASYNC_CONTEXT_MANAGER_KEY);ut.getCurrentAsyncContextManager=getCurrentAsyncContextManager},83486:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.extend=void 0;const dt=pt(63289);function extend(...ct){let ut,pt,ft,_t,mt;let ht=ct[0];let yt=1;const vt=ct.length;let St=false;if(typeof ht==="boolean"){St=ht;ht=ct[1]||{};yt=2}else if(typeof ht!=="object"&&typeof ht!=="function"||ht==null){ht={}}for(;yt<vt;++yt){ut=ct[yt];if(ut==null)continue;for(pt in ut){if(pt==="__proto__")continue;ft=ht[pt];_t=ut[pt];if(ht===_t)continue;if(St&&_t&&dt.Types.isPlainObject(_t)){mt=ft&&dt.Types.isPlainObject(ft)?ft:{};ht[pt]=extend(St,mt,_t)}else if(typeof _t!=="undefined"){ht[pt]=_t}}}return ht}ut.extend=extend},2764:(ct,ut)=>{"use strict";
2
2
  /*! (c) 2020 Andrea Giammarchi */Object.defineProperty(ut,"__esModule",{value:true});ut.safeStringify=ut.safeParse=void 0;const{parse:pt,stringify:dt}=JSON;const{keys:ft}=Object;const _t=String;const mt="string";const ht={};const yt="object";const noop=(ct,ut)=>ut;const primitives=ct=>ct instanceof _t?_t(ct):ct;const Primitives=(ct,ut)=>typeof ut===mt?new _t(ut):ut;const revive=(ct,ut,pt,dt)=>{const mt=[];for(let vt=ft(pt),{length:St}=vt,bt=0;bt<St;bt++){const ft=vt[bt];const St=pt[ft];if(St instanceof _t){const _t=ct[St];if(typeof _t===yt&&!ut.has(_t)){ut.add(_t);pt[ft]=ht;mt.push({k:ft,a:[ct,ut,_t,dt]})}else pt[ft]=dt.call(pt,ft,_t)}else if(pt[ft]!==ht)pt[ft]=dt.call(pt,ft,St)}for(let{length:ct}=mt,ut=0;ut<ct;ut++){const{k:ct,a:ft}=mt[ut];pt[ct]=dt.call(pt,ct,revive.apply(null,ft))}return pt};const set=(ct,ut,pt)=>{const dt=_t(ut.push(pt)-1);ct.set(pt,dt);return dt};function safeParse(ct,ut){const dt=pt(ct,Primitives).map(primitives);const ft=dt[0];const _t=ut||noop;const mt=typeof ft===yt&&ft?revive(dt,new Set,ft,_t):ft;return _t.call({"":mt},"",mt)}ut.safeParse=safeParse;function safeStringify(ct,ut,pt){const ft=ut&&typeof ut===yt?(ct,pt)=>ct===""||-1<ut.indexOf(ct)?pt:void 0:ut||noop;const _t=new Map;const ht=[];const vt=[];let St=+set(_t,ht,ft.call({"":ct},"",ct));let bt=!St;while(St<ht.length){bt=true;vt[St]=dt(ht[St++],replace,pt)}return"["+vt.join(",")+"]";function replace(ct,ut){if(bt){bt=!bt;return ut}const pt=ft.call(this,ct,ut);switch(typeof pt){case yt:if(pt===null)return pt;case mt:return _t.get(pt)||set(_t,ht,pt)}return pt}}ut.safeStringify=safeStringify},30001:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.FORMAT=void 0;const pt=1e3;const dt=pt*60;const ft=dt*60;const _t=ft*24;const mt=_t*7;const ht=_t*365.25;const yt={ONE_SECOND:pt,ONE_MINUTE:dt,ONE_HOUR:ft,ONE_DAY:_t,ONE_WEEK:mt,ONE_YEAR:ht};const vt={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 * * * *"};ut.FORMAT={MS:yt,CRONTAB:vt}},7589:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.FileUtils=ut.exists=void 0;const dt=pt(79896);async function exists(ct){return dt.promises.access(ct,dt.constants.F_OK).then((()=>true)).catch((()=>false))}ut.exists=exists;ut.FileUtils={exists:exists}},87653:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.HttpClient=ut.makeHttpRequest=void 0;const dt=pt(58611);const ft=pt(65692);const _t=pt(87016);const mt=pt(39023);const ht=pt(86314);const yt=(0,mt.debuglog)("request-client");const vt=_t.URL;const St={text:"application/text",json:"application/json",octet:"application/octet-stream"};function isHeaderExists(ct,ut){return ct[ut]||ct[ut.toLowerCase()]||ct[ut.toUpperCase()]}async function makeHttpRequest(ct,ut={}){yt(`request '${ct}'`);const pt=new vt(ct);const _t=pt.protocol==="https:"?ft:dt;ut.method=(ut.method||"GET").toUpperCase();const{contentType:mt,dataType:bt,method:xt,timeout:$t=5e3,headers:Et,...Ct}=ut;const Tt={Accept:St[bt]||St.octet,...Et};let wt;if(xt==="GET"&&ut.data){for(const ct of Object.keys(ut.data)){pt.searchParams.set(ct,ut.data[ct])}Tt["Content-Length"]=0}else if(ut.data){wt=Buffer.from(JSON.stringify(ut.data));if(!isHeaderExists(Tt,"Content-Type")){Tt["Content-Type"]=St[mt]||St.octet}if(!isHeaderExists(Tt,"Content-Length")){Tt["Content-Length"]=wt.byteLength}}return new Promise(((ut,dt)=>{const ft=_t.request(pt.toString(),{method:xt,headers:Tt,...Ct},(pt=>{pt.setTimeout($t,(()=>{pt.destroy(new Error("Response Timeout"))}));pt.on("error",(ct=>{dt(ct)}));const ft=[];pt.on("data",(ct=>{ft.push(ct)}));pt.on("end",(()=>{let _t=Buffer.concat(ft);if(bt==="text"||bt==="json"){_t=_t.toString("utf8")}if(bt==="json"){try{_t=JSON.parse(_t)}catch(ct){return dt(new Error("[httpclient] Unable to parse response data"))}}Object.assign(pt,{status:pt.statusCode,data:_t});yt(`request '${ct}' resolved with status ${pt.statusCode}`);ut(pt)}))}));ft.setTimeout($t,(()=>{ft.destroy(new ht.MidwayUtilHttpClientTimeoutError("Request Timeout"))}));ft.on("error",(ct=>{dt(ct)}));if(xt!=="GET"){ft.end(wt)}else{ft.end()}}))}ut.makeHttpRequest=makeHttpRequest;class HttpClient{constructor(ct={}){this.defaultOptions=ct}async request(ct,ut){return makeHttpRequest(ct,Object.assign({},this.defaultOptions,ut))}}ut.HttpClient=HttpClient},65308:(ct,ut,pt)=>{"use strict";ct=pt.nmd(ct);Object.defineProperty(ut,"__esModule",{value:true});ut.Utils=ut.createPromiseTimeoutInvokeChain=ut.isTypeScriptEnvironment=ut.toAsyncFunction=ut.merge=ut.generateRandomId=ut.getParamNames=ut.sleep=ut.wrapAsync=ut.isIncludeProperty=ut.wrapMiddleware=ut.pathMatching=ut.toPathMatch=ut.transformRequestObjectByType=ut.deprecatedOutput=ut.getCurrentDateString=ut.delegateTargetProperties=ut.delegateTargetMethod=ut.delegateTargetAllPrototypeMethod=ut.delegateTargetPrototypeMethod=ut.joinURLPath=ut.getUserHome=ut.parsePrefix=ut.safelyGet=ut.loadModule=ut.safeRequire=ut.getCurrentEnvironment=ut.isDevelopmentEnvironment=void 0;const dt=pt(16928);const ft=pt(79896);const _t=pt(39023);const mt=pt(14142);const ht=pt(73861);const yt=pt(86314);const vt=pt(90406);const St=pt(2897);const bt=pt(2764);const xt=pt(76982);const $t=pt(63289);const Et=pt(87016);const Ct=(0,_t.debuglog)("midway:debug");const isDevelopmentEnvironment=ct=>["local","test","unittest"].includes(ct);ut.isDevelopmentEnvironment=isDevelopmentEnvironment;const getCurrentEnvironment=()=>process.env["MIDWAY_SERVER_ENV"]||process.env["NODE_ENV"]||"prod";ut.getCurrentEnvironment=getCurrentEnvironment;const safeRequire=(ut,pt=true)=>{if(ut.startsWith(`.${dt.sep}`)||ut.startsWith(`..${dt.sep}`)){ut=(0,dt.resolve)((0,dt.dirname)(ct.parent.filename),ut)}try{if(pt){return require(ut)}else{const ct=(0,ft.readFileSync)(ut,{encoding:"utf-8"});return JSON.parse(ct)}}catch(ct){Ct(`[core]: SafeRequire Warning\n\n${ct.message}\n`);return undefined}};ut.safeRequire=safeRequire;const Tt={};const loadModule=async(ut,_t={})=>{var mt,ht,yt;_t.enableCache=(mt=_t.enableCache)!==null&&mt!==void 0?mt:true;_t.safeLoad=(ht=_t.safeLoad)!==null&&ht!==void 0?ht:false;_t.loadMode=(yt=_t.loadMode)!==null&&yt!==void 0?yt:"commonjs";if(ut.startsWith(`.${dt.sep}`)||ut.startsWith(`..${dt.sep}`)){ut=(0,dt.resolve)((0,dt.dirname)(ct.parent.filename),ut)}Ct(`[core]: load module ${ut}, cache: ${_t.enableCache}, mode: ${_t.loadMode}, safeLoad: ${_t.safeLoad}`);try{if(_t.enableCache){if(_t.loadMode==="commonjs"){return require(ut)}else{if(ut.endsWith(".json")){if(!Tt[ut]){const ct=(0,ft.readFileSync)(ut,{encoding:"utf-8"});Tt[ut]=JSON.parse(ct)}return Tt[ut]}else{return await pt(53196)((0,Et.pathToFileURL)(ut).href)}}}else{const ct=(0,ft.readFileSync)(ut,{encoding:"utf-8"});return JSON.parse(ct)}}catch(ct){if(!_t.safeLoad){throw ct}else{Ct(`[core]: SafeLoadModule Warning\n\n${ct.message}\n`);return undefined}}};ut.loadModule=loadModule;function safelyGet(ct,ut){if(arguments.length===1){return ut=>safelyGet(ct,ut)}if(typeof ut==="undefined"||typeof ut!=="object"||ut===null){return void 0}const pt=typeof ct==="string"?ct.split("."):ct;let dt=ut;for(const ct of pt){if(typeof dt==="undefined"||dt===null){return void 0}else if(typeof dt!=="object"){return void 0}dt=dt[ct]}return dt}ut.safelyGet=safelyGet;function parsePrefix(ct){if(ct.includes("@")){return ct.slice(1)}return ct}ut.parsePrefix=parsePrefix;function getUserHome(){return process.env[process.platform==="win32"?"USERPROFILE":"HOME"]}ut.getUserHome=getUserHome;function joinURLPath(...ct){ct=ct.filter((ct=>!!ct));if(ct.length===0){return""}let ut=dt.posix.join(...ct);ut=ut.replace(/\/+$/,"");if(!/^\//.test(ut)){ut="/"+ut}return ut}ut.joinURLPath=joinURLPath;function delegateTargetPrototypeMethod(ct,ut,pt){ut.forEach((ut=>{if(ut.prototype){Object.getOwnPropertyNames(ut.prototype).forEach((ut=>{if(ut!=="constructor"&&!/^_/.test(ut)&&!ct.prototype[ut]){ct.prototype[ut]=function(...ct){return this.instance[ut](...ct)}}}))}}));if(pt){delegateTargetMethod(ct,pt)}}ut.delegateTargetPrototypeMethod=delegateTargetPrototypeMethod;function delegateTargetAllPrototypeMethod(ct,ut){do{delegateTargetPrototypeMethod(ct,[ut]);ut=Object.getPrototypeOf(ut)}while(ut)}ut.delegateTargetAllPrototypeMethod=delegateTargetAllPrototypeMethod;function delegateTargetMethod(ct,ut){ut.forEach((ut=>{ct.prototype[ut]=function(...ct){return this.instance[ut](...ct)}}))}ut.delegateTargetMethod=delegateTargetMethod;function delegateTargetProperties(ct,ut){ut.forEach((ut=>{Object.defineProperty(ct.prototype,ut,{get(){return this.instance[ut]}})}))}ut.delegateTargetProperties=delegateTargetProperties;const getCurrentDateString=(ct=Date.now())=>{const ut=new Date(ct);return`${ut.getFullYear()}-${(ut.getMonth()+1).toString().padStart(2,"0")}-${ut.getDate().toString().padStart(2,"0")}`};ut.getCurrentDateString=getCurrentDateString;const deprecatedOutput=ct=>{console.warn("DeprecationWarning: "+ct)};ut.deprecatedOutput=deprecatedOutput;const transformRequestObjectByType=(ct,ut)=>{if(ut===undefined||ut===null||ut===Object||typeof ct==="undefined"){return ct}switch(ut){case Number:return Number(ct);case String:return String(ct);case Boolean:if(ct==="0"||ct==="false"){return false}return Boolean(ct);default:if(ct instanceof ut){return ct}else{const pt=mt["plainToClass"]||mt["plainToInstance"];return pt(ut,ct)}}};ut.transformRequestObjectByType=transformRequestObjectByType;function toPathMatch(ct){if(typeof ct==="boolean"){return ut=>ct}if(typeof ct==="string"){const ut=ht.PathToRegexpUtil.toRegexp(ct.replace("*","(.*)"));if(ut.global)ut.lastIndex=0;return ct=>ut.test(ct.path)}if(ct instanceof RegExp){return ut=>{if(ct.global)ct.lastIndex=0;return ct.test(ut.path)}}if(typeof ct==="function")return ct;if(Array.isArray(ct)){const ut=ct.map((ct=>toPathMatch(ct)));return ct=>ut.some((ut=>ut(ct)))}throw new yt.MidwayCommonError("match/ignore pattern must be RegExp, Array or String, but got "+ct)}ut.toPathMatch=toPathMatch;function pathMatching(ct){ct=ct||{};if(ct.match&&ct.ignore)throw new yt.MidwayCommonError("options.match and options.ignore can not both present");if(!ct.match&&!ct.ignore)return()=>true;if(ct.match&&!Array.isArray(ct.match)){ct.match=[ct.match]}if(ct.ignore&&!Array.isArray(ct.ignore)){ct.ignore=[ct.ignore]}const createMatch=ut=>{const pt=ut.map((ut=>{if(ct.thisResolver){return toPathMatch(ut).bind(ct.thisResolver)}return toPathMatch(ut)}));return ct=>{for(let ut=0;ut<pt.length;ut++){const dt=pt[ut](ct);if(dt){return true}}return false}};const ut=ct.match?createMatch(ct.match):createMatch(ct.ignore);return function pathMatch(pt){const dt=ut(pt);return ct.match?dt:!dt}}ut.pathMatching=pathMatching;function wrapMiddleware(ct,ut){if(ut.enable===false)return null;if(!ut.match&&!ut.ignore)return ct;const pt=pathMatching(ut);const fn=(ut,dt)=>{if(!pt(ut))return dt();return ct(ut,dt)};fn._name=ct._name+"middlewareWrapper";return fn}ut.wrapMiddleware=wrapMiddleware;function isOwnPropertyWritable(ct,ut){if(ct==null)return false;const pt=typeof ct;if(pt!=="object"&&pt!=="function")return false;return!!Object.getOwnPropertyDescriptor(ct,ut)}function isIncludeProperty(ct,ut){while(ct){if(isOwnPropertyWritable(ct,ut))return true;ct=Object.getPrototypeOf(ct)}return false}ut.isIncludeProperty=isIncludeProperty;function wrapAsync(ct){return(...ut)=>{if(typeof ut[ut.length-1]==="function"){const pt=ut.pop();if(ct.constructor.name!=="AsyncFunction"){const ct=new TypeError("Must be an AsyncFunction");return pt(ct)}return ct.apply(ct,ut).then((ct=>{pt(null,ct)}),(ct=>{pt(ct)}))}else{return ct.apply(ct,ut)}}}ut.wrapAsync=wrapAsync;function sleep(ct=1e3){return new Promise((ut=>{setTimeout((()=>{ut()}),ct)}))}ut.sleep=sleep;const wt=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function getParamNames(ct){const ut=ct.toString().replace(wt,"");let pt=ut.slice(ut.indexOf("(")+1,ut.indexOf(")")).split(",").map((ct=>ct.trim().replace(/\s?=.*$/,"")));if(pt.length===1&&pt[0]===""){pt=[]}return pt}ut.getParamNames=getParamNames;function generateRandomId(){return xt.randomBytes(16).toString("hex")}ut.generateRandomId=generateRandomId;function merge(ct,ut){if(!ct){ct=ut;ut=null}if(!ct){return null}if(Array.isArray(ct)){return ct.concat(ut||[])}if(typeof ct==="object"){return Object.assign({},ct,ut)}throw new Error("can not merge meta that type of "+typeof ct)}ut.merge=merge;function toAsyncFunction(ct){if($t.Types.isAsyncFunction(ct)){return ct}else{return async function(...ut){return Promise.resolve(ct.call(this,...ut))}}}ut.toAsyncFunction=toAsyncFunction;function isTypeScriptEnvironment(){const ct=process.env.MIDWAY_TS_MODE;if("false"===ct){return false}return ct==="true"||!!require.extensions[".ts"]}ut.isTypeScriptEnvironment=isTypeScriptEnvironment;async function createPromiseTimeoutInvokeChain(ct){var ut;if(!ct.onSuccess){ct.onSuccess=async ct=>ct}ct.isConcurrent=(ut=ct.isConcurrent)!==null&&ut!==void 0?ut:true;ct.promiseItems=ct.promiseItems.map((ct=>{if(ct instanceof Promise){return{item:ct}}else{return ct}}));ct.promiseItems=ct.promiseItems.filter((ct=>ct["item"]instanceof Promise));if(ct.isConcurrent){const ut=ct.promiseItems.map((ut=>{const pt=new Promise(((pt,dt)=>{var ft;setTimeout((()=>{var pt;return dt(new yt.MidwayCodeInvokeTimeoutError(ct.methodName,(pt=ut["timeout"])!==null&&pt!==void 0?pt:ct.timeout))}),(ft=ut["timeout"])!==null&&ft!==void 0?ft:ct.timeout)}));return Promise.race([ut["item"],pt]).then((pt=>ct.onSuccess(pt,ut["meta"]))).catch((pt=>ct.onFail(pt,ut["meta"])))}));return Promise.all(ut)}else{const ut=[];for(const pt of ct.promiseItems){const dt=new Promise(((ut,dt)=>{var ft;setTimeout((()=>{var ut;return dt(new yt.MidwayCodeInvokeTimeoutError(ct.methodName,(ut=pt["timeout"])!==null&&ut!==void 0?ut:ct.timeout))}),(ft=pt["timeout"])!==null&&ft!==void 0?ft:ct.timeout)}));try{const ft=await Promise.race([pt["item"],dt]).then((ut=>ct.onSuccess(ut,pt["meta"])));ut.push(ft)}catch(dt){ut.push(ct.onFail(dt,pt["meta"]));break}}return ut}}ut.createPromiseTimeoutInvokeChain=createPromiseTimeoutInvokeChain;ut.Utils={sleep:sleep,getParamNames:getParamNames,camelCase:vt.camelCase,pascalCase:vt.pascalCase,randomUUID:St.randomUUID,generateRandomId:generateRandomId,toAsyncFunction:toAsyncFunction,safeStringify:bt.safeStringify,safeParse:bt.safeParse,isTypeScriptEnvironment:isTypeScriptEnvironment}},61327:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.getModuleRequirePathList=ut.PathFileUtil=ut.getFileContentSync=ut.isPathEqual=ut.isPath=void 0;const dt=pt(16928);const ft=pt(79896);function isPath(ct){if(/(^[\.\/])|:|\\/.test(ct)){return true}return false}ut.isPath=isPath;function isPathEqual(ct,ut){if(!ct||!ut){return false}const pt=(0,dt.extname)(ct);return ct.replace(pt,"")===ut}ut.isPathEqual=isPathEqual;function getFileContentSync(ct,ut){return typeof ct==="string"?(0,ft.readFileSync)(ct,{encoding:ut}):ct}ut.getFileContentSync=getFileContentSync;ut.PathFileUtil={isPath:isPath,isPathEqual:isPathEqual,getFileContentSync:getFileContentSync};function getModuleRequirePathList(ct){const ut=[ct,ct.replace(/\//g,"_")];let pt={};const dt=[];Object.keys(require.cache||{}).forEach((ct=>{let ft=-1;for(const ct of ut){const ut=ct.indexOf(ct);if(ut!==-1){ft=ut;break}}if(ft===-1){return}const _t=ct.slice(0,ft);if(pt[_t]){return}pt[_t]=true;dt.push(_t)}));pt=undefined;return dt}ut.getModuleRequirePathList=getModuleRequirePathList},73861:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.PathToRegexpUtil=void 0;function lexer(ct){const ut=[];let pt=0;while(pt<ct.length){const dt=ct[pt];if(dt==="*"||dt==="+"||dt==="?"){ut.push({type:"MODIFIER",index:pt,value:ct[pt++]});continue}if(dt==="\\"){ut.push({type:"ESCAPED_CHAR",index:pt++,value:ct[pt++]});continue}if(dt==="{"){ut.push({type:"OPEN",index:pt,value:ct[pt++]});continue}if(dt==="}"){ut.push({type:"CLOSE",index:pt,value:ct[pt++]});continue}if(dt===":"){let dt="";let ft=pt+1;while(ft<ct.length){const ut=ct.charCodeAt(ft);if(ut>=48&&ut<=57||ut>=65&&ut<=90||ut>=97&&ut<=122||ut===95){dt+=ct[ft++];continue}break}if(!dt)throw new TypeError(`Missing parameter name at ${pt}`);ut.push({type:"NAME",index:pt,value:dt});pt=ft;continue}if(dt==="("){let dt=1;let ft="";let _t=pt+1;if(ct[_t]==="?"){throw new TypeError(`Pattern cannot start with "?" at ${_t}`)}while(_t<ct.length){if(ct[_t]==="\\"){ft+=ct[_t++]+ct[_t++];continue}if(ct[_t]===")"){dt--;if(dt===0){_t++;break}}else if(ct[_t]==="("){dt++;if(ct[_t+1]!=="?"){throw new TypeError(`Capturing groups are not allowed at ${_t}`)}}ft+=ct[_t++]}if(dt)throw new TypeError(`Unbalanced pattern at ${pt}`);if(!ft)throw new TypeError(`Missing pattern at ${pt}`);ut.push({type:"PATTERN",index:pt,value:ft});pt=_t;continue}ut.push({type:"CHAR",index:pt,value:ct[pt++]})}ut.push({type:"END",index:pt,value:""});return ut}function parse(ct,ut={}){const pt=lexer(ct);const{prefixes:dt="./"}=ut;const ft=`[^${escapeString(ut.delimiter||"/#?")}]+?`;const _t=[];let mt=0;let ht=0;let yt="";const tryConsume=ct=>{if(ht<pt.length&&pt[ht].type===ct)return pt[ht++].value};const mustConsume=ct=>{const ut=tryConsume(ct);if(ut!==undefined)return ut;const{type:dt,index:ft}=pt[ht];throw new TypeError(`Unexpected ${dt} at ${ft}, expected ${ct}`)};const consumeText=()=>{let ct="";let ut;while(ut=tryConsume("CHAR")||tryConsume("ESCAPED_CHAR")){ct+=ut}return ct};while(ht<pt.length){const ct=tryConsume("CHAR");const ut=tryConsume("NAME");const pt=tryConsume("PATTERN");if(ut||pt){let ht=ct||"";if(dt.indexOf(ht)===-1){yt+=ht;ht=""}if(yt){_t.push(yt);yt=""}_t.push({name:ut||mt++,prefix:ht,suffix:"",pattern:pt||ft,modifier:tryConsume("MODIFIER")||""});continue}const ht=ct||tryConsume("ESCAPED_CHAR");if(ht){yt+=ht;continue}if(yt){_t.push(yt);yt=""}const vt=tryConsume("OPEN");if(vt){const ct=consumeText();const ut=tryConsume("NAME")||"";const pt=tryConsume("PATTERN")||"";const dt=consumeText();mustConsume("CLOSE");_t.push({name:ut||(pt?mt++:""),pattern:ut&&!pt?ft:pt,prefix:ct,suffix:dt,modifier:tryConsume("MODIFIER")||""});continue}mustConsume("END")}return _t}function compile(ct,ut){return tokensToFunction(parse(ct,ut),ut)}function tokensToFunction(ct,ut={}){const pt=flags(ut);const{encode:dt=ct=>ct,validate:ft=true}=ut;const _t=ct.map((ct=>{if(typeof ct==="object"){return new RegExp(`^(?:${ct.pattern})$`,pt)}}));return ut=>{let pt="";for(let mt=0;mt<ct.length;mt++){const ht=ct[mt];if(typeof ht==="string"){pt+=ht;continue}const yt=ut?ut[ht.name]:undefined;const vt=ht.modifier==="?"||ht.modifier==="*";const St=ht.modifier==="*"||ht.modifier==="+";if(Array.isArray(yt)){if(!St){throw new TypeError(`Expected "${ht.name}" to not repeat, but got an array`)}if(yt.length===0){if(vt)continue;throw new TypeError(`Expected "${ht.name}" to not be empty`)}for(let ct=0;ct<yt.length;ct++){const ut=dt(yt[ct],ht);if(ft&&!_t[mt].test(ut)){throw new TypeError(`Expected all "${ht.name}" to match "${ht.pattern}", but got "${ut}"`)}pt+=ht.prefix+ut+ht.suffix}continue}if(typeof yt==="string"||typeof yt==="number"){const ct=dt(String(yt),ht);if(ft&&!_t[mt].test(ct)){throw new TypeError(`Expected "${ht.name}" to match "${ht.pattern}", but got "${ct}"`)}pt+=ht.prefix+ct+ht.suffix;continue}if(vt)continue;const bt=St?"an array":"a string";throw new TypeError(`Expected "${ht.name}" to be ${bt}`)}return pt}}function match(ct,ut){const pt=[];const dt=toRegexp(ct,pt,ut);return regexpToFunction(dt,pt,ut)}function regexpToFunction(ct,ut,pt={}){const{decode:dt=ct=>ct}=pt;return function(pt){const ft=ct.exec(pt);if(!ft)return false;const{0:_t,index:mt}=ft;const ht=Object.create(null);for(let ct=1;ct<ft.length;ct++){if(ft[ct]===undefined)continue;const pt=ut[ct-1];if(pt.modifier==="*"||pt.modifier==="+"){ht[pt.name]=ft[ct].split(pt.prefix+pt.suffix).map((ct=>dt(ct,pt)))}else{ht[pt.name]=dt(ft[ct],pt)}}return{path:_t,index:mt,params:ht}}}function escapeString(ct){return ct.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function flags(ct){return ct&&ct.sensitive?"":"i"}function regexpToRegexp(ct,ut){if(!ut)return ct;const pt=/\((?:\?<(.*?)>)?(?!\?)/g;let dt=0;let ft=pt.exec(ct.source);while(ft){ut.push({name:ft[1]||dt++,prefix:"",suffix:"",modifier:"",pattern:""});ft=pt.exec(ct.source)}return ct}function arrayToRegexp(ct,ut,pt){const dt=ct.map((ct=>toRegexp(ct,ut,pt).source));return new RegExp(`(?:${dt.join("|")})`,flags(pt))}function stringToRegexp(ct,ut,pt){return tokensToRegexp(parse(ct,pt),ut,pt)}function tokensToRegexp(ct,ut,pt={}){const{strict:dt=false,start:ft=true,end:_t=true,encode:mt=ct=>ct,delimiter:ht="/#?",endsWith:yt=""}=pt;const vt=`[${escapeString(yt)}]|$`;const St=`[${escapeString(ht)}]`;let bt=ft?"^":"";for(const pt of ct){if(typeof pt==="string"){bt+=escapeString(mt(pt))}else{const ct=escapeString(mt(pt.prefix));const dt=escapeString(mt(pt.suffix));if(pt.pattern){if(ut)ut.push(pt);if(ct||dt){if(pt.modifier==="+"||pt.modifier==="*"){const ut=pt.modifier==="*"?"?":"";bt+=`(?:${ct}((?:${pt.pattern})(?:${dt}${ct}(?:${pt.pattern}))*)${dt})${ut}`}else{bt+=`(?:${ct}(${pt.pattern})${dt})${pt.modifier}`}}else{if(pt.modifier==="+"||pt.modifier==="*"){bt+=`((?:${pt.pattern})${pt.modifier})`}else{bt+=`(${pt.pattern})${pt.modifier}`}}}else{bt+=`(?:${ct}${dt})${pt.modifier}`}}}if(_t){if(!dt)bt+=`${St}?`;bt+=!pt.endsWith?"$":`(?=${vt})`}else{const ut=ct[ct.length-1];const pt=typeof ut==="string"?St.indexOf(ut[ut.length-1])>-1:ut===undefined;if(!dt){bt+=`(?:${St}(?=${vt}))?`}if(!pt){bt+=`(?=${St}|${vt})`}}return new RegExp(bt,flags(pt))}function toRegexp(ct,ut,pt){if(ct instanceof RegExp)return regexpToRegexp(ct,ut);if(Array.isArray(ct))return arrayToRegexp(ct,ut,pt);return stringToRegexp(ct,ut,pt)}ut.PathToRegexpUtil={toRegexp:toRegexp,compile:compile,parse:parse,match:match}},25198:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.retryWith=ut.retryWithAsync=void 0;const dt=pt(65308);const ft=pt(86314);function retryWithAsync(ct,ut=1,pt={}){let _t=ut;let mt;return async(...ht)=>{do{try{return await ct.bind(pt.receiver||this)(...ht)}catch(ct){mt=ct}if(pt.retryInterval>=0){await(0,dt.sleep)(pt.retryInterval)}}while(_t-- >0);if(pt.throwOriginError){throw mt}else{throw new ft.MidwayRetryExceededMaxTimesError(ct.name||"anonymous",ut,mt)}}}ut.retryWithAsync=retryWithAsync;function retryWith(ct,ut=1,pt={}){let dt=ut;let _t;return(...mt)=>{do{try{return ct.bind(pt.receiver||this)(...mt)}catch(ct){_t=ct}}while(dt-- >0);if(pt.throwOriginError){throw _t}else{throw new ft.MidwayRetryExceededMaxTimesError(ct.name||"anonymous",ut,_t)}}}ut.retryWith=retryWith},63289:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Types=ut.isNullOrUndefined=ut.isNull=ut.isUndefined=ut.isRegExp=ut.isSet=ut.isMap=ut.isProxy=ut.isNumber=ut.isPlainObject=ut.isObject=ut.isFunction=ut.isPromise=ut.isGeneratorFunction=ut.isAsyncFunction=ut.isClass=ut.isString=void 0;const dt=pt(39023);const ft=Function.prototype.toString;const _t=Object.prototype.hasOwnProperty;const mt=Object.prototype.toString;function isString(ct){return typeof ct==="string"}ut.isString=isString;function isClass(ct){if(typeof ct!=="function"){return false}if(/^class[\s{]/.test(ft.call(ct))){return true}}ut.isClass=isClass;function isAsyncFunction(ct){return dt.types.isAsyncFunction(ct)}ut.isAsyncFunction=isAsyncFunction;function isGeneratorFunction(ct){return dt.types.isGeneratorFunction(ct)}ut.isGeneratorFunction=isGeneratorFunction;function isPromise(ct){return dt.types.isPromise(ct)}ut.isPromise=isPromise;function isFunction(ct){return typeof ct==="function"}ut.isFunction=isFunction;function isObject(ct){return ct!==null&&typeof ct==="object"}ut.isObject=isObject;function isPlainObject(ct){if(!ct||mt.call(ct)!=="[object Object]"){return false}const ut=_t.call(ct,"constructor");const pt=ct.constructor&&ct.constructor.prototype&&_t.call(ct.constructor.prototype,"isPrototypeOf");if(ct.constructor&&!ut&&!pt){return false}let dt;for(dt in ct){}return typeof dt==="undefined"||_t.call(ct,dt)}ut.isPlainObject=isPlainObject;function isNumber(ct){return typeof ct==="number"}ut.isNumber=isNumber;function isProxy(ct){return dt.types.isProxy(ct)}ut.isProxy=isProxy;function isMap(ct){return dt.types.isMap(ct)}ut.isMap=isMap;function isSet(ct){return dt.types.isSet(ct)}ut.isSet=isSet;function isRegExp(ct){return dt.types.isRegExp(ct)}ut.isRegExp=isRegExp;function isUndefined(ct){return ct===undefined}ut.isUndefined=isUndefined;function isNull(ct){return ct===null}ut.isNull=isNull;function isNullOrUndefined(ct){return isUndefined(ct)||isNull(ct)}ut.isNullOrUndefined=isNullOrUndefined;ut.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:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.randomUUID=void 0;const dt=pt(76982);const ft=new Uint8Array(256);let _t=ft.length;function rng(){if(_t>ft.length-16){dt.randomFillSync(ft);_t=0}return ft.slice(_t,_t+=16)}const mt=[];for(let ct=0;ct<256;++ct){mt.push((ct+256).toString(16).slice(1))}function unsafeStringify(ct,ut=0){return(mt[ct[ut+0]]+mt[ct[ut+1]]+mt[ct[ut+2]]+mt[ct[ut+3]]+"-"+mt[ct[ut+4]]+mt[ct[ut+5]]+"-"+mt[ct[ut+6]]+mt[ct[ut+7]]+"-"+mt[ct[ut+8]]+mt[ct[ut+9]]+"-"+mt[ct[ut+10]]+mt[ct[ut+11]]+mt[ct[ut+12]]+mt[ct[ut+13]]+mt[ct[ut+14]]+mt[ct[ut+15]]).toLowerCase()}function randomUUID(ct){if(!ct&&dt["randomUUID"]){return dt["randomUUID"]()}const ut=rng();ut[6]=ut[6]&15|64;ut[8]=ut[8]&63|128;return unsafeStringify(ut)}ut.randomUUID=randomUUID},46422:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.extractExpressLikeValue=ut.extractKoaLikeValue=void 0;const dt=pt(49757);const ft=pt(65308);const extractKoaLikeValue=(ct,ut,pt)=>{if(dt.ALL===ut){ut=undefined}return function(_t,mt){switch(ct){case dt.RouteParamTypes.NEXT:return mt;case dt.RouteParamTypes.BODY:return(0,ft.transformRequestObjectByType)(ut&&_t.request.body?_t.request.body[ut]:_t.request.body,pt);case dt.RouteParamTypes.PARAM:return(0,ft.transformRequestObjectByType)(ut?_t.params[ut]:_t.params,pt);case dt.RouteParamTypes.QUERY:return(0,ft.transformRequestObjectByType)(ut?_t.query[ut]:_t.query,pt);case dt.RouteParamTypes.HEADERS:return(0,ft.transformRequestObjectByType)(ut?_t.get(ut):_t.headers,pt);case dt.RouteParamTypes.SESSION:return(0,ft.transformRequestObjectByType)(ut?_t.session[ut]:_t.session,pt);case dt.RouteParamTypes.FILESTREAM:if(_t.getFileStream){return _t.getFileStream(ut)}else if(_t.files){if(Array.isArray(_t.files)){return _t.files[0]}else{return _t.files}}else{return undefined}case dt.RouteParamTypes.FILESSTREAM:if(_t.multipart){return _t.multipart(ut)}else if(_t.files){return _t.files}else{return undefined}case dt.RouteParamTypes.REQUEST_PATH:return _t["path"];case dt.RouteParamTypes.REQUEST_IP:return _t["ip"];case dt.RouteParamTypes.QUERIES:if(_t.queries){return(0,ft.transformRequestObjectByType)(ut?_t.queries[ut]:_t.queries,pt)}else{return(0,ft.transformRequestObjectByType)(ut?_t.query[ut]:_t.query,pt)}case dt.RouteParamTypes.FIELDS:return ut?_t.fields[ut]:_t.fields;case dt.RouteParamTypes.CUSTOM:return ut?ut(_t):undefined;default:return null}}};ut.extractKoaLikeValue=extractKoaLikeValue;const extractExpressLikeValue=(ct,ut,pt)=>{if(dt.ALL===ut){ut=undefined}return function(_t,mt,ht){switch(ct){case dt.RouteParamTypes.NEXT:return ht;case dt.RouteParamTypes.BODY:return(0,ft.transformRequestObjectByType)(ut&&_t.body?_t.body[ut]:_t.body,pt);case dt.RouteParamTypes.PARAM:return(0,ft.transformRequestObjectByType)(ut?_t.params[ut]:_t.params,pt);case dt.RouteParamTypes.QUERY:return(0,ft.transformRequestObjectByType)(ut?_t.query[ut]:_t.query,pt);case dt.RouteParamTypes.HEADERS:return(0,ft.transformRequestObjectByType)(ut?_t.get(ut):_t.headers,pt);case dt.RouteParamTypes.SESSION:return(0,ft.transformRequestObjectByType)(ut?_t.session[ut]:_t.session,pt);case dt.RouteParamTypes.FILESTREAM:return _t.files?_t.files[0]:undefined;case dt.RouteParamTypes.FILESSTREAM:return _t.files;case dt.RouteParamTypes.REQUEST_PATH:return _t["baseUrl"];case dt.RouteParamTypes.REQUEST_IP:return _t["ip"];case dt.RouteParamTypes.QUERIES:if(_t.queries){return(0,ft.transformRequestObjectByType)(ut?_t.queries[ut]:_t.queries,pt)}else{return(0,ft.transformRequestObjectByType)(ut?_t.query[ut]:_t.query,pt)}case dt.RouteParamTypes.FIELDS:return ut?_t.fields[ut]:_t.fields;case dt.RouteParamTypes.CUSTOM:return ut?ut(_t,mt):undefined;default:return null}}};ut.extractExpressLikeValue=extractExpressLikeValue},73317:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.AbstractEventBus=ut.AckResponder=ut.createWaitHandler=void 0;const dt=pt(48001);const ft=pt(39023);const _t=pt(68108);const mt="_default_";const ht=null;function revertError(ct){const ut=new Error;ut.name=ct.name;ut.message=ct.message;ut.stack=ct.stack;return ut}class MessageLimitSet extends Set{constructor(ct){super();this.limit=ct}add(ct){if(this.size<this.limit){return super.add(ct)}}}async function createWaitHandler(ct,ut={}){await new Promise(((pt,dt)=>{const ft=setTimeout((()=>{clearInterval(mt);clearTimeout(ft);dt(new _t.EventBusTimeoutError)}),ut.timeout||5e3);const mt=setInterval((()=>{if(ct()){clearInterval(mt);clearTimeout(ft);pt(true)}}),ut.timeoutCheckInterval||500)}))}ut.createWaitHandler=createWaitHandler;class ChunkIterator{constructor(ct){this.debugLogger=ct;this.buffer=[]}publish(ct){this.buffer.push(ct);if(this.waitingPromiseDeferred){const ct=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;ct.resolve(this.buffer.shift())}}error(ct){if(this.waitingPromiseDeferred){const ut=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;ut.reject(ct)}else{this.errorRisen=ct}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 ct={};ct.promise=new Promise(((ut,pt)=>{ct.resolve=ut;ct.reject=pt}));this.waitingPromiseDeferred=ct;return ct.promise}}async next(){this.debugLogger("1 ChunkIterator run next and wait data");const{data:ct,isEnd:ut}=await this.tryToGetNextData();this.debugLogger("2 ChunkIterator get data",ct,ut);if(ut){this.clear();return{value:undefined,done:true}}else{return{value:ct,done:false}}}clear(){this.buffer.length=0}}class AckResponder{constructor(){this.isEndFlag=false}onData(ct){this.dataHandler=ct}onError(ct){this.errorHandler=ct}end(ct){if(!this.isEndFlag){this.isEndFlag=true;if(ct){this.sendData(ct)}this.sendData(ht)}}sendData(ct){if(this.dataHandler){this.dataHandler(ct)}}send(ct){if(!this.isEndFlag){this.sendData(ct)}}error(ct){if(!this.isEndFlag){if(this.errorHandler){this.errorHandler(ct)}}}isEnd(){return this.isEndFlag}}ut.AckResponder=AckResponder;class AbstractEventBus{constructor(ct={}){this.options=ct;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(dt.ListenerType.Error,(ct=>{console.error(ct)}));this.listener=(ct,ut)=>{var pt,ft;const _t=this.topicListener.get(((pt=ct.messageOptions)===null||pt===void 0?void 0:pt.topic)||mt);if(_t){for(const pt of _t){if(pt["_subscribeOnce"]){_t.delete(pt)}new Promise((async(dt,ft)=>{try{await dt(pt(ct,ut))}catch(ct){ft(ct)}})).catch((ct=>{if(ut){ut.error(ct)}else{this.eventListenerMap.get(dt.ListenerType.Error)(ct)}}))}}else{const pt=((ft=ct.messageOptions)===null||ft===void 0?void 0:ft.topic)||mt;if(!this.topicMessageCache.has(pt)){this.topicMessageCache.set(pt,new MessageLimitSet(10))}this.topicMessageCache.get(pt).add({message:ct,responder:ut})}};this.setupEventBind()}createDebugger(){return(0,ft.debuglog)(`midway:event-bus:${this.isWorker()?"worker":"main "}`)}debugDataflow(ct){if(ct.messageCategory===dt.MessageCategory.IN){if(this.isMain()){return`${ct.message.type}|${ct.messageCategory}: worker => main(△)`}else{return`${ct.message.type}|${ct.messageCategory}: main => worker(△)`}}else{if(this.isMain()){return`${ct.message.type}|${ct.messageCategory}: main(△) => worker`}else{return`${ct.message.type}|${ct.messageCategory}: worker(△) => main`}}}async start(ct){this.isInited=true;if(this.isMain()){await createWaitHandler((()=>this.isAllWorkerReady()),{timeout:this.options.initTimeout,timeoutCheckInterval:this.options.initTimeoutCheckInterval})}else{this.workerSubscribeMessage((ct=>{this.transit({messageCategory:dt.MessageCategory.IN,message:ct})}));this.transit({messageCategory:dt.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:dt.MessageType.Inited,body:this.isInited,error:ct?{name:ct.name,message:ct.message,stack:ct.stack}:undefined}})}}addWorker(ct){this.debugLogger(`Add worker(${this.getWorkerId(ct)})`);if(!this.workerReady.has(this.getWorkerId(ct))){this.debugLogger(`Init worker(${this.getWorkerId(ct)}) status = false`);this.workerReady.set(this.getWorkerId(ct),{worker:ct,ready:false})}else{this.debugLogger(`Skip init worker(${this.getWorkerId(ct)}) status`)}ct===null||ct===void 0?void 0:ct["on"]("exit",(async ut=>{if(!this.stopping){this.workerReady.delete(this.getWorkerId(ct));const ut=this.workers.findIndex((ut=>this.getWorkerId(ut)===this.getWorkerId(ct)));this.workers.splice(ut,1)}}));this.workerListenMessage(ct,(ct=>{this.transit({messageCategory:dt.MessageCategory.IN,message:ct})}));this.workers.push(ct)}isAllWorkerReady(){for(const[ct,ut]of this.workerReady){if(!ut||!ut.ready){this.debugLogger(`Worker(${ct}) not ready.`);return false}}if(this.workerReady.size>0){this.debugLogger(`All worker(size=${this.workerReady.size}) is ready.`)}return true}setupEventBind(){this.messageReceiver=ct=>{var ut,pt,ft,_t,mt,yt,vt,St,bt,xt,$t,Et,Ct,Tt,wt;if(!ct.message||!ct.message.messageId){return}this.debugLogger("EventCenter(%s) message = %j",this.debugDataflow(ct),ct);const At=ct.message;if(ct.messageCategory===dt.MessageCategory.OUT){if(At.type===dt.MessageType.Invoke||At.type===dt.MessageType.Request||At.type===dt.MessageType.Response||At.type===dt.MessageType.Broadcast){this.postMessage(At);(ut=this.eventListenerMap.get(dt.ListenerType.Request))===null||ut===void 0?void 0:ut(At)}else if(At.type===dt.MessageType.Inited){this.postMessage(At);(pt=this.eventListenerMap.get(dt.ListenerType.Inited))===null||pt===void 0?void 0:pt(At)}}else if(ct.messageCategory===dt.MessageCategory.IN){if(At.type===dt.MessageType.Invoke){const ct=((ft=At.messageOptions)===null||ft===void 0?void 0:ft["isChunk"])===true;const ut=new AckResponder;ut.onData((pt=>{var ft;this.transit({messageCategory:dt.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:dt.MessageType.Response,body:pt,messageOptions:{relatedMessageId:At.messageId,isChunk:ct,topic:(ft=At.messageOptions)===null||ft===void 0?void 0:ft.topic}}});if(!ct){ut.end()}}));ut.onError((pt=>{this.publish(pt,{relatedMessageId:At.messageId,isChunk:ct});ut.end()}));(_t=this.listener)===null||_t===void 0?void 0:_t.call(this,At,ut);(mt=this.eventListenerMap.get(dt.ListenerType.Subscribe))===null||mt===void 0?void 0:mt(At)}else if(At.type===dt.MessageType.Request){(yt=this.listener)===null||yt===void 0?void 0:yt.call(this,At);(vt=this.eventListenerMap.get(dt.ListenerType.Subscribe))===null||vt===void 0?void 0:vt(At)}else if(At.type===dt.MessageType.Broadcast){if(this.isMain()){if(At.messageOptions["includeMainFromWorker"]===true){(St=this.listener)===null||St===void 0?void 0:St.call(this,At);(bt=this.eventListenerMap.get(dt.ListenerType.Subscribe))===null||bt===void 0?void 0:bt(At)}this.broadcast(At.body,{...At.messageOptions,relatedMessageId:At.messageId,relatedWorkerId:At.workerId})}else{(xt=this.listener)===null||xt===void 0?void 0:xt.call(this,At);($t=this.eventListenerMap.get(dt.ListenerType.Subscribe))===null||$t===void 0?void 0:$t(At)}}else if(At.type===dt.MessageType.Response){if((Et=At.messageOptions)===null||Et===void 0?void 0:Et.relatedMessageId){const ct=this.asyncMessageMap.get(At.messageOptions.relatedMessageId);const ut=At.messageOptions["isChunk"]===true;if(ct){if(!ut||ut&&At.body===ht){this.asyncMessageMap.delete(At.messageOptions.relatedMessageId)}ct(At.error?revertError(At.error):undefined,At.body,ut?At.body===ht:true)}else{}}else{(Ct=this.listener)===null||Ct===void 0?void 0:Ct.call(this,At);(Tt=this.eventListenerMap.get(dt.ListenerType.Subscribe))===null||Tt===void 0?void 0:Tt(At)}}else if(At.type===dt.MessageType.Inited){if(this.isMain()){if(At.error){this.debugLogger(`got worker ${At.workerId} ready failed`);this.eventListenerMap.get(dt.ListenerType.Error)(revertError(At.error))}else{(wt=this.eventListenerMap.get(dt.ListenerType.Inited))===null||wt===void 0?void 0:wt(At);this.workerReady.get(At.workerId).ready=true;this.debugLogger(`got worker ${At.workerId} ready`)}}else{}}}}}transit(ct){this.messageReceiver(ct)}subscribe(ct,ut={}){const pt=ut.topic||mt;if(!this.topicListener.has(pt)){this.topicListener.set(pt,new Set)}if(ut.subscribeOnce){ct["_subscribeOnce"]=true}this.topicListener.get(pt).add(ct);ct["_abortController"]={abort:()=>{this.topicListener.get(pt).delete(ct)}};if(this.topicMessageCache.has(pt)&&this.topicMessageCache.get(pt).size>0){for(const ct of this.topicMessageCache.get(pt)){this.listener(ct.message,ct.responder);if(ut.subscribeOnce){break}}this.topicMessageCache.get(pt).clear()}return ct["_abortController"]}subscribeOnce(ct,ut={}){ut.subscribeOnce=true;return this.subscribe(ct,ut)}publish(ct,ut={}){if(ct instanceof Error){this.transit({messageCategory:dt.MessageCategory.OUT,message:{messageId:ut.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?dt.MessageType.Request:dt.MessageType.Response,body:undefined,error:{name:ct.name,message:ct.message,stack:ct.stack},messageOptions:ut}})}else{this.transit({messageCategory:dt.MessageCategory.OUT,message:{messageId:ut.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?dt.MessageType.Request:dt.MessageType.Response,body:ct,messageOptions:ut}})}}publishAsync(ct,ut={}){return new Promise(((pt,ft)=>{const _t=ut.relatedMessageId||this.generateMessageId();this.useTimeout(_t,ut.timeout,pt,ft);this.transit({messageCategory:dt.MessageCategory.OUT,message:{messageId:_t,workerId:this.getWorkerId(),type:dt.MessageType.Invoke,body:ct,messageOptions:{topic:ut.topic,dispatchToken:ut.dispatchToken}}})}))}publishChunk(ct,ut={}){const pt=ut.relatedMessageId||this.generateMessageId();const ft=new ChunkIterator(this.debugLogger);this.useTimeout(pt,ut.timeout,((ct,ut)=>{ft.publish({data:ct,isEnd:ut})}),(ct=>{ft.error(ct)}));this.transit({messageCategory:dt.MessageCategory.OUT,message:{messageId:pt,workerId:this.getWorkerId(),type:this.isMain()?dt.MessageType.Invoke:dt.MessageType.Response,body:ct,messageOptions:{isChunk:true,topic:ut.topic}}});return ft}useTimeout(ct,ut=5e3,pt,dt){const ft=setTimeout((()=>{clearTimeout(ft);this.asyncMessageMap.delete(ct);dt(new _t.EventBusPublishTimeoutError(ct))}),ut);this.asyncMessageMap.set(ct,((ct,ut,_t)=>{if(_t||ct){clearTimeout(ft)}if(ct){dt(ct)}else{pt(ut,_t)}}))}broadcast(ct,ut={}){if(this.isWorker()){ut={includeMainFromWorker:false,includeSelfFromWorker:false,...ut}}this.transit({messageCategory:dt.MessageCategory.OUT,message:{messageId:ut.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:dt.MessageType.Broadcast,body:ct,messageOptions:ut}})}postMessage(ct){var ut,pt,ft,mt,ht,yt,vt,St;if(this.isMain()){if(this.workers.length>0){if(ct.type===dt.MessageType.Broadcast){if(ct.messageOptions&&ct.messageOptions["relatedWorkerId"]){this.workers.forEach((ut=>{if(ct.messageOptions["includeSelfFromWorker"]===false&&this.getWorkerId(ut)===ct.messageOptions["relatedWorkerId"]){return}else{this.mainSendMessage(ut,ct)}}))}else{this.workers.forEach((ut=>this.mainSendMessage(ut,ct)))}}else if((ut=ct.messageOptions)===null||ut===void 0?void 0:ut["targetWorkerId"]){const ut=(ft=this.workerReady.get((pt=ct.messageOptions)===null||pt===void 0?void 0:pt["targetWorkerId"]))===null||ft===void 0?void 0:ft.worker;if(!ut){throw new _t.EventBusPublishSpecifyWorkerError((mt=ct.messageOptions)===null||mt===void 0?void 0:mt["targetWorkerId"])}this.mainSendMessage(ut,ct)}else{if(this.options.dispatchStrategy){const ut=this.options.dispatchStrategy(this.workers,(ht=ct.messageOptions)===null||ht===void 0?void 0:ht.dispatchToken);if(ut){try{this.mainSendMessage(ut,ct)}catch(ut){(yt=this.eventListenerMap.get(dt.ListenerType.Error))===null||yt===void 0?void 0:yt(new _t.EventBusMainPostError(ct,ut))}}else{throw new _t.EventBusDispatchStrategyError}}else{const[ut,...pt]=this.workers;try{this.mainSendMessage(ut,ct)}catch(ut){(vt=this.eventListenerMap.get(dt.ListenerType.Error))===null||vt===void 0?void 0:vt(new _t.EventBusMainPostError(ct,ut))}this.workers=[...pt,ut]}}}}else{try{this.workerSendMessage(ct)}catch(ut){(St=this.eventListenerMap.get(dt.ListenerType.Error))===null||St===void 0?void 0:St(new _t.EventBusWorkerPostError(ct,ut))}}}onInited(ct){this.eventListenerMap.set(dt.ListenerType.Inited,ct)}onPublish(ct){this.eventListenerMap.set(dt.ListenerType.Request,ct)}onSubscribe(ct){this.eventListenerMap.set(dt.ListenerType.Subscribe,ct)}onError(ct){this.eventListenerMap.set(dt.ListenerType.Error,ct)}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)}}ut.AbstractEventBus=AbstractEventBus},4779:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ChildProcessEventBus=void 0;const dt=pt(73317);const ft=pt(29907);const _t=pt(932);class ChildProcessEventBus extends dt.AbstractEventBus{workerSubscribeMessage(ct){_t.on("message",ct)}workerListenMessage(ct,ut){ct.on("message",ut)}workerSendMessage(ct){_t.send(ct)}mainSendMessage(ct,ut){ct.send(ut)}isMain(){return!this.isWorker()}isWorker(){var ct;return(ct=this.options.isWorker)!==null&&ct!==void 0?ct:ft.isWorker}getWorkerId(ct){var ut;return String(ct?(ut=ct.pid)!==null&&ut!==void 0?ut:ct===null||ct===void 0?void 0:ct["process"].pid:_t.pid)}}ut.ChildProcessEventBus=ChildProcessEventBus},68108:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.EventBusDispatchStrategyError=ut.EventBusPublishSpecifyWorkerError=ut.EventBusWorkerPostError=ut.EventBusMainPostError=ut.EventBusTimeoutError=ut.EventBusPublishTimeoutError=void 0;const dt=pt(39023);class EventBusPublishTimeoutError extends Error{constructor(ct){super(`Message(${ct}) publish timeout.`);this.name="EventBusPublishTimeoutError"}}ut.EventBusPublishTimeoutError=EventBusPublishTimeoutError;class EventBusTimeoutError extends Error{constructor(){super("Waiting for ready timeout throws this error.");this.name="EventBusTimeoutError"}}ut.EventBusTimeoutError=EventBusTimeoutError;class EventBusMainPostError extends Error{constructor(ct,ut){super((0,dt.format)("Main thread post message [%j] error => %s.",ct,ut.stack));this.name="EventBusMainPostError"}}ut.EventBusMainPostError=EventBusMainPostError;class EventBusWorkerPostError extends Error{constructor(ct,ut){super((0,dt.format)("Worker post message [%j] error => %j.",ct,ut.stack));this.name="EventBusWorkerPostError"}}ut.EventBusWorkerPostError=EventBusWorkerPostError;class EventBusPublishSpecifyWorkerError extends Error{constructor(ct){super((0,dt.format)("Worker(%s) not find in ready map, maybe it is a wrong pid.",ct));this.name="EventBusPublishSpecifyWorkerError"}}ut.EventBusPublishSpecifyWorkerError=EventBusPublishSpecifyWorkerError;class EventBusDispatchStrategyError extends Error{constructor(){super("Dispatch strategy not found a worker and stop post.");this.name="EventBusDispatchStrategyError"}}ut.EventBusDispatchStrategyError=EventBusDispatchStrategyError},5982:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ft(pt(41836),ut);ft(pt(4779),ut);ft(pt(97633),ut);ft(pt(68108),ut);ft(pt(48001),ut)},48001:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MessageCategory=ut.ListenerType=ut.MessageType=void 0;var pt;(function(ct){ct["Inited"]="inited";ct["Request"]="request";ct["Response"]="response";ct["Invoke"]="invoke";ct["Broadcast"]="broadcast"})(pt=ut.MessageType||(ut.MessageType={}));var dt;(function(ct){ct["Inited"]="inited";ct["Request"]="request";ct["Subscribe"]="Subscribe";ct["WorkerChanged"]="worker_changed";ct["Error"]="error"})(dt=ut.ListenerType||(ut.ListenerType={}));var ft;(function(ct){ct["IN"]="in";ct["OUT"]="out"})(ft=ut.MessageCategory||(ut.MessageCategory={}))},97633:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.LocalEventBus=void 0;const dt=pt(73317);class LocalDispatcher{constructor(){this.pidIdx=0;this.initMessageQueue=[]}clear(){this.mainWorker=null;this.childWorker=null;this.pidIdx=0}generatePid(){return this.pidIdx++}}const ft=new LocalDispatcher;class LocalWorker{constructor(ct){this.pid=ct}onMessage(ct){this.handler=ct}on(){}getWorkerId(){return this.pid}terminate(){}}class LocalEventBus extends dt.AbstractEventBus{constructor(ct={}){super(ct);this.worker=new LocalWorker(ft.generatePid());if(this.isMain()){this.debugLogger(`Main id=${this.worker.getWorkerId()}`);ft.mainWorker=this.worker}else{this.debugLogger(`Child id=${this.worker.getWorkerId()}`);ft.childWorker=this.worker}}workerSubscribeMessage(ct){if(this.isWorker()){ft.childWorker.onMessage(ct)}}workerListenMessage(ct,ut){if(this.isMain()){ft.mainWorker.onMessage(ut)}}workerSendMessage(ct){if(ft.mainWorker.handler){ft.mainWorker.handler(ct)}else{ft.initMessageQueue.push({to:"main",message:ct})}}mainSendMessage(ct,ut){if(ft.childWorker.handler){ft.childWorker.handler(ut)}else{ft.initMessageQueue.push({to:"worker",message:ut})}}getWorkerId(ct){return String((ct||this.worker).getWorkerId())}isMain(){return!this.isWorker()}isWorker(){return this.options.isWorker}async start(ct){if(this.isMain()){await(0,dt.createWaitHandler)((()=>ft.childWorker!=null),{timeout:this.options.waitWorkerTimeout,timeoutCheckInterval:this.options.waitWorkerCheckInterval||200});this.addWorker(ft.childWorker);if(ft.initMessageQueue.length){ft.initMessageQueue.forEach((({to:ct,message:ut})=>{if(ct==="worker"){this.mainSendMessage(ft.childWorker,ut)}else{this.workerSendMessage(ut)}}));ft.initMessageQueue=[]}}await super.start(ct)}async stop(){ft.clear();await super.stop()}}ut.LocalEventBus=LocalEventBus},41836:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ThreadEventBus=void 0;const dt=pt(28167);const ft=pt(73317);class ThreadEventBus extends ft.AbstractEventBus{constructor(ct={}){super(ct);if(!this.options.encoder){this.options.encoder=ct=>ct}if(!this.options.decoder){this.options.decoder=ct=>ct}}workerSubscribeMessage(ct){dt.parentPort.on("message",(ut=>{ct(this.options.decoder(ut))}))}workerListenMessage(ct,ut){ct.on("message",(ct=>{ut(this.options.decoder(ct))}))}workerSendMessage(ct){dt.parentPort.postMessage(this.options.encoder(ct))}mainSendMessage(ct,ut){ct.postMessage(this.options.encoder(ut))}isMain(){return!this.isWorker()}isWorker(){var ct;return(ct=this.options.isWorker)!==null&&ct!==void 0?ct:!dt.isMainThread}getWorkerId(ct){return String(ct?ct.threadId:dt.threadId)}}ut.ThreadEventBus=ThreadEventBus},62525:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.run=void 0;const dt=pt(79896);const ft=pt(16928);const _t=pt(63268);const mt=pt(39023);const ht=pt(70857);const yt=(0,mt.debuglog)("midway:glob");function formatWindowsPath(ct){if(ht.platform()==="win32"&&ct){return ct.map((ct=>ct.split(ft.sep).join(ft.posix.sep)))}return ct}const run=(ct,ut={cwd:process.cwd(),ignore:[]})=>{yt(`midway glob pattern = ${ct}, options = ${JSON.stringify(ut)}`);const pt=Date.now();const mt=ut.cwd;ct=formatWindowsPath(ct)||[];yt(`after format pattern = ${ct}`);const ht=_t(ct,{ignore:formatWindowsPath(ut.ignore)||[]});const vt=_t("**",{ignore:formatWindowsPath(ut.ignore)||[]});function globDirectory(ct,ut,pt,_t){if(!(0,dt.existsSync)(ct)){return[]}const ht=(0,dt.readdirSync)(ct);const vt=[];for(let St of ht){const ht=(0,ft.resolve)(ct,St);yt(`resolvePath = ${ht}`);const bt=(0,dt.statSync)(ht);if(bt.isDirectory()&&pt(ht.replace(mt,""))){const ct=globDirectory(ht,ut,pt,_t);vt.push(...ct)}else if(bt.isFile()&&ut(ht.replace(mt,""))){vt.push(ht)}}return vt}const St=globDirectory(mt,ht,vt,ut);yt(`midway glob timing ${Date.now()-pt}ms`);return St};ut.run=run},18309:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.httpProxy=void 0;ut.httpProxy={enable:true}},94713:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.HttpProxyConfiguration=void 0;const _t=pt(46123);const mt=pt(18309);const ht=pt(25747);let yt=class HttpProxyConfiguration{async onReady(){if(this.httpProxy.enable){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((ct=>{ct.useMiddleware(ht.HttpProxyMiddleware)}))}}};dt([(0,_t.Inject)(),ft("design:type",_t.MidwayApplicationManager)],yt.prototype,"applicationManager",void 0);dt([(0,_t.Config)("httpProxy"),ft("design:type",Object)],yt.prototype,"httpProxy",void 0);yt=dt([(0,_t.Configuration)({namespace:"http-proxy",importConfigs:[{default:mt}]})],yt);ut.HttpProxyConfiguration=yt},62487:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=void 0;var _t=pt(94713);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.HttpProxyConfiguration}});ft(pt(93468),ut);ft(pt(25747),ut)},93468:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},25747:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.HttpProxyMiddleware=void 0;const _t=pt(46123);const mt=pt(12593);let ht=class HttpProxyMiddleware{resolve(ct){if(ct.getNamespace()==="express"){return async(ct,ut,pt)=>this.execProxy(ct,ct,ut,pt,false)}else{const ut=ct.getNamespace()==="faas";return async(ct,pt)=>{var dt;const ft=((dt=ct.request)===null||dt===void 0?void 0:dt.req)||ct.request;return this.execProxy(ct,ft,ct,pt,ut)}}}async execProxy(ct,ut,pt,dt,ft){var _t,ht,yt;const vt=this.getProxyList(ct.url);if(!vt){return dt()}const{proxy:St,url:bt}=vt;const xt={};for(const pt of Object.keys(ut.headers)){if(((_t=St.ignoreHeaders)===null||_t===void 0?void 0:_t[pt])||ct.header[pt]===undefined){continue}xt[pt.toLowerCase()]=ct.header[pt]}const $t=ut.headers["x-forwarded-for"];xt["x-forwarded-for"]=$t?`${$t}, ${ct.ip}`:ct.ip;xt["host"]=bt.host;delete xt["content-length"];const Et=ut.method.toUpperCase();const Ct=pt.res||pt;const Tt=!ft&&Ct.on&&Ct.writable;const wt={method:Et,url:bt.href,headers:xt,responseType:Tt?"stream":"arrayBuffer",timeout:this.httpProxy.proxyTimeout||0};if(Et==="POST"||Et==="PUT"){wt.data=(ht=ut.body)!==null&&ht!==void 0?ht:(yt=ct.request)===null||yt===void 0?void 0:yt.body;if(ut.headers["content-type"]==="application/x-www-form-urlencoded"&&typeof wt.data!=="string"){wt.data=Object.keys(wt.data).map((ct=>`${encodeURIComponent(ct)}=${encodeURIComponent(wt.data[ct])}`)).join("&")}}const At=await mt(wt).catch((ct=>{if(!ct||!ct.response){throw ct||new Error("proxy unknown error")}return ct.response}));pt.type=At.headers["content-type"];const kt={"transfer-encoding":true};if(Tt){kt["content-length"]=true}Object.keys(At.headers).forEach((ct=>{if(kt[ct.toLowerCase()]){return}pt.set(ct,At.headers[ct])}));pt.status=At.status;if(Tt){await new Promise((ct=>{Ct.on("finish",(()=>{if(Ct.end){Ct.end()}ct(void 0)}));At.data.pipe(Ct)}))}else{pt.body=At.data}}getProxyList(ct){if(!this.httpProxy){return}this.httpProxy.default=this.httpProxy.default||{};const ut=this.httpProxy.match?[this.httpProxy]:this.httpProxy.strategy?Object.values(this.httpProxy.strategy).map((ct=>Object.assign({},this.httpProxy.default,ct))):[];for(const pt of ut){if(!pt.match){continue}if(!pt.match.test(ct)){continue}if(pt.host){if(ct[0]==="/"){ct=pt.host+ct}const ut=new URL(ct);return{proxy:pt,url:ut}}else if(pt.target){const ut=ct.replace(pt.match,pt.target);return{proxy:pt,url:new URL(ut)}}}}static getName(){return"http-proxy"}};dt([(0,_t.Config)("httpProxy"),ft("design:type",Object)],ht.prototype,"httpProxy",void 0);dt([(0,_t.Logger)(),ft("design:type",Object)],ht.prototype,"logger",void 0);ht=dt([(0,_t.Middleware)()],ht);ut.HttpProxyMiddleware=ht},84845:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.i18n=void 0;const dt=pt(46123);ut.i18n={defaultLocale:"en_US",localeTable:{en_US:{}},fallbacks:{},writeCookie:true,resolver:{queryField:"locale",cookieField:{fieldName:"locale",cookieDomain:"",cookieMaxAge:dt.FORMAT.MS.ONE_YEAR}},localsField:"i18n",missingKeyHandler:ct=>ct}},30673:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.I18nConfiguration=void 0;const _t=pt(46123);const mt=pt(84845);const ht=pt(82027);let yt=class I18nConfiguration{async onReady(){this.applicationManager.getApplications(["koa","egg","faas","express"]).forEach((ct=>{ct.useMiddleware(ht.I18nMiddleware)}))}};dt([(0,_t.Inject)(),ft("design:type",_t.MidwayApplicationManager)],yt.prototype,"applicationManager",void 0);yt=dt([(0,_t.Configuration)({namespace:"i18n",importConfigs:[{default:mt}]})],yt);ut.I18nConfiguration=yt},35632:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayI18nService=ut.MidwayI18nServiceSingleton=void 0;const _t=pt(46123);const mt=pt(77460);const ht=pt(65675);const yt=pt(15578);let vt=class MidwayI18nServiceSingleton{constructor(){this.localeTextMap=new Map;this.fallbackMatch=[];this.localeMatchCache={}}async init(){this.defaultLocale=(0,yt.formatLocale)(this.i18nConfig.defaultLocale);for(const ct in this.i18nConfig.localeTable){this.addLocale(ct,getES6Object(this.i18nConfig.localeTable[ct]))}for(const ct in this.i18nConfig.fallbacks){this.fallbackMatch.push({pattern:ht((0,yt.formatLocale)(ct)),locale:(0,yt.formatLocale)(this.i18nConfig.fallbacks[ct])})}}addLocale(ct,ut){const pt=getMap(this.localeTextMap,ct,true);for(const ct in ut){if(typeof ut[ct]==="string"){getMap(pt,"default").set(ct,ut[ct])}else{for(const dt in ut[ct]){getMap(pt,ct).set(dt,ut[ct][dt])}}}}translate(ct,ut={}){var pt,dt,ft;const _t=(0,yt.formatLocale)((pt=ut.locale)!==null&&pt!==void 0?pt:this.defaultLocale);const mt=(dt=ut.args)!==null&&dt!==void 0?dt:[];const ht=(ft=ut.group)!==null&&ft!==void 0?ft:"default";let vt=this.getLocaleMappingText(_t,ct,ht,mt);if(!vt&&_t!==this.defaultLocale){if(this.fallbackMatch.length){const ut=this.fallbackMatch.find((ct=>{if(ct.pattern(_t)){return true}}));if(ut){vt=this.getLocaleMappingText(ut.locale,ct,ht,mt)}}if(!vt){vt=this.getLocaleMappingText(this.defaultLocale,ct,ht,mt)}}if(!vt&&this.i18nConfig.missingKeyHandler){vt=this.i18nConfig.missingKeyHandler(ct,ut)}return vt}getAvailableLocale(ct,ut="default"){ct=(0,yt.formatLocale)(ct);if(this.localeMatchCache[ct+"_"+ut]){return this.localeMatchCache[ct+"_"+ut]}if(this.localeTextMap.has(ct)&&this.localeTextMap.get(ct).has(ut)){this.localeMatchCache[ct+"_"+ut]=ct;return ct}if(this.fallbackMatch.length){const pt=this.fallbackMatch.find((pt=>{if(pt.pattern(ct)){if(this.localeTextMap.has(pt.locale)&&this.localeTextMap.get(pt.locale).has(ut)){this.localeMatchCache[ct+"_"+ut]=pt.locale;return true}}}));if(pt){return pt.locale}}this.localeMatchCache[ct+"_"+ut]=this.defaultLocale;return this.defaultLocale}hasAvailableLocale(ct){ct=(0,yt.formatLocale)(ct);if(this.localeTextMap.has(ct)){return true}if(this.fallbackMatch.length){const ut=this.fallbackMatch.find((ut=>{if(ut.pattern(ct)){if(this.localeTextMap.has(ut.locale)){return true}}}));if(ut){return true}}return false}getLocaleMapping(ct,ut="default"){ct=(0,yt.formatLocale)(ct);const pt=this.localeTextMap.get(ct);if(pt){return pt.get(ut)}}getDefaultLocale(){return this.defaultLocale}getLocaleMappingText(ct,ut,pt,dt){const ft=this.localeTextMap.get(ct);if(ft){const ct=ft.get(pt);if(ct){const pt=ct.get(ut);if(pt){return formatText(pt,dt)}}}}};dt([(0,_t.Config)("i18n"),ft("design:type",Object)],vt.prototype,"i18nConfig",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],vt.prototype,"init",null);vt=dt([(0,_t.Provide)(),(0,_t.Scope)(_t.ScopeEnum.Singleton)],vt);ut.MidwayI18nServiceSingleton=vt;let St=class MidwayI18nService{translate(ct,ut={}){if(!ut.locale){ut.locale=this.ctx.getAttr&&this.ctx.getAttr(mt.I18N_ATTR_KEY)}return this.i18nServiceSingleton.translate(ct,ut)}addLocale(ct,ut){this.i18nServiceSingleton.addLocale(ct,ut)}getLocaleMapping(ct,ut="default"){return this.i18nServiceSingleton.getLocaleMapping(ct,ut)}getDefaultLocale(){return this.i18nServiceSingleton.getDefaultLocale()}saveRequestLocale(ct){var ut,pt;if(ct){(ut=this.ctx)===null||ut===void 0?void 0:ut.setAttr(mt.I18N_ATTR_KEY,(0,yt.formatLocale)(ct))}else{(pt=this.ctx)===null||pt===void 0?void 0:pt.setAttr(mt.I18N_ATTR_KEY,(0,yt.formatLocale)(this.getDefaultLocale()))}}getAvailableLocale(ct,ut="default"){return this.i18nServiceSingleton.getAvailableLocale(ct,ut)}hasAvailableLocale(ct){return this.i18nServiceSingleton.hasAvailableLocale(ct)}};dt([(0,_t.Inject)(),ft("design:type",vt)],St.prototype,"i18nServiceSingleton",void 0);dt([(0,_t.Inject)(),ft("design:type",Object)],St.prototype,"ctx",void 0);St=dt([(0,_t.Provide)()],St);ut.MidwayI18nService=St;function formatText(ct,ut){if(Array.isArray(ut)){return(0,yt.formatWithArray)(ct,ut)}else{return(0,yt.formatWithObject)(ct,ut)}}function getES6Object(ct){for(const ut in ct){if(ct[ut]["default"]&&Object.keys(ct[ut]).length===1){ct[ut]=ct[ut].default}}return ct}function getMap(ct,ut,pt=false){ut=pt?(0,yt.formatLocale)(ut):ut;if(!ct.has(ut)){ct.set(ut,new Map)}return ct.get(ut)}},68255:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.formatLocale=ut.Configuration=void 0;var _t=pt(30673);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.I18nConfiguration}});ft(pt(35632),ut);ft(pt(82027),ut);ft(pt(77460),ut);var mt=pt(15578);Object.defineProperty(ut,"formatLocale",{enumerable:true,get:function(){return mt.formatLocale}})},77460:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.I18N_ATTR_KEY=void 0;ut.I18N_ATTR_KEY="i18n:locale"},82027:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.I18nMiddleware=ut.I18nFilter=void 0;const _t=pt(46123);const mt=pt(77460);const ht=pt(35632);const yt=pt(15578);let vt=class I18nFilter{match(ct,ut,pt){const dt=ut.getAttr(mt.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&dt&&this.resolverConfig.cookieField){const ct={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain};pt.cookie(this.resolverConfig.cookieField.fieldName,dt,ct)}}return ct}};dt([(0,_t.Config)("i18n.resolver"),ft("design:type",Object)],vt.prototype,"resolverConfig",void 0);dt([(0,_t.Config)("i18n"),ft("design:type",Object)],vt.prototype,"i18nConfig",void 0);vt=dt([(0,_t.Match)()],vt);ut.I18nFilter=vt;let St=class I18nMiddleware{resolve(ct){if(ct.getFrameworkType()===_t.MidwayFrameworkType.WEB_EXPRESS){ct.useFilter(vt);return async(ct,ut,pt)=>{const dt=await ct.requestContext.getAsync(ht.MidwayI18nService);let ft;if(this.resolverConfig){ft=ct.query[this.resolverConfig.queryField]||ct.cookies[this.resolverConfig.cookieField.fieldName];if(!ft){let ut=ct.acceptsLanguages();if(ut){if(Array.isArray(ut)){if(ut[0]==="*"){ut=ut.slice(1)}if(ut.length>0){for(let ct=0;ct<ut.length;ct++){const pt=(0,yt.formatLocale)(ut[ct]);if(dt.hasAvailableLocale(pt)){ft=pt;break}}}}else{ft=ut}}}}if(ft){dt.saveRequestLocale(ft)}else{dt.saveRequestLocale()}ut.locals[this.i18nConfig.localsField]=(ct,ut)=>dt.translate(ct,{args:ut});return pt()}}else{return async(ct,ut)=>{if(this.resolverConfig){let ut=ct.query[this.resolverConfig.queryField]||ct.cookies.get(this.resolverConfig.cookieField.fieldName,{signed:false});const pt=await ct.requestContext.getAsync(ht.MidwayI18nService);if(!ut){let dt=ct.acceptsLanguages();if(dt){if(Array.isArray(dt)){if(dt[0]==="*"){dt=dt.slice(1)}if(dt.length>0){for(let ct=0;ct<dt.length;ct++){const ft=(0,yt.formatLocale)(dt[ct]);if(pt.hasAvailableLocale(ft)){ut=ft;break}}}}else{ut=dt}}}if(ut){pt.saveRequestLocale(ut)}else{pt.saveRequestLocale()}if(ct.locals){ct.locals[this.i18nConfig.localsField]=(ct,ut)=>pt.translate(ct,{args:ut})}}await ut();const pt=ct.getAttr(mt.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&pt&&this.resolverConfig.cookieField){const ut={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain,overwrite:true};ct.cookies.set(this.resolverConfig.cookieField.fieldName,pt,ut)}}}}}static getName(){return"i18n"}};dt([(0,_t.Config)("i18n.resolver"),ft("design:type",Object)],St.prototype,"resolverConfig",void 0);dt([(0,_t.Config)("i18n"),ft("design:type",Object)],St.prototype,"i18nConfig",void 0);St=dt([(0,_t.Middleware)()],St);ut.I18nMiddleware=St},15578:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.formatLocale=ut.formatWithObject=ut.formatWithArray=void 0;const pt=/\{(\d+)\}/g;function formatWithArray(ct,ut){return ct.replace(pt,((ct,pt)=>{const dt=parseInt(pt);if(dt<ut.length){return ut[dt]}return ct}))}ut.formatWithArray=formatWithArray;const dt=/\{(.+?)\}/g;function formatWithObject(ct,ut){return ct.replace(dt,((ct,pt)=>{const dt=ut[pt];if(dt){return dt}return ct}))}ut.formatWithObject=formatWithObject;function formatLocale(ct){return ct.replace("_","-").toLowerCase()}ut.formatLocale=formatLocale},87370:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.info=void 0;const dt=pt(772);ut.info={title:"Midway Info",infoPath:"/_info",hiddenKey:dt.DefaultHiddenKey,ignoreKey:[]}},47265:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.InfoConfiguration=void 0;const _t=pt(46123);const mt=pt(82934);const ht=pt(87370);let yt=class InfoConfiguration{async onReady(){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((ct=>{ct.useMiddleware(mt.InfoMiddleware)}))}};dt([(0,_t.Inject)(),ft("design:type",_t.MidwayApplicationManager)],yt.prototype,"applicationManager",void 0);yt=dt([(0,_t.Configuration)({namespace:"info",importConfigs:[{default:ht}]})],yt);ut.InfoConfiguration=yt},65295:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=void 0;var _t=pt(47265);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.InfoConfiguration}});ft(pt(44120),ut);ft(pt(82934),ut);ft(pt(772),ut)},44120:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.InfoService=void 0;const _t=pt(46123);const mt=pt(46123);const ht=pt(772);const yt=pt(6730);const vt=pt(70857);const St=pt(16928);const bt=pt(65675);let xt=class InfoService{async init(){this.secretMatchList=Array.from(new Set(this.defaultHiddenKey)).map((ct=>bt(ct)))}info(ct){const ut=[];ut.push(this.projectInfo());ut.push(this.systemInfo());ut.push(this.resourceOccupationInfo());ut.push(this.softwareInfo());ut.push(this.midwayConfig());ut.push(this.midwayService());ut.push(this.timeInfo());ut.push(this.envInfo());ut.push(this.dependenciesInfo());ut.push(this.networkInfo());const pt=ut.map((({type:ct,info:ut})=>{const pt=Object.keys(ut);const dt=pt.filter((ct=>!this.ignoreKey.includes(ct)));const ft={};for(const ct of dt){ft[ct]=ut[ct]}return{type:ct,info:ft}}));if(ct==="html"){return(0,yt.renderToHtml)(pt,this.titleConfig)}return pt}projectInfo(){return{type:ht.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 ct=process.platform;return{type:ht.InfoType.SYSTEM,info:{Platform:ct==="win32"?"Windows":ct,Node:process.versions.node,V8:process.versions.v8,ProcessId:process.pid,Arch:process.arch,Hostname:(0,vt.hostname)(),HomeDir:(0,vt.homedir)(),CWD:process.cwd(),ExecCommand:[].concat(process.argv,process.execArgv).join(" ")}}}resourceOccupationInfo(){const ct=process.memoryUsage();const ut=(0,vt.cpus)();return{type:ht.InfoType.MEMORY_CPU,info:{"Memory Total Occupy":(0,yt.bitToMB)(ct.rss),"Heap Total Occupy":(0,yt.bitToMB)(ct.heapTotal),"Heap Used":(0,yt.bitToMB)(ct.heapUsed),"V8 C++ Object Memory":(0,yt.bitToMB)(ct.external),"System Total Memory":(0,yt.bitToMB)((0,vt.totalmem)()),CPU:`${ut[0]?`${ut[0].model} ${ut[0].speed}MHz`:""} ${ut.length} core `,"CPU Usage":ut.map((ct=>{const ut=ct.times;return((1-ut.idle/(ut.idle+ut.user+ut.nice+ut.sys+ut.irq))*100).toFixed(2)+"%"})).join(" / ")}}}softwareInfo(){const ct=["@midwayjs/core","@midwayjs/decorator","@midwayjs/faas"];const ut={};for(const pt of ct){const ct=this.midwayInformationService.getPkg();if(ct){ut[pt]=ct.version}}return{type:ht.InfoType.SOFTWARE,info:ut}}envInfo(){const ct={};Object.keys(process.env).forEach((ut=>{ct[ut]=this.filterSecretContent(ut,process.env[ut])}));return{type:ht.InfoType.ENVIRONMENT_VARIABLE,info:ct}}timeInfo(){const ct=(new Date).toString().split(" ");return{type:ht.InfoType.TIME,info:{Current:Date.now(),Uptime:(0,vt.uptime)(),Timezone:ct.length>=7?ct[5]:"",TimezoneName:ct.length>=7?ct.slice(6).join(" ").replace(/\(/g,"").replace(/\)/g,""):""}}}networkInfo(){const ct=(0,vt.networkInterfaces)();const ut={};Object.keys(ct).forEach((pt=>{const dt=ct[pt];let ft=pt;if(pt[pt.length-1]==="0"){ft=pt.slice(0,-1)}if(ft==="lo"){return}ut[ft]=dt.sort((ct=>{if(ct.family==="IPv4"){return-1}return 1})).map((ct=>`${ct.family} ${ct.address}`)).join(" / ")}));return{type:ht.InfoType.NETWORK,info:ut}}dependenciesInfo(){const ct=this.midwayInformationService.getPkg();const ut=ct.dependencies||{};const pt={};Object.keys(ut).forEach((ct=>{const dt=(0,yt.safeRequire)((0,St.join)(ct,"package.json"),{});pt[ct]=`${dt.version||"Not Found"}(${ut[ct]})`}));return{type:ht.InfoType.DEPENDENCIES,info:pt}}midwayService(){var ct;const ut={};if((ct=this.container)===null||ct===void 0?void 0:ct.registry){for(const ct of this.container.registry){const[pt,dt]=ct;const ft=dt?(dt===null||dt===void 0?void 0:dt.name)||dt:typeof dt;ut[pt]=`${(dt===null||dt===void 0?void 0:dt.namespace)?`${dt===null||dt===void 0?void 0:dt.namespace}:`:""}${ft}${(dt===null||dt===void 0?void 0:dt.scope)?` [${dt===null||dt===void 0?void 0:dt.scope}]`:""}`}}return{type:ht.InfoType.MIDWAY_SERVICE,info:ut}}midwayConfig(){const ct={};const ut=this.configService.getConfiguration()||{};Object.keys(ut).forEach((pt=>{ct[pt]=this.safeJson(this.filterSecretContent(pt,ut[pt]))}));return{type:ht.InfoType.MIDWAY_CONFIG,info:ct}}filterSecretContent(ct,ut){if(typeof ut==="string"){const pt=this.secretMatchList.some((ut=>ut(ct.toLowerCase())));if(pt){return(0,yt.safeContent)(ut)}}else if(Array.isArray(ut)){return ut.map((ut=>this.filterSecretContent(ct,ut)))}return ut}safeJson(ct){switch(typeof ct){case"string":return`"${ct}"`;case"number":return`${ct}`;case"boolean":return String(ct);case"object":if(!ct){return"null"}if(Array.isArray(ct)){return`[${ct.map((ct=>this.safeJson(ct))).join(",")}]`}if(ct instanceof RegExp){return`"${ct.toString()}"`}const ut=[];for(const pt in ct){ut.push(`"${pt}":${this.safeJson(this.filterSecretContent(pt,ct[pt]))}`)}return`{${ut.join(",")}}`;case"function":return`function ${ct.name}(${ct.length} args)`}return""}};dt([(0,_t.Inject)(),ft("design:type",mt.MidwayInformationService)],xt.prototype,"midwayInformationService",void 0);dt([(0,_t.Inject)(),ft("design:type",mt.MidwayConfigService)],xt.prototype,"configService",void 0);dt([(0,_t.Inject)(),ft("design:type",mt.MidwayEnvironmentService)],xt.prototype,"environment",void 0);dt([(0,_t.Config)("info.title"),ft("design:type",String)],xt.prototype,"titleConfig",void 0);dt([(0,_t.Config)("info.hiddenKey"),ft("design:type",Array)],xt.prototype,"defaultHiddenKey",void 0);dt([(0,_t.Config)("info.ignoreKey"),ft("design:type",Array)],xt.prototype,"ignoreKey",void 0);dt([(0,_t.ApplicationContext)(),ft("design:type",Object)],xt.prototype,"container",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],xt.prototype,"init",null);xt=dt([(0,_t.Provide)(),(0,_t.Scope)(_t.ScopeEnum.Singleton)],xt);ut.InfoService=xt},772:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.InfoType=ut.DefaultHiddenKey=void 0;ut.DefaultHiddenKey=["keys","*key","*token","*secret*","pass*"];var pt;(function(ct){ct["PROJECT"]="Project";ct["SYSTEM"]="System";ct["MEMORY_CPU"]="Memory & CPU";ct["SOFTWARE"]="Software";ct["ENVIRONMENT_VARIABLE"]="Environment Variable";ct["TIME"]="Time";ct["NETWORK"]="Network";ct["RESOURCE"]="Resource";ct["DEPENDENCIES"]="Dependencies";ct["MIDWAY_SERVICE"]="Midway Service";ct["MIDWAY_CONFIG"]="Midway Config"})(pt=ut.InfoType||(ut.InfoType={}))},82934:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.InfoMiddleware=void 0;const _t=pt(46123);const mt=pt(44120);let ht=class InfoMiddleware{resolve(ct){if(ct.getFrameworkType()===_t.MidwayFrameworkType.WEB_EXPRESS){return async(ct,ut,pt)=>{if(ct.path===this.infoPath){ut.type("html");ut.send(this.infoService.info("html"))}else{pt()}}}else{return async(ct,ut)=>{if(ct.path===this.infoPath){return this.infoService.info("html")}return await ut()}}}static getName(){return"info"}};dt([(0,_t.Config)("info.infoPath"),ft("design:type",String)],ht.prototype,"infoPath",void 0);dt([(0,_t.Inject)(),ft("design:type",mt.InfoService)],ht.prototype,"infoService",void 0);ht=dt([(0,_t.Middleware)()],ht);ut.InfoMiddleware=ht},6730:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.safeContent=ut.renderToHtml=ut.bitToMB=ut.safeRequire=void 0;const dt=pt(79896);function safeRequire(ct,ut){try{if(!(0,dt.existsSync)(ct)){return ut}return JSON.parse((0,dt.readFileSync)(ct,"utf8"))}catch(ct){return ut}}ut.safeRequire=safeRequire;function bitToMB(ct){return Number((ct||0)/1024/1024).toFixed(2)+" MB"}ut.bitToMB=bitToMB;function renderToHtml(ct,ut){let pt=`<div style="padding: 24px; font-size: 36px;background: #9999cb;font-weight: bold;">${ut}</div>`;pt+=ct.map((ct=>{const ut=Object.keys(ct.info||{});return`<div class="infoType">${ct.type}</div>\n <table style="border-collapse: collapse;width: 100%;">${ut.map((ut=>`<tr style="border: 1px solid #666;"><td class="infoName">${ut}</td><td class="infoValue">${ct.info[ut]}</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;">${pt}</div>`}ut.renderToHtml=renderToHtml;function safeContent(ct=""){if(ct.length<3){return"*".repeat(ct.length)}else if(ct.length<6){return ct[0]+"*".repeat(ct.length-1)}else if(ct.length<10){return ct[0]+"*".repeat(ct.length-2)+ct[ct.length-1]}else if(ct.length<15){return ct.slice(0,2)+"*".repeat(ct.length-4)+ct.slice(-2)}else{return ct.slice(0,3)+"*".repeat(ct.length-6)+ct.slice(-3)}}ut.safeContent=safeContent},89619:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.siteFile=ut.bodyParser=ut.onerror=ut.cookiesExtra=ut.cookies=ut.keys=ut.koa=void 0;ut.koa={contextLoggerFormat:ct=>{var ut,pt,dt;const ft=ct.ctx;const _t=ft.userId||"-";const mt=(dt=(ut=ft.traceId)!==null&&ut!==void 0?ut:(pt=ft.tracer)===null||pt===void 0?void 0:pt.traceId)!==null&&dt!==void 0?dt:"-";const ht=Date.now()-ft.startTime;const yt=_t+"/"+ft.ip+"/"+mt+"/"+ht+"ms "+ft.method+" "+ft.url;return`${ct.timestamp} ${ct.LEVEL} ${ct.pid} [${yt}] ${ct.message}`},serverTimeout:2*60*1e3};ut.keys="";ut.cookies={};ut.cookiesExtra={defaultGetOptions:{}};ut.onerror={};ut.bodyParser={enable:true,encoding:"utf8",formLimit:"1mb",jsonLimit:"1mb",textLimit:"1mb",strict:true,queryString:{arrayLimit:100,depth:5,parameterLimit:1e3},onerror(ct){ct.message+=", check bodyParser config";throw ct}};ut.siteFile={enable:true,favicon:undefined}},9867:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.KoaConfiguration=void 0;const _t=pt(46123);const mt=pt(65579);const ht=pt(62229);const yt=pt(89619);const vt=pt(18713);const St=pt(67241);let bt=class KoaConfiguration{init(){this.decoratorService.registerParameterHandler(_t.WEB_ROUTER_PARAM_KEY,(ct=>(0,_t.extractKoaLikeValue)(ct.metadata.type,ct.metadata.propertyData,ct.originParamType)(ct.originArgs[0],ct.originArgs[1])))}async onReady(){this.koaFramework.useMiddleware([St.SiteFileMiddleware,vt.BodyParserMiddleware])}};dt([(0,_t.Inject)(),ft("design:type",_t.MidwayDecoratorService)],bt.prototype,"decoratorService",void 0);dt([(0,_t.Inject)(),ft("design:type",ht.MidwayKoaFramework)],bt.prototype,"koaFramework",void 0);dt([(0,_t.Inject)(),ft("design:type",_t.MidwayConfigService)],bt.prototype,"configService",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",void 0)],bt.prototype,"init",null);bt=dt([(0,_t.Configuration)({namespace:"koa",imports:[mt],importConfigs:[{default:yt}]})],bt);ut.KoaConfiguration=bt},62229:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayKoaFramework=void 0;const ft=pt(46123);const _t=pt(60990);const mt=pt(53777);const ht=pt(10800);const yt=pt(81236);const vt=pt(69502);const St=pt(83480);const bt=pt(72040);const xt=Symbol("context#cookies");class KoaControllerGenerator extends ft.WebControllerGenerator{constructor(ct,ut){super(ct,ut);this.app=ct;this.webRouterService=ut}createRouter(ct){const ut=new mt(ct);ut.prefix(ct.prefix);return ut}generateController(ct){return this.generateKoaController(ct)}}let $t=class MidwayKoaFramework extends ft.BaseFramework{configure(){return this.configService.getConfiguration("koa")}async applicationInitialize(ct){const ut=this.configService.getConfiguration("keys")||this.configurationOptions["keys"];if(!ut){throw new ft.MidwayConfigMissingError("config.keys")}const pt=this.configService.getConfiguration("cookies");const dt=this.configService.getConfiguration("cookiesExtra.defaultGetOptions");this.app=new ht({keys:[].concat(ut),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[xt]){this[xt]=new _t.Cookies(this,this.app.keys,pt,dt)}return this[xt]},enumerable:true});Object.defineProperty(this.app.context,"locals",{get(){return this.state},set(ct){this.state=ct}});Object.defineProperty(this.app.context,"forward",{get(){return async function(ct){const ut=this.requestContext.get(ft.MidwayWebRouterService);const pt=await ut.getMatchedRouterInfo(ct,this.method);if(pt){if(pt.controllerClz){const ct=await this.requestContext.getAsync(pt.controllerClz);return ct[pt.method](this)}else if(typeof pt.method==="function"){return pt.method(this)}}else{throw new ft.httpError.NotFoundError(`Forward url ${ct} Not Found`)}}}});const mt=this.configurationOptions.queryParseMode==="strict"?function(ct){return!Array.isArray(ct)?[ct]:ct}:this.configurationOptions.queryParseMode==="first"?function(ct){return Array.isArray(ct)?ct[0]:ct}:undefined;const bt=this;Object.defineProperty(this.app.request,"query",{get(){const ct=this.querystring;const ut=this._querycache=this._querycache||{};if(ut[ct])return ut[ct];if(bt.configurationOptions.queryParseMode){ut[ct]=vt.parse(ct,bt.configurationOptions.queryParseOptions||{})}else{ut[ct]=St.parse(ct)}if(mt){for(const pt in ut[ct]){ut[ct][pt]=mt(ut[ct][pt])}}return ut[ct]},set(ct){this._querycache=this._querycache||{};this._querycache[this.querystring]=ct}});const $t=this.configService.getConfiguration("onerror");(0,yt.setupOnError)(this.app,$t,this.logger);const notFound=async(ct,ut)=>{await ut();if(!ct._matchedRoute&&ct.body===undefined){throw new ft.httpError.NotFoundError(`${ct.path} Not Found`)}};const midwayRootMiddleware=async(ct,ut)=>{this.app.createAnonymousContext(ct);await(await this.applyMiddleware(notFound))(ct,ut);if(ct.body===undefined&&!ct.response._explicitStatus&&ct._matchedRoute){ct.body=undefined}};this.app.use(midwayRootMiddleware);this.webRouterService=await this.applicationContext.getAsync(ft.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((ct=>{var ut;const pt=ct.middleware();pt._name=`midwayController(${((ut=ct===null||ct===void 0?void 0:ct.opts)===null||ut===void 0?void 0:ut.prefix)||"/"})`;this.app.use(pt)}))}generateController(ct){return this.generator.generateKoaController(ct)}async generateMiddleware(ct){const ut=await this.getApplicationContext().getAsync(ct);return ut.resolve()}async run(){await this.loadMidwayController();this.app.use=this.app.originUse;const ct={...this.configurationOptions,...this.configurationOptions.serverOptions};if(ct.key&&ct.cert){ct.key=ft.PathFileUtil.getFileContentSync(ct.key);ct.cert=ft.PathFileUtil.getFileContentSync(ct.cert);ct.ca=ft.PathFileUtil.getFileContentSync(ct.ca);process.env.MIDWAY_HTTP_SSL="true";if(ct.http2){this.server=pt(85675).createSecureServer(ct,this.app.callback())}else{this.server=pt(65692).createServer(ct,this.app.callback())}}else{if(ct.http2){this.server=pt(85675).createServer(ct,this.app.callback())}else{this.server=pt(58611).createServer(ct,this.app.callback())}}this.applicationContext.registerObject(ft.HTTP_SERVER_KEY,this.server);if(ft.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 ut=process.env.MIDWAY_HTTP_PORT||this.configurationOptions.listenOptions.port;if(ut===0||ut==="0"){ut=await(0,bt.getFreePort)();this.logger.info(`Midway koa is listening on port ${ut} (auto assigned)`)}this.configurationOptions.listenOptions.port=Number(ut);if(this.configurationOptions.listenOptions.port){new Promise((ct=>{this.server.listen(this.configurationOptions.listenOptions,(()=>{ct()}));process.env.MIDWAY_HTTP_PORT=String(this.configurationOptions.listenOptions.port)}))}}async beforeStop(){if(this.server){new Promise((ct=>{this.server.close(ct);process.env.MIDWAY_HTTP_PORT=""}))}}getFrameworkType(){return ft.MidwayFrameworkType.WEB_KOA}getFrameworkName(){return"web:koa"}getServer(){return this.server}getPort(){return process.env.MIDWAY_HTTP_PORT}useMiddleware(ct){this.middlewareManager.insertLast(ct)}useFilter(ct){this.filterManager.useFilter(ct)}};$t=dt([(0,ft.Framework)()],$t);ut.MidwayKoaFramework=$t},47453:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=ut.Framework=void 0;var _t=pt(62229);Object.defineProperty(ut,"Framework",{enumerable:true,get:function(){return _t.MidwayKoaFramework}});ft(pt(77678),ut);var mt=pt(9867);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return mt.KoaConfiguration}});ft(pt(67241),ut);ft(pt(18713),ut)},77678:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},18713:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.BodyParserMiddleware=void 0;const _t=pt(36952);const mt=pt(46123);let ht=class BodyParserMiddleware{resolve(){if(this.bodyparserConfig.enable){return _t(this.bodyparserConfig)}}static getName(){return"bodyParser"}};dt([(0,mt.Config)("bodyParser"),ft("design:type",Object)],ht.prototype,"bodyparserConfig",void 0);ht=dt([(0,mt.Middleware)()],ht);ut.BodyParserMiddleware=ht},67241:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SiteFileMiddleware=void 0;const _t=pt(46123);const mt=pt(16928);const ht="public, max-age=2592000";let yt=class SiteFileMiddleware{resolve(){if(this.siteFileConfig.enable){return async(ct,ut)=>{if(ct.method!=="HEAD"&&ct.method!=="GET")return ut();if(ct.path[0]!=="/")return ut();if(ct.path!=="/favicon.ico"){return ut()}let pt=this.siteFileConfig["favicon"];if(pt===undefined){pt=Buffer.from("")}if(!pt)return ut();if(typeof pt==="string")return ct.redirect(pt);if(Buffer.isBuffer(pt)){ct.set("cache-control",ht);ct.body=pt;ct.type=mt.extname(ct.path);return}return ut()}}}static getName(){return"siteFile"}};dt([(0,_t.Config)("siteFile"),ft("design:type",Object)],yt.prototype,"siteFileConfig",void 0);yt=dt([(0,_t.Middleware)()],yt);ut.SiteFileMiddleware=yt},81236:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.setupOnError=void 0;const dt=pt(58611);const ft=pt(72040);const _t=pt(46123);function setupOnError(ct,ut,pt){const mt=Object.assign({accepts(){const ct=ut.accepts||ft.accepts;return ct(this)},text(ut,pt){pt.res._headers={};pt.set(ut.headers);if((0,ft.isProduction)(ct)){pt.body=dt.STATUS_CODES[pt.status]}else{pt.body=ut.message}},html(ut,pt){const _t=(0,ft.detectStatus)(ut);if((0,ft.isProduction)(ct)){if(_t>=500){pt.status=500;pt.body=`<h2>Internal Server Error, real status: ${_t}</h2>`;return}else{pt.status=_t;pt.body=`<h2>${_t} ${dt.STATUS_CODES[_t]}</h2>`;return}}if(ct.getEnv()==="unittest"||ct.getEnv()==="test"){pt.status=_t;pt.body=`${ut.name}: ${ut.message}\n${ut.stack}`;return}pt.body=ft.tpl.replace("{{status}}",(0,ft.escapeHtml)(ut.status)).replace("{{errorCode}}",(0,ft.escapeHtml)(ut.code)).replace("{{stack}}",(0,ft.escapeHtml)(ut.stack));pt.type="html"},json(ut,pt){const _t=(0,ft.detectStatus)(ut);const mt=ut.code||ut.type;if((0,ft.isProduction)(ct)){if(_t>=500){pt.body={code:mt,message:dt.STATUS_CODES[_t]}}else{pt.body={code:mt,message:ut.message}}}else{pt.body={code:mt,message:ut.message,stack:ut.stack}}}},ut);ct.on("error",((ut,dt)=>{dt=dt||ct.createAnonymousContext();const _t=(0,ft.detectStatus)(ut);if(_t>=500){try{dt.logger.error(ut)}catch(ct){pt.error(ut);pt.error(ct)}return}try{dt.logger.warn(ut)}catch(ct){pt.warn(ut);pt.error(ct)}}));ct.context.onerror=function(ut){if(ut==null)return;if(this.req)(0,ft.sendToWormhole)(this.req);if(!(ut instanceof Error)){let ct=ut;if(typeof ut==="object"){try{ct=_t.Utils.safeStringify(ut)}catch(ct){}}const pt=new Error("non-error thrown: "+ct);if(ut){if(ut.name)pt.name=ut.name;if(ut.message)pt.message=ut.message;if(ut.stack)pt.stack=ut.stack;if(ut.status)pt["status"]=ut.status;if(ut.headers)pt["headers"]=ut.headers}ut=pt}const pt=this.headerSent||!this.writable;if(pt)ut.headerSent=true;ct.emit("error",ut,this);if(pt)return;if(ut.code==="ENOENT")ut.status=404;if(typeof ut.status!=="number"||!dt.STATUS_CODES[ut.status]){ut.status=500}this.status=ut.status;this.set(ut.headers);let ht="text";if(mt.accepts){ht=mt.accepts.call(this,"html","text","json")}else{ht=this.accepts("html","text","json")}ht=ht||"text";if(mt.all){mt.all.call(this,ut,this)}else{if(mt.redirect&&ht!=="json"){this.redirect(mt.redirect)}else{mt[ht].call(this,ut,this);this.type=ht}}if(ht==="json"){this.body=JSON.stringify(this.body)}this.res.end(this.body)}}ut.setupOnError=setupOnError},72040:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.getFreePort=ut.escapeHtml=ut.tpl=ut.isProduction=ut.sendToWormhole=ut.accepts=ut.detectStatus=void 0;const dt=pt(69278);function detectStatus(ct){let ut=ct.status||500;if(ut<200){ut=500}return ut}ut.detectStatus=detectStatus;function accepts(ct){if(acceptJSON(ct))return"json";return"html"}ut.accepts=accepts;function acceptJSON(ct){if(ct.path.endsWith(".json"))return true;if(ct.response.type&&ct.response.type.indexOf("json")>=0)return true;if(ct.accepts("html","text","json")==="json")return true;return false}function sendToWormhole(ct){return new Promise((ut=>{if(typeof ct.resume!=="function"){return ut()}ct.unpipe&&ct.unpipe();ct.resume();if(ct._readableState&&ct._readableState.ended){return ut()}if(!ct.readable||ct.destroyed){return ut()}function cleanup(){ct.removeListener("end",onEnd);ct.removeListener("close",onEnd);ct.removeListener("error",onError)}function onEnd(){cleanup();ut()}function onError(){cleanup();ut()}ct.on("end",onEnd);ct.on("close",onEnd);ct.on("error",onError)}))}ut.sendToWormhole=sendToWormhole;function isProduction(ct){return ct.getEnv()!=="local"&&ct.getEnv()!=="unittest"}ut.isProduction=isProduction;ut.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 ft=/["'&<>]/;function escapeHtml(ct){const ut=""+ct;const pt=ft.exec(ut);if(!pt){return ut}let dt;let _t="";let mt=0;let ht=0;for(mt=pt.index;mt<ut.length;mt++){switch(ut.charCodeAt(mt)){case 34:dt="&quot;";break;case 38:dt="&amp;";break;case 39:dt="&#39;";break;case 60:dt="&lt;";break;case 62:dt="&gt;";break;default:continue}if(ht!==mt){_t+=ut.substring(ht,mt)}ht=mt+1;_t+=dt}return ht!==mt?_t+ut.substring(ht,mt):_t}ut.escapeHtml=escapeHtml;async function getFreePort(){return new Promise(((ct,ut)=>{const pt=(0,dt.createServer)();pt.listen(0,(()=>{try{const ut=pt.address().port;pt.close();ct(ut)}catch(ct){ut(ct)}}))}))}ut.getFreePort=getFreePort},28520:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.LEVEL=ut.DefaultLogLevels=void 0;ut.DefaultLogLevels={none:0,error:1,trace:2,warn:3,info:4,verbose:5,debug:6,silly:7,all:8};ut.LEVEL={none:"NONE",error:"ERROR",trace:"TRACE",warn:"WARN",info:"INFO",verbose:"VERBOSE",debug:"DEBUG",silly:"SILLY",all:"ALL"}},62379:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.LoggerFactory=void 0;const dt=pt(8481);const ft=pt(39023);const _t=pt(16928);const mt=pt(4002);const ht=ft.debuglog("midway:debug");class LoggerFactory extends Map{constructor(ct={}){super();this.factoryOptions=ct}createLogger(ct,ut){if(!this.has(ct)){ht('[logger]: Create logger "%s" with options %j',ct,ut);const pt=new dt.MidwayLogger(Object.assign(ut,this.factoryOptions));this.addLogger(ct,pt);return pt}return this.getLogger(ct)}addLogger(ct,ut,pt=true){if(!pt||!this.has(ct)){if(this.get(ct)!==ut){if(ut["onClose"]){ut["onClose"]((()=>{this.delete(ct)}))}if(ut["on"]){ut.on("close",(()=>this.delete(ct)))}this.set(ct,ut)}}else{throw new Error(`logger id ${ct} has duplicate`)}return this.get(ct)}getLogger(ct){return this.get(ct)}removeLogger(ct){const ut=this.get(ct);ut===null||ut===void 0?void 0:ut["close"]();this.delete(ct)}get(ct){return super.get(ct)}close(ct){if(ct){return this.removeLogger(ct)}Array.from(this.keys()).forEach((ct=>this.removeLogger(ct)))}getDefaultMidwayLoggerConfig(ct){var ut;const pt=(0,mt.isDevelopmentEnvironment)(ct.env);const dt=(ut=process.env["MIDWAY_LOGGER_WRITEABLE_DIR"])!==null&&ut!==void 0?ut:ct.root;if(!dt){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,_t.join)(dt,"logs",ct.name),auditFileDir:".audit",transports:{console:pt?{autoColors:pt}:false,file:{bufferWrite:!pt},error:{bufferWrite:!pt}}},clients:{coreLogger:{fileLogName:"midway-core.log"},appLogger:{}}}}}createContextLogger(ct,ut,pt={}){return ut.createContextLogger(ct,pt)}}ut.LoggerFactory=LoggerFactory},51169:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayBaseLogger=ut.MidwayLoggerContainer=ut.createConsoleLogger=ut.createFileLogger=ut.createLogger=ut.clearAllLoggers=ut.loggers=void 0;const _t=pt(62379);const mt=pt(8481);ft(pt(51314),ut);ft(pt(8481),ut);ft(pt(19870),ut);ft(pt(3993),ut);ft(pt(96242),ut);ft(pt(53828),ut);ft(pt(62379),ut);ft(pt(4002),ut);ut.loggers=new _t.LoggerFactory;const clearAllLoggers=()=>{ut.loggers.close()};ut.clearAllLoggers=clearAllLoggers;const createLogger=(ct,pt={})=>ut.loggers.createLogger(ct,pt);ut.createLogger=createLogger;const createFileLogger=(ct,pt)=>ut.loggers.createLogger(ct,{transports:{file:{dir:__dirname,fileLogName:"custom-logger.log",...pt}}});ut.createFileLogger=createFileLogger;const createConsoleLogger=(ct,pt={})=>ut.loggers.createLogger(ct,{transports:{console:pt}});ut.createConsoleLogger=createConsoleLogger;ut.MidwayLoggerContainer=_t.LoggerFactory;ut.MidwayBaseLogger=mt.MidwayLogger},51314:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},8481:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayChildLogger=ut.MidwayContextLogger=ut.MidwayLogger=ut.TransportManager=void 0;const dt=pt(4002);const ft=pt(70857);const _t=pt(19870);const mt=pt(96242);const ht=pt(3993);ut.TransportManager=new Map;ut.TransportManager.set("console",mt.ConsoleTransport);ut.TransportManager.set("file",ht.FileTransport);ut.TransportManager.set("error",ht.ErrorTransport);ut.TransportManager.set("json",ht.JSONTransport);class MidwayLogger{constructor(ct={}){this.transports=new Map;this.closeHandlers=[];ct=(0,dt.formatLegacyLoggerOptions)(ct);this.options=ct;this.options.level=this.options.level||"silly";this.options.eol=this.options.eol||ft.EOL;if(this.options.transports){for(const ct in this.options.transports){this.add(ct,this.options.transports[ct])}}}get level(){return this.options.level}set level(ct){this.options.level=ct}log(ct,...ut){this.transit(ct,{},...ut)}debug(...ct){this.transit("debug",{},...ct)}info(...ct){this.transit("info",{},...ct)}warn(...ct){this.transit("warn",{},...ct)}error(...ct){this.transit("error",{},...ct)}verbose(...ct){this.transit("verbose",{},...ct)}write(...ct){this.transit(false,{},...ct)}silly(...ct){this.transit("silly",{},...ct)}add(ct,pt){if(pt){let dt;if(!(pt instanceof _t.Transport)){if(!ut.TransportManager.has(ct)){throw new Error(`Transport ${ct} is not supported`)}else{dt=new(ut.TransportManager.get(ct))(pt)}}else{dt=pt}dt.setLoggerOptions(this.options);this.transports.set(ct,dt)}}get(ct){return this.transports.get(ct)}remove(ct,ut={}){if(this.transports.has(ct)){if(ut.close===undefined||ut.close){this.transports.get(ct).close()}this.transports.delete(ct)}}close(){for(const ct of this.transports.keys()){this.remove(ct,{close:true})}for(const ct of this.closeHandlers){ct()}}onClose(ct){this.closeHandlers.push(ct)}createContextLogger(ct,ut={}){return new MidwayContextLogger(ct,this,ut)}transit(ct,ut={},...pt){if(ct!==false&&!(0,dt.isEnableLevel)(ct,this.level)){return}for(const dt of this.transports.values()){dt.log(ct,ut,...pt)}}getChild(ct={}){return new MidwayChildLogger(this,ct)}}ut.MidwayLogger=MidwayLogger;class MidwayContextLogger{constructor(ct,ut,pt={}){this.ctx=ct;this.parentLogger=ut;this.options=pt}debug(...ct){this.transit("debug",...ct)}info(...ct){this.transit("info",...ct)}warn(...ct){this.transit("warn",...ct)}error(...ct){this.transit("error",...ct)}verbose(...ct){this.transit("verbose",...ct)}write(...ct){this.transit(false,...ct)}transit(ct,...ut){this.parentLogger.transit(ct,{ctx:this.ctx,contextFormat:this.options.contextFormat},...ut)}getContext(){return this.ctx}}ut.MidwayContextLogger=MidwayContextLogger;class MidwayChildLogger{constructor(ct,ut={}){this.parentLogger=ct;this.meta=ut}debug(...ct){this.transit("debug",...ct)}info(...ct){this.transit("info",...ct)}warn(...ct){this.transit("warn",...ct)}error(...ct){this.transit("error",...ct)}verbose(...ct){this.transit("verbose",...ct)}write(...ct){this.transit(false,...ct)}transit(ct,...ut){this.parentLogger.transit(ct,this.meta,...ut)}}ut.MidwayChildLogger=MidwayChildLogger},96242:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ConsoleTransport=void 0;const dt=pt(19870);const ft=pt(4002);const _t=pt(78997);const mt=_t.supportsColor.stdout;class ConsoleTransport extends dt.Transport{log(ct,ut,...pt){if(!(0,ft.isEnableLevel)(ct,this.options.level)){return}let dt=this.format(ct,ut,pt);if(process.env.FORCE_ENABLE_COLOR||this.options.autoColors&&mt){const ut=this.getColor(ct);dt=(0,_t.colorizeAll)(dt,ut)}dt+=this.options.eol;if(ct==="error"){process.stderr.write(dt)}else{process.stdout.write(dt)}}getColor(ct){switch(ct){case"debug":return _t.Color.blue;case"info":return _t.Color.green;case"warn":return _t.Color.yellow;case"error":return _t.Color.red;default:return _t.Color.white}}close(){}}ut.ConsoleTransport=ConsoleTransport},3993:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.JSONTransport=ut.ErrorTransport=ut.FileTransport=void 0;const dt=pt(19870);const ft=pt(53828);const _t=pt(16928);const mt=pt(43106);const ht=pt(79896);const yt=pt(4002);const vt=pt(61256);const St=pt(74450);class FileTransport extends dt.Transport{constructor(ct={}){super(ct);this.options=ct;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,yt.isValidFileName)(this.options.fileLogName)||!(0,yt.isValidDirName)(this.options.dir)){throw new Error("Your path or filename contain an invalid character.")}const ut={frequency:"custom",dateFormat:"YYYY-MM-DD",endStream:true,fileOptions:{flags:"a"},utc:false,extension:"",createSymlink:!(0,yt.isWin32)(),maxFiles:"7d",zippedArchive:false};if(!this.options.auditFileDir){ct.auditFileDir=this.options.dir}if(!_t.isAbsolute(this.options.auditFileDir)){ct.auditFileDir=_t.join(this.options.dir,ct.auditFileDir)}this.logStream=ft.FileStreamRotatorManager.getStream({...ut,filename:_t.join(this.options.dir,this.options.fileLogName),size:(0,yt.getMaxSize)(this.options.maxSize||"200m"),symlinkName:this.options.fileLogName,auditFile:_t.join(ct.auditFileDir,"."+(0,vt.hash)(this.options)+"-audit.json"),...ct});this.logStream.on("logRemoved",(ut=>{if(ct.zippedArchive){const ct=ut.name+".gz";if(ht.existsSync(ct)){try{ht.unlinkSync(ct)}catch(ct){console.error(ct)}return}}}));if(ct.zippedArchive){this.logStream.on("rotate",(ct=>{const ut=ht.existsSync(ct);const pt=ht.existsSync(ct+".gz");if(!ut||pt){return}const dt=mt.createGzip();const ft=ht.createReadStream(ct);const _t=ht.createWriteStream(ct+".gz");ft.pipe(dt).pipe(_t).on("finish",(()=>{if(ht.existsSync(ct)){ht.unlinkSync(ct)}}))}))}}log(ct,ut,...pt){if(!(0,yt.isEnableLevel)(ct,this.options.level)){return}let dt=this.format(ct,ut,pt);dt+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=dt.length;this.buf.push(dt);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(dt)}}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){ft.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()}}ut.FileTransport=FileTransport;class ErrorTransport extends FileTransport{constructor(ct){ct.level="error";super(ct)}}ut.ErrorTransport=ErrorTransport;class JSONTransport extends FileTransport{log(ct,ut,...pt){if(!(0,yt.isEnableLevel)(ct,this.options.level)){return}let dt=this.format(ct,ut,pt);if(typeof dt==="string"||Buffer.isBuffer(dt)){dt=(0,St.stringify)({message:dt.toString()})}else{dt=(0,St.stringify)(dt)}dt+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=dt.length;this.buf.push(dt);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(dt)}}}ut.JSONTransport=JSONTransport},53828:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.FileStreamRotatorManager=ut.FileStreamRotator=void 0;const dt=pt(79896);const ft=pt(16928);const _t=pt(76982);const mt=pt(24434);const ht=pt(39023);const yt=pt(23046);const vt=pt(15419);const St=pt(42613);const bt=pt(4002);const xt=(0,ht.debuglog)("midway-logger");const $t=["daily","test","s","m","h","custom"];const Et="YYYYMMDDHHmm";yt.extend(vt);class FileStreamRotator{getFrequency(ct){const ut=ct.toLowerCase().match(/^(\d+)([smh])$/);if(ut){return(0,bt.checkNumAndType)(ut[2],parseInt(ut[1]))}const pt=(0,bt.checkDailyAndTest)(ct);if(pt){return pt}return false}parseFileSize(ct){if(ct&&typeof ct==="string"){const ut=ct.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);if(ut){switch(ut[2]){case"k":return ut[1]*1024;case"m":return ut[1]*1024*1024;case"g":return ut[1]*1024*1024*1024}}}return null}getDate(ct,ut,pt){ut=ut||Et;const dt=pt?yt.utc():yt().local();if(ct&&$t.indexOf(ct.type)!==-1){switch(ct.type){case"s":const pt=Math.floor(dt.second()/ct.digit)*ct.digit;return dt.second(pt).format(ut);case"m":const ft=Math.floor(dt.minute()/ct.digit)*ct.digit;return dt.minute(ft).format(ut);case"h":const _t=Math.floor(dt.hour()/ct.digit)*ct.digit;return dt.hour(_t).format(ut);case"daily":case"custom":case"test":return dt.format(ut)}}return dt.format(ut)}setAuditLog(ct,ut,pt){let _t=null;if(ct){const mt=ct.toString().substr(-1);const ht=ct.toString().match(/^(\d+)/);if(Number(ht[1])>0){const ct=ft.dirname(pt.replace(/%DATE%.+/,"_filename"));try{if(ut){const ct=ft.resolve(ut);_t=JSON.parse(dt.readFileSync(ct,{encoding:"utf-8"}))}else{const ut=ft.resolve(ct+"/"+".audit.json");_t=JSON.parse(dt.readFileSync(ut,{encoding:"utf-8"}))}}catch(pt){if(pt.code!=="ENOENT"){return null}_t={keep:{days:false,amount:Number(ht[1])},auditLog:ut||ct+"/"+".audit.json",files:[]}}_t.keep={days:mt==="d",amount:Number(ht[1])}}}return _t}writeAuditLog(ct){try{(0,bt.mkDirForFile)(ct.auditLog);dt.writeFileSync(ct.auditLog,JSON.stringify(ct,null,2))}catch(ut){xt((new Date).toLocaleString(),"[FileStreamRotator] Failed to store log audit at:",ct.auditLog,"Error:",ut)}}addLogToAudit(ct,ut,pt){if(ut&&ut.files){const dt=ut.files.findIndex((ut=>ut.name===ct));if(dt!==-1){return ut}const ft=Date.now();ut.files.push({date:ft,name:ct,hash:_t.createHash(ut.hashType).update(ct+"LOG_FILE"+ft).digest("hex")});if(ut.keep.days){const ct=yt().subtract(ut.keep.amount,"days").valueOf();ut.files=ut.files.filter((dt=>{if(dt.date>ct){return true}dt.hashType=ut.hashType;(0,bt.removeFile)(dt);pt.emit("logRemoved",dt);return false}))}else{const ct=ut.files.splice(-ut.keep.amount);if(ut.files.length>0){ut.files.filter((ct=>{ct.hashType=ut.hashType;(0,bt.removeFile)(ct);pt.emit("logRemoved",ct);return false}))}ut.files=ct}this.writeAuditLog(ut)}return ut}getStream(ct){let ut=null;let pt=null;St(ct.filename,"options.filename must be supplied");if(ct.frequency){ut=this.getFrequency(ct.frequency)}const ft=this.setAuditLog(ct.maxFiles,ct.auditFile,ct.filename);if(ft!=null){ft.hashType=ct.auditHashType!==undefined?ct.auditHashType:"md5"}let _t=null;let vt=0;let Ct=0;if(ct.size){_t=this.parseFileSize(ct.size)}let Tt=ct.dateFormat||Et;if(ut&&ut.type==="daily"){if(!ct.dateFormat){Tt="YYYY-MM-DD"}if(yt().format(Tt)!==yt().endOf("day").format(Tt)||yt().format(Tt)===yt().add(1,"day").format(Tt)){xt((new Date).toLocaleString(),"[FileStreamRotator] Changing type to custom as date format changes more often than once a day or not every day");ut.type="custom"}}if(ut){pt=ct.frequency?this.getDate(ut,Tt,ct.utc):""}ct.createSymlink=ct.createSymlink||false;ct.extension=ct.extension||"";const wt=ct.filename;let At=null;let kt=wt+(pt?"."+pt:"");if(wt.match(/%DATE%/)){kt=wt.replace(/%DATE%/g,pt?pt:this.getDate(null,Tt,ct.utc))}if(_t){let ut=null;let pt=kt;if(ft&&ft.files&&ft.files instanceof Array&&ft.files.length>0){const ct=ft.files[ft.files.length-1].name;if(ct.match(pt)){const ut=ct.match(pt+"\\.(\\d+)");if(ut){pt=ct;vt=ut[1]}}}if(vt===0&&pt===kt){pt+=ct.extension}while(dt.existsSync(pt)){ut=pt;vt++;pt=kt+"."+vt+ct.extension}if(ut){const ct=dt.statSync(ut);if(ct.size<_t){pt=ut;vt--;Ct=ct.size}}kt=pt}else{kt+=ct.extension}xt((new Date).toLocaleString(),"[FileStreamRotator] Logging to: ",kt);(0,bt.mkDirForFile)(kt);const It=ct.fileOptions||{flags:"a"};let Nt=dt.createWriteStream(kt,It);if(pt&&ut&&$t.indexOf(ut.type)>-1||_t>0){xt((new Date).toLocaleString(),"[FileStreamRotator] Rotating file: ",ut?ut.type:"",_t?"size: "+_t:"");const yt=new mt;yt.auditLog=ft;yt.filename=ct.filename;yt.end=(...ct)=>{Nt.end(...ct);St.clear()};yt.canWrite=()=>!Nt.closed&&Nt.writable&&!Nt.destroyed;(0,bt.BubbleEvents)(Nt,yt);yt.on("new",(ut=>{yt.auditLog=this.addLogToAudit(ut,yt.auditLog,yt);if(ct.createSymlink){(0,bt.createCurrentSymLink)(ut,ct.symlinkName)}}));const St=(0,bt.debounce)((()=>{let ct=false;try{const ct=dt.statSync(kt);if(ct.size>Ct){Ct=ct.size}}catch(ut){ct=true}return ct}),1e3);yt.write=(ft,mt)=>{const $t=St();const Et=ut?this.getDate(ut,Tt,ct.utc):pt;if($t||pt&&Et!==pt||_t&&Ct>_t){let ft=wt+(pt&&ut?"."+Et:"");if(wt.match(/%DATE%/)&&pt){ft=wt.replace(/%DATE%/g,Et)}if(_t&&Ct>_t){vt++;ft+="."+vt+ct.extension}else{vt=0;ft+=ct.extension}Ct=0;xt((new Date).toLocaleString(),(0,ht.format)("[FileStreamRotator] Changing logs from %s to %s",kt,ft));pt=Et;At=kt;kt=ft;if(ct.endStream===true){Nt.end()}else{Nt.destroy()}(0,bt.mkDirForFile)(kt);Nt=dt.createWriteStream(ft,It);yt.emit("new",ft);yt.emit("rotate",At,ft);(0,bt.BubbleEvents)(Nt,yt)}Nt.write(ft,mt);Ct+=Buffer.byteLength(ft,mt)};process.nextTick((()=>{yt.emit("new",kt)}));yt.emit("new",kt);return yt}else{xt((new Date).toLocaleString(),"[FileStreamRotator] File won't be rotated: ",ct.frequency,ct.size);process.nextTick((()=>{Nt.emit("new",kt)}));return Nt}}}ut.FileStreamRotator=FileStreamRotator;class FileStreamRotatorManager{static getStream(ct){let ut;if(this.enabled){if(!this.streamPool.has(ct.filename)){const ut=(new FileStreamRotator).getStream(ct);this.streamPool.set(ct.filename,ut);this.loggerRef.set(ut,0)}ut=this.streamPool.get(ct.filename);let pt=this.loggerRef.get(ut);this.loggerRef.set(ut,pt++)}else{ut=(new FileStreamRotator).getStream(ct)}return ut}static close(ct){if(this.enabled){if(this.loggerRef.has(ct)){let ut=this.loggerRef.get(ct);ut--;if(ut===0){ct.end();this.streamPool.delete(ct.filename);this.loggerRef.delete(ct)}else if(ut>0){this.loggerRef.set(ct,ut)}else{}}}else{ct.end()}}static clear(){for(const ct of this.streamPool.values()){ct.end();if(this.loggerRef.has(ct)){this.loggerRef.delete(ct)}}this.streamPool.clear();this.loggerRef=new WeakMap}}ut.FileStreamRotatorManager=FileStreamRotatorManager;FileStreamRotatorManager.streamPool=new Map;FileStreamRotatorManager.loggerRef=new WeakMap;FileStreamRotatorManager.enabled=true},19870:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.EmptyTransport=ut.Transport=void 0;const dt=pt(39023);const ft=pt(4002);const _t=pt(28520);class Transport{constructor(ct={}){this.options=ct;this.pid=process.pid}setLoggerOptions(ct){this.loggerOptions=ct;this.options.level=this.options.level||ct.level;this.options.format=this.options.format||ct.format;this.options.contextFormat=this.options.contextFormat||ct.contextFormat;this.options.eol=this.options.eol||ct.eol}format(ct,ut,pt){const ft=this.getLoggerInfo(ct,ut,pt);if(Buffer.isBuffer(ft.args[0])){return ft.args[0]}if(ct===false){return(0,dt.format)(ft.message)}const _t=ut.contextFormat||this.options.contextFormat;if(ut.ctx&&_t){return _t(ft)}const mt=ut.format||this.options.format;if(mt){return mt(ft)}if(ct){return(0,dt.format)("%s %s %s %s",ft.timestamp,ft.LEVEL,ft.pid,ft.message)}else{return(0,dt.format)(ft.message)}}getLoggerInfo(ct,ut,pt){const mt=ct||"";const ht={level:mt,pid:this.pid};Object.defineProperties(ht,{timestamp:{get(){return(0,ft.getFormatDate)(new Date)},enumerable:false},LEVEL:{get(){return _t.LEVEL[mt]||""},enumerable:false},args:{get(){return pt},enumerable:false},originArgs:{get(){return pt},enumerable:false},message:{get(){return(0,dt.format)(...pt)},enumerable:false},ctx:{get(){return ut.ctx},enumerable:false},originError:{get(){return pt.find((ct=>ct instanceof Error))},enumerable:false},meta:{get(){return ut},enumerable:false}});return ht}get level(){return this.options.level}set level(ct){this.options.level=ct}}ut.Transport=Transport;class EmptyTransport extends Transport{log(ct,...ut){}close(){}}ut.EmptyTransport=EmptyTransport},78997:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.supportsColor=ut.colorizeAll=ut.colorize=ut.Color=void 0;const dt=pt(932);const ft=pt(70857);const _t=pt(52018);ut.Color={red:ct=>`${ct}`,green:ct=>`${ct}`,yellow:ct=>`${ct}`,blue:ct=>`${ct}`,magenta:ct=>`${ct}`,cyan:ct=>`${ct}`,white:ct=>`${ct}`,gray:ct=>`${ct}`,grey:ct=>`${ct}`,black:ct=>`${ct}`,bgRed:ct=>`${ct}`,bgGreen:ct=>`${ct}`,bgYellow:ct=>`${ct}`,bgBlue:ct=>`${ct}`,bgMagenta:ct=>`${ct}`,bgCyan:ct=>`${ct}`,bgWhite:ct=>`${ct}`,bgBlack:ct=>`${ct}`,bold:ct=>`${ct}`,dim:ct=>`${ct}`,italic:ct=>`${ct}`,underline:ct=>`${ct}`,inverse:ct=>`${ct}`,hidden:ct=>`${ct}`,strikethrough:ct=>`${ct}`};const colorize=(ct,pt)=>{if(typeof pt==="function"){return pt(ct)}else{return ut.Color[pt](ct)}};ut.colorize=colorize;const colorizeAll=(ct,pt)=>ct.replace(/([^\s]+)/g,(ct=>(0,ut.colorize)(ct,pt)));ut.colorizeAll=colorizeAll;function hasFlag(ct,ut=process.argv){const pt=ct.startsWith("-")?"":ct.length===1?"-":"--";const dt=ut.indexOf(pt+ct);const ft=ut.indexOf("--");return dt!==-1&&(ft===-1||dt<ft)}let mt;if(hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")){mt=0}else if(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always")){mt=1}function envForceColor(){if("FORCE_COLOR"in dt.env){if(dt.env.FORCE_COLOR==="true"){return 1}if(dt.env.FORCE_COLOR==="false"){return 0}return dt.env.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(dt.env.FORCE_COLOR,10),3)}}function translateLevel(ct){if(ct===0){return false}return{level:ct,hasBasic:true,has256:ct>=2,has16m:ct>=3}}function _supportsColor(ct,ut){const pt=ut.streamIsTTY;const _t=true;const ht=envForceColor();if(ht!==undefined){mt=ht}const yt=_t?mt:ht;if(yt===0){return 0}if(_t){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor")){return 3}if(hasFlag("color=256")){return 2}}if("TF_BUILD"in dt.env&&"AGENT_NAME"in dt.env){return 1}if(ct&&!pt&&yt===undefined){return 0}const vt=yt||0;if(dt.env.TERM==="dumb"){return vt}if(dt.platform==="win32"){const ct=ft.release().split(".");if(Number(ct[0])>=10&&Number(ct[2])>=10586){return Number(ct[2])>=14931?3:2}return 1}if("CI"in dt.env){if("GITHUB_ACTIONS"in dt.env||"GITEA_ACTIONS"in dt.env){return 3}if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((ct=>ct in dt.env))||dt.env.CI_NAME==="codeship"){return 1}return vt}if("TEAMCITY_VERSION"in dt.env){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(dt.env.TEAMCITY_VERSION)?1:0}if(dt.env.COLORTERM==="truecolor"){return 3}if(dt.env.TERM==="xterm-kitty"){return 3}if("TERM_PROGRAM"in dt.env){const ct=Number.parseInt((dt.env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(dt.env.TERM_PROGRAM){case"iTerm.app":{return ct>=3?3:2}case"Apple_Terminal":{return 2}}}if(/-256(color)?$/i.test(dt.env.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(dt.env.TERM)){return 1}if("COLORTERM"in dt.env){return 1}return vt}function createSupportsColor(ct){const ut=_supportsColor(true,{streamIsTTY:ct.isTTY});return translateLevel(ut)}ut.supportsColor={stdout:createSupportsColor({isTTY:_t.isatty(1)}),stderr:createSupportsColor({isTTY:_t.isatty(2)})}},61256:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.hash=void 0;const dt=pt(76982);const ft=pt(2203);function hash(ct){const ut={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 pt=dt.createHash(ut.algorithm);const ft=typeHasher(ut,pt);ft.dispatch(ct);if(!pt.update){pt.end("")}return pt.digest(ut.encoding)}ut.hash=hash;function typeHasher(ct,ut,pt){pt=pt||[];const write=function(ct){if(ut.update){return ut.update(ct,"utf8")}else{return ut.write(ct,"utf8")}};return{dispatch:function(ut){if(ct.replacer){ut=ct.replacer(ut)}let pt=typeof ut;if(ut===null){pt="null"}return this["_"+pt](ut)},_object:function(ut){const dt=/\[object (.*)\]/i;const ft=Object.prototype.toString.call(ut);let _t=dt.exec(ft);if(!_t){_t="unknown:["+ft+"]"}else{_t=_t[1]}_t=_t.toLowerCase();let mt=null;if((mt=pt.indexOf(ut))>=0){return this.dispatch("[CIRCULAR:"+mt+"]")}else{pt.push(ut)}if(typeof Buffer!=="undefined"&&Buffer.isBuffer&&Buffer.isBuffer(ut)){write("buffer:");return write(ut)}if(_t!=="object"&&_t!=="function"&&_t!=="asyncfunction"){if(this["_"+_t]){this["_"+_t](ut)}else if(ct.ignoreUnknown){return write("["+_t+"]")}else{throw new Error('Unknown object type "'+_t+'"')}}else{let pt=Object.keys(ut);if(ct.unorderedObjects){pt=pt.sort()}if(ct.respectType!==false&&!isNativeFunction(ut)){pt.splice(0,0,"prototype","__proto__","constructor")}if(ct.excludeKeys){pt=pt.filter((ut=>!ct.excludeKeys(ut)))}write("object:"+pt.length+":");const dt=this;return pt.forEach((pt=>{dt.dispatch(pt);write(":");if(!ct.excludeValues){dt.dispatch(ut[pt])}write(",")}))}},_array:function(ut,dt){dt=typeof dt!=="undefined"?dt:ct.unorderedArrays!==false;const _t=this;write("array:"+ut.length+":");if(!dt||ut.length<=1){return ut.forEach((ct=>_t.dispatch(ct)))}let mt=[];const ht=ut.map((ut=>{const dt=new ft.PassThrough;const _t=pt.slice();const ht=typeHasher(ct,dt,_t);ht.dispatch(ut);mt=mt.concat(_t.slice(pt.length));return dt.read().toString()}));pt=pt.concat(mt);ht.sort();return this._array(ht,false)},_date:function(ct){return write("date:"+ct.toJSON())},_symbol:function(ct){return write("symbol:"+ct.toString())},_error:function(ct){return write("error:"+ct.toString())},_boolean:function(ct){return write("bool:"+ct.toString())},_string:function(ct){write("string:"+ct.length+":");write(ct.toString())},_function:function(ut){write("fn:");if(isNativeFunction(ut)){this.dispatch("[native]")}else{this.dispatch(ut.toString())}if(ct.respectFunctionNames!==false){this.dispatch("function-name:"+String(ut.name))}if(ct.respectFunctionProperties){this._object(ut)}},_number:function(ct){return write("number:"+ct.toString())},_xml:function(ct){return write("xml:"+ct.toString())},_null:function(){return write("Null")},_undefined:function(){return write("Undefined")},_regexp:function(ct){return write("regex:"+ct.toString())},_uint8array:function(ct){write("uint8array:");return this.dispatch(Array.prototype.slice.call(ct))},_uint8clampedarray:function(ct){write("uint8clampedarray:");return this.dispatch(Array.prototype.slice.call(ct))},_int8array:function(ct){write("int8array:");return this.dispatch(Array.prototype.slice.call(ct))},_uint16array:function(ct){write("uint16array:");return this.dispatch(Array.prototype.slice.call(ct))},_int16array:function(ct){write("int16array:");return this.dispatch(Array.prototype.slice.call(ct))},_uint32array:function(ct){write("uint32array:");return this.dispatch(Array.prototype.slice.call(ct))},_int32array:function(ct){write("int32array:");return this.dispatch(Array.prototype.slice.call(ct))},_float32array:function(ct){write("float32array:");return this.dispatch(Array.prototype.slice.call(ct))},_float64array:function(ct){write("float64array:");return this.dispatch(Array.prototype.slice.call(ct))},_arraybuffer:function(ct){write("arraybuffer:");return this.dispatch(new Uint8Array(ct))},_url:function(ct){return write("url:"+ct.toString())},_map:function(ut){write("map:");const pt=Array.from(ut);return this._array(pt,ct.unorderedSets!==false)},_set:function(ut){write("set:");const pt=Array.from(ut);return this._array(pt,ct.unorderedSets!==false)},_file:function(ct){write("file:");return this.dispatch([ct.name,ct.size,ct.type,ct.lastModfied])},_blob:function(){if(ct.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(ct){return write("bigint:"+ct.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(ct){if(typeof ct!=="function"){return false}const ut=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;return ut.exec(Function.prototype.toString.call(ct))!=null}},4002:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.getFormatDate=ut.isWin32=ut.BubbleEvents=ut.formatLegacyLoggerOptions=ut.formatLoggerOptions=ut.isDevelopmentEnvironment=ut.debounce=ut.throwIf=ut.getMaxSize=ut.isValidDirName=ut.isValidFileName=ut.removeFile=ut.createCurrentSymLink=ut.mkDirForFile=ut.checkDailyAndTest=ut.checkNumAndType=ut.isEnableLevel=void 0;const dt=pt(28520);const ft=pt(79896);const _t=pt(16928);const mt=pt(76982);const ht=pt(16928);const yt=pt(70857);const vt=pt(19870);function isEnableLevel(ct,ut){if(!ct||!ut){return true}return dt.DefaultLogLevels[ct]<=dt.DefaultLogLevels[ut]}ut.isEnableLevel=isEnableLevel;function checkNumAndType(ct,ut){if(typeof ut==="number"){switch(ct){case"s":case"m":if(ut<0||ut>60){return false}break;case"h":if(ut<0||ut>24){return false}break}return{type:ct,digit:ut}}}ut.checkNumAndType=checkNumAndType;function checkDailyAndTest(ct){switch(ct){case"custom":case"daily":return{type:ct,digit:undefined};case"test":return{type:ct,digit:0}}return false}ut.checkDailyAndTest=checkDailyAndTest;function mkDirForFile(ct){const ut=ht.dirname(ct);ut.split(ht.sep).reduce(((ct,ut)=>{ct+=ut+ht.sep;if(!ft.existsSync(ct)){try{ft.mkdirSync(ct)}catch(ct){if(ct.code!=="EEXIST"){throw ct}}}return ct}),"")}ut.mkDirForFile=mkDirForFile;function createCurrentSymLink(ct,ut){const pt=ut||"current.log";const dt=(0,_t.dirname)(ct);const mt=(0,_t.basename)(ct);const ht=dt+"/"+pt;try{const ct=ft.lstatSync(ht);if(ct.isSymbolicLink()){ft.unlinkSync(ht);ft.symlinkSync(mt,ht)}}catch(ct){if(ct&&ct.code==="ENOENT"){try{ft.symlinkSync(mt,ht)}catch(ct){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not create symlink file: ",ht," -> ",mt)}}}}ut.createCurrentSymLink=createCurrentSymLink;function removeFile(ct){if(ct.hash===mt.createHash(ct.hashType).update(ct.name+"LOG_FILE"+ct.date).digest("hex")){try{if(ft.existsSync(ct.name)){ft.unlinkSync(ct.name)}}catch(ut){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not remove old log file: ",ct.name)}}}ut.removeFile=removeFile;function isValidFileName(ct){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(ct)}ut.isValidFileName=isValidFileName;function isValidDirName(ct){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(ct)}ut.isValidDirName=isValidDirName;function getMaxSize(ct){if(ct&&typeof ct==="string"){const ut=ct.toLowerCase().match(/^((?:0\.)?\d+)([k|m|g])$/);if(ut){return ct}}else if(ct&&Number.isInteger(ct)){const ut=Math.round(ct/1024);return ut===0?"1k":ut+"k"}return null}ut.getMaxSize=getMaxSize;function throwIf(ct,...ut){Array.prototype.slice.call(ut,1).forEach((pt=>{if(ct[pt]){throw new Error("Cannot set "+pt+" and "+ut[0]+" together")}}))}ut.throwIf=throwIf;function debounce(ct,ut,pt){let dt,ft,_t,mt,ht;if(null==ut)ut=100;function later(){const yt=Date.now()-mt;if(yt<ut&&yt>=0){dt=setTimeout(later,ut-yt)}else{dt=null;if(!pt){ht=ct.apply(_t,ft);_t=ft=null}}}const debounced=(...ft)=>{_t=this;mt=Date.now();const yt=pt&&!dt;if(!dt)dt=setTimeout(later,ut);if(yt){ht=ct.apply(_t,ft);_t=ft=null}return ht};debounced.clear=()=>{if(dt){clearTimeout(dt);dt=null}};debounced.flush=()=>{if(dt){ht=ct.apply(_t,ft);_t=ft=null;clearTimeout(dt);dt=null}};return debounced}ut.debounce=debounce;const isDevelopmentEnvironment=ct=>["local","test","unittest"].includes(ct);ut.isDevelopmentEnvironment=isDevelopmentEnvironment;const St={enableConsole:true,disableConsole:true,enableFile:true,enableError:true,enableJSON:true,disableFile:true,disableError:true};function formatLoggerOptions(ct){if(Object.keys(ct).some((ct=>St[ct]))){const ut={transports:{}};for(const pt of Object.keys(ct)){if(!St[pt]){ut[pt]=ct[pt]}}if(ut.transports["console"]&&(ct["enableConsole"]===false||ct["disableConsole"]===true)){ut.transports["console"]=false}if(ut.transports["file"]&&(ct["enableFile"]===false||ct["disableFile"]===true)){ut.transports["file"]=false}if(ut.transports["error"]&&(ct["enableError"]===false||ct["disableError"]===true)){ut.transports["error"]=false}if(ut.transports["json"]&&ct["enableJSON"]===false){ut.transports["json"]=false}return ut}return ct}ut.formatLoggerOptions=formatLoggerOptions;const bt={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 xt=Object.prototype.hasOwnProperty;const $t=Object.prototype.toString;function formatLegacyLoggerOptions(ct){var ut,pt,dt,ft,_t,mt;function isPlainObject(ct){if(!ct||$t.call(ct)!=="[object Object]"){return false}const ut=xt.call(ct,"constructor");const pt=ct.constructor&&ct.constructor.prototype&&xt.call(ct.constructor.prototype,"isPrototypeOf");if(ct.constructor&&!ut&&!pt){return false}let dt;for(dt in ct){}return typeof dt==="undefined"||xt.call(ct,dt)}function deepMerge(ct,ut){if(!ct){return ut}if(ut&&!isPlainObject(ut)){return ut}for(const pt of Object.keys(ut)){if(ut[pt]instanceof Object){Object.assign(ut[pt],deepMerge(ct[pt],ut[pt]))}}Object.assign(ct||{},ut);return ct}function setTransportOptions(ut,pt,dt,ft=false){var _t,mt;if(!ut.transports[dt]){ut.transports[dt]={}}const ht=(_t=bt[pt].mappingKey)!==null&&_t!==void 0?_t:pt;if(ft){ut.transports[dt][ht]=ct[pt]}else{ut.transports[dt][ht]=(mt=ut.transports[dt][ht])!==null&&mt!==void 0?mt:ct[pt]}}function isValidTransport(ct){return ct&&(ct instanceof vt.Transport||typeof ct==="object"&&ct["dir"]&&ct["fileLogName"])}if(Object.keys(ct).some((ct=>{var ut;return(ut=bt[ct])===null||ut===void 0?void 0:ut.isOld}))){const ht={transports:{}};for(const pt of Object.keys(ct)){if(!bt[pt]){continue}else{if(bt[pt].ignore){continue}bt[pt].category=[].concat(bt[pt].category);for(const dt of bt[pt].category){if(dt==="all"){for(const ct of Object.keys(ht.transports)){setTransportOptions(ht,pt,ct,bt[pt].overwriteIfExists)}}else if(dt==="top"){ht[pt]=(ut=ht[pt])!==null&&ut!==void 0?ut:ct[bt[pt].mappingKey]}else{setTransportOptions(ht,pt,dt,bt[pt].overwriteIfExists)}}}}for(const ut of Object.keys(ct)){if(!bt[ut]){deepMerge(ht[ut],ct[ut])}}if(ct["enableConsole"]===false||ct["disableConsole"]===true){ht.transports["console"]=false}else{ht.transports["console"]=(pt=ht.transports["console"])!==null&&pt!==void 0?pt:{}}if(ct["enableFile"]===false||ct["disableFile"]===true){ht.transports["file"]=false}else{ht.transports["file"]=(dt=ht.transports["file"])!==null&&dt!==void 0?dt:{}}if(ct["enableError"]===false||ct["disableError"]===true){ht.transports["error"]=false}else{ht.transports["error"]=(ft=ht.transports["error"])!==null&&ft!==void 0?ft:{}}if(((_t=ct===null||ct===void 0?void 0:ct.transports)===null||_t===void 0?void 0:_t["json"])===undefined&&(ct["enableJSON"]===undefined||ct["enableJSON"]===false)){ht.transports["json"]=false}else{}for(const ct of["file","error","json"]){if((mt=ht===null||ht===void 0?void 0:ht.transports)===null||mt===void 0?void 0:mt[ct]){if(!isValidTransport(ht.transports[ct])){delete ht.transports[ct]}}}return ht}return ct}ut.formatLegacyLoggerOptions=formatLegacyLoggerOptions;function BubbleEvents(ct,ut){ct.on("close",(()=>{ut.emit("close")}));ct.on("finish",(()=>{ut.emit("finish")}));ct.on("error",(ct=>{ut.emit("error",ct)}));ct.on("open",(ct=>{ut.emit("open",ct)}))}ut.BubbleEvents=BubbleEvents;function isWin32(){return yt.platform()==="win32"}ut.isWin32=isWin32;function getFormatDate(ct){function pad(ct,ut=2){const pt=ct+"";return pt.padStart(ut,"0")}const ut=ct.getFullYear();const pt=ct.getMonth()+1;const dt=ct.getDate();const ft=ct.getHours();const _t=ct.getMinutes();const mt=ct.getSeconds();const ht=ct.getMilliseconds();return`${ut}-${pad(pt)}-${pad(dt)} ${pad(ft)}:${pad(_t)}:${pad(mt)}.${pad(ht,3)}`}ut.getFormatDate=getFormatDate},74129:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.session=void 0;ut.session={enable:true,maxAge:24*3600*1e3,key:"MW_SESS",httpOnly:true,logValue:true}},16885:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SessionConfiguration=void 0;const _t=pt(46123);const mt=pt(74129);const ht=pt(97628);let yt=class SessionConfiguration{async onReady(){if(this.sessionConfig.enable){this.applicationManager.getApplications(["koa","faas"]).forEach((ct=>{if(ct.on){ct.on("session:missed",(({ctx:ct,key:ut})=>{this.logger.warn("[session][missed] key(%s)",ut)}));ct.on("session:expired",(({ctx:ct,key:ut,value:pt})=>{this.logger.warn("[session][expired] key(%s) value(%j)",ut,this.sessionConfig.logValue?pt:"")}));ct.on("session:invalid",(({ctx:ct,key:ut,value:pt})=>{this.logger.warn("[session][invalid] key(%s) value(%j)",ut,this.sessionConfig.logValue?pt:"")}))}ct.useMiddleware(ht.SessionMiddleware)}))}}};dt([(0,_t.Inject)(),ft("design:type",_t.MidwayApplicationManager)],yt.prototype,"applicationManager",void 0);dt([(0,_t.Logger)("coreLogger"),ft("design:type",Object)],yt.prototype,"logger",void 0);dt([(0,_t.Config)("session"),ft("design:type",Object)],yt.prototype,"sessionConfig",void 0);yt=dt([(0,_t.Configuration)({namespace:"session",importConfigs:[{default:mt}]})],yt);ut.SessionConfiguration=yt},65579:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=void 0;ft(pt(58864),ut);var _t=pt(16885);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.SessionConfiguration}});ft(pt(97628),ut);ft(pt(11586),ut)},58864:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.SessionStore=void 0;class SessionStore{}ut.SessionStore=SessionStore},56720:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ContextSession=void 0;const dt=pt(39023);const ft=pt(92355);const _t=pt(16859);const mt=(0,dt.debuglog)("session:context");class ContextSession{constructor(ct,ut){this.ctx=ct;this.app=ct.app;this.opts=Object.assign({},ut);this.store=this.opts.ContextStore?new this.opts.ContextStore(ct):this.opts.store}get(){const ct=this.session;if(ct)return ct;if(ct===false)return null;this.store?this.create():this.initFromCookie();return this.session}set(ct){if(ct===null){this.session=false;return}if(typeof ct==="object"){this.create(ct,this.externalKey);return}throw new Error("this.session can only be set as null or an object.")}async initFromExternal(){mt("init from external");const ct=this.ctx;const ut=this.opts;let pt;if(ut.externalKey){pt=ut.externalKey.get(ct);mt("get external key from custom %s",pt)}else{pt=ct.cookies.get(ut.key,ut);mt("get external key from cookie %s",pt)}if(!pt){this.create();return}const dt=await this.store.get(pt,ut.maxAge,{ctx:ct,rolling:ut.rolling});if(!this.valid(dt,pt)){this.create();return}this.create(dt,pt);this.prevHash=(0,ft.hash)(this.session.toJSON())}initFromCookie(){mt("init from cookie");const ct=this.ctx;const ut=this.opts;const pt=ct.cookies.get(ut.key,ut);if(!pt){this.create();return}let dt;mt("parse %s",pt);try{dt=ut.decode(pt)}catch(dt){mt("decode %j error: %s",pt,dt);if(!(dt instanceof SyntaxError)){ct.cookies.set(ut.key,"",ut);dt.headers={"set-cookie":ct.response.get("set-cookie")};throw dt}this.create();return}mt("parsed %j",dt);if(!this.valid(dt)){this.create();return}this.create(dt);this.prevHash=(0,ft.hash)(this.session.toJSON())}valid(ct,ut){const pt=this.ctx;if(!ct){this.emit("missed",{key:ut,value:ct,ctx:pt});return false}if(ct._expire&&ct._expire<Date.now()){mt("expired session");this.emit("expired",{key:ut,value:ct,ctx:pt});return false}const dt=this.opts.valid;if(typeof dt==="function"&&!dt(pt,ct)){mt("invalid session");this.emit("invalid",{key:ut,value:ct,ctx:pt});return false}return true}emit(ct,ut){setImmediate((()=>{this.app.emit(`session:${ct}`,ut)}))}create(ct,ut){mt("create session with val: %j externalKey: %s",ct,ut);if(this.store){this.externalKey=ut||this.opts.genid&&this.opts.genid(this.ctx)}this.session=new _t.Session(this,ct,this.externalKey)}async commit({save:ct=false,regenerate:ut=false}={}){const pt=this.session;const dt=this.opts;const ft=this.ctx;if(undefined===pt)return;if(pt===false){await this.remove();return}if(ut){await this.remove();if(this.store)this.externalKey=dt.genid&&dt.genid(ft)}const _t=ct||ut||pt._requireSave?"force":this._shouldSaveSession();mt("should save session: %s",_t);if(!_t)return;if(typeof dt.beforeSave==="function"){mt("before save");dt.beforeSave(ft,pt)}const ht=_t==="changed";await this.save(ht)}_shouldSaveSession(){const ct=this.prevHash;const ut=this.session;const pt=ut.toJSON();if(!ct&&!Object.keys(pt).length)return"";const dt=ct!==(0,ft.hash)(pt);if(dt)return"changed";if(this.opts.rolling)return"rolling";if(this.opts.renew){const ct=ut._expire;const pt=ut.maxAge;if(ct&&pt&&ct-Date.now()<pt/2)return"renew"}return""}async remove(){const ct=Object.assign({},this.opts,{expires:ft.COOKIE_EXP_DATE,maxAge:false});const ut=this.ctx;const pt=ct.key;const dt=this.externalKey;if(dt){await this.store.destroy(dt,{ctx:ut})}ut.cookies.set(pt,"",ct)}async save(ct){const ut=this.opts;const pt=ut.key;const dt=this.externalKey;let _t=this.session.toJSON();let ht=ut.maxAge?ut.maxAge:ft.ONE_DAY;if(ht==="session"){ut.maxAge=undefined;_t._session=true}else{_t._expire=ht+Date.now();_t._maxAge=ht}if(dt){mt("save %j to external key %s",_t,dt);if(typeof ht==="number"){ht+=1e4}await this.store.set(dt,_t,ht,{changed:ct,ctx:this.ctx,rolling:ut.rolling});if(ut.externalKey){ut.externalKey.set(this.ctx,dt)}else{this.ctx.cookies.set(pt,dt,ut)}return}mt("save %j to cookie",_t);_t=ut.encode(_t);mt("save %s",_t);this.ctx.cookies.set(pt,_t,ut)}}ut.ContextSession=ContextSession},81361:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.crc32=void 0;const pt=[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(ct,ut=false){let dt=~0;for(let ut=0,ft=ct.length;ut<ft;ut++){dt=dt>>>8^pt[(dt^ct.charCodeAt(ut))&255]}dt=Math.abs(dt^-1);return ut?dt.toString(16):dt}ut.crc32=crc32},16859:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Session=void 0;class Session{constructor(ct,ut,pt){this.isNew=true;this._sessCtx=ct;this._ctx=ct.ctx;this._externalKey=pt;if(!ut){this.isNew=true}else{for(const ct in ut){if(ct==="_maxAge")this._ctx.sessionOptions.maxAge=ut._maxAge;else if(ct==="_session")this._ctx.sessionOptions.maxAge="session";else this[ct]=ut[ct]}}}toJSON(){const ct={};Object.keys(this).forEach((ut=>{if(ut==="isNew")return;if(ut[0]==="_")return;ct[ut]=this[ut]}));return ct}get length(){return Object.keys(this.toJSON()).length}get populated(){return!!this.length}get maxAge(){return this._ctx.sessionOptions.maxAge}set maxAge(ct){this._ctx.sessionOptions.maxAge=ct;this._requireSave=true}get externalKey(){return this._externalKey}save(ct){return this.commit({save:true},ct)}regenerate(ct){return this.commit({regenerate:true},ct)}manuallyCommit(){return this.commit()}commit(ct,ut){if(typeof ct==="function"){ut=ct;ct={}}const pt=this._sessCtx.commit(ct);if(ut){pt.then((()=>ut()),ut)}else{return pt}}}ut.Session=Session},11586:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.SessionStoreManager=void 0;const ft=pt(46123);let _t=class SessionStoreManager{setSessionStore(ct){this.sessionStore=ct}getSessionStore(){return this.sessionStore}};_t=dt([(0,ft.Provide)(),(0,ft.Scope)(ft.ScopeEnum.Singleton)],_t);ut.SessionStoreManager=_t},92355:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ONE_DAY=ut.COOKIE_EXP_DATE=ut.hash=ut.encode=ut.decode=void 0;const dt=pt(81361);function decode(ct){const ut=Buffer.from(ct,"base64").toString("utf8");return JSON.parse(ut)}ut.decode=decode;function encode(ct){ct=JSON.stringify(ct);return Buffer.from(ct).toString("base64")}ut.encode=encode;function hash(ct){return(0,dt.crc32)(JSON.stringify(ct))}ut.hash=hash;ut.COOKIE_EXP_DATE=new Date("Thu, 01 Jan 1970 00:00:00 GMT");ut.ONE_DAY=24*60*60*1e3},97628:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SessionMiddleware=void 0;const _t=pt(46123);const mt=pt(11586);const ht=pt(92355);const yt=pt(42613);const vt=pt(56720);const St=Symbol("context#contextSession");const bt=Symbol("context#_contextSession");function formatOpts(ct){ct=ct||{};ct.key=ct.key||"koa.sess";if(!("maxAge"in ct))ct.maxAge=ct.maxage;if(ct.overwrite==null)ct.overwrite=true;if(ct.httpOnly==null)ct.httpOnly=true;if(ct.sameSite==null)delete ct.sameSite;if(ct.signed==null)ct.signed=true;if(ct.autoCommit==null)ct.autoCommit=true;if(typeof ct.encode!=="function"){ct.encode=ht.encode}if(typeof ct.decode!=="function"){ct.decode=ht.decode}const ut=ct.store;if(ut){yt(_t.Types.isFunction(ut.get),"store.get must be function");yt(_t.Types.isFunction(ut.set),"store.set must be function");yt(_t.Types.isFunction(ut.destroy),"store.destroy must be function")}const pt=ct.externalKey;if(pt){yt(_t.Types.isFunction(pt.get),"externalKey.get must be function");yt(_t.Types.isFunction(pt.set),"externalKey.set must be function")}const dt=ct.ContextStore;if(dt){yt(_t.Types.isClass(dt),"ContextStore must be a class");yt(_t.Types.isFunction(dt.prototype.get),"ContextStore.prototype.get must be function");yt(_t.Types.isFunction(dt.prototype.set),"ContextStore.prototype.set must be function");yt(_t.Types.isFunction(dt.prototype.destroy),"ContextStore.prototype.destroy must be function")}if(!ct.genid){if(ct.prefix){ct.genid=()=>`${ct.prefix}${_t.Utils.randomUUID()}`}else{ct.genid=_t.Utils.randomUUID}}return ct}function extendContext(ct,ut){if(ct.hasOwnProperty(St)){return}Object.defineProperties(ct,{[St]:{get(){if(this[bt]){return this[bt]}this[bt]=new vt.ContextSession(this,ut);return this[bt]}},session:{get(){return this[St].get()},set(ct){this[St].set(ct)},configurable:true},sessionOptions:{get(){return this[St].opts}}})}let xt=class SessionMiddleware{resolve(ct){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 ut=this.sessionStoreManager.getSessionStore();if(ut){this.sessionConfig.store=ut}const pt=formatOpts(this.sessionConfig);extendContext(ct.context,pt);return async function session(ct,ut){const dt=ct[St];if(dt.store){await dt.initFromExternal()}try{await ut()}finally{if(pt.autoCommit){await dt.commit()}}}}static getName(){return"session"}};dt([(0,_t.Config)("session"),ft("design:type",Object)],xt.prototype,"sessionConfig",void 0);dt([(0,_t.Logger)(),ft("design:type",Object)],xt.prototype,"logger",void 0);dt([(0,_t.Inject)(),ft("design:type",mt.SessionStoreManager)],xt.prototype,"sessionStoreManager",void 0);xt=dt([(0,_t.Middleware)()],xt);ut.SessionMiddleware=xt},96313:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.SocketIOConfiguration=void 0;const ft=pt(46123);let _t=class SocketIOConfiguration{};_t=dt([(0,ft.Configuration)({namespace:"socketIO"})],_t);ut.SocketIOConfiguration=_t},53739:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};Object.defineProperty(ut,"__esModule",{value:true});ut.MidwaySocketIOFramework=void 0;const ft=pt(46123);const _t=pt(39023);const mt=(0,_t.debuglog)("midway:socket.io");const ht=pt(46966);const yt=pt(46123);let vt=class MidwaySocketIOFramework extends ft.BaseFramework{constructor(){super(...arguments);this.namespaceList=[];this.connectionMiddlewareManager=this.createMiddlewareManager()}configure(){return this.configService.getConfiguration("socketIO")}applicationInitialize(){this.app=new ht.Server(this.configurationOptions);this.defineApplicationProperties({useConnectionMiddleware:ct=>this.useConnectionMiddleware(ct),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(ft.HTTP_SERVER_KEY)){this.app.attach(this.applicationContext.get(ft.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((ct=>{this.app.close((()=>{setTimeout((()=>{ct()}),1e3)}))}))}getFrameworkType(){return ft.MidwayFrameworkType.WS_IO}async loadMidwayController(){const ct=(0,yt.listModule)(yt.WS_CONTROLLER_KEY);for(const ut of ct){await this.addNamespace(ut)}}async addNamespace(ct){var ut,pt;const dt=(0,yt.getClassMetadata)(yt.WS_CONTROLLER_KEY,ct);const _t=this.app.of(dt.namespace);this.namespaceList.push(dt.namespace);const ht=(ut=dt.routerOptions.middleware)!==null&&ut!==void 0?ut:[];const vt=(pt=dt.routerOptions.connectionMiddleware)!==null&&pt!==void 0?pt:[];_t.use(((ct,ut)=>{this.app.createAnonymousContext(ct);ct.requestContext.registerObject("socket",ct);ct.app=this.app;ut()}));_t.on("connect",(ut=>{let pt=this.middlewareService.compose([...this.connectionMiddlewareManager,...vt],this.app).then((ct=>ct(ut)));const dt=(0,yt.getClassMetadata)(yt.WS_EVENT_KEY,ct);const _t={};const St=dt.filter((ct=>ct.eventType===yt.WSEventTypeEnum.ON_CONNECTION));if(St.length){pt=pt.then((()=>Promise.all(St.map((async pt=>{var dt;_t[pt.propertyName]=_t[pt.propertyName]||{responseEvents:[]};const ft=await ut.requestContext.getAsync(ct);try{const ct=await this.middlewareService.compose([...((dt=pt===null||pt===void 0?void 0:pt.eventOptions)===null||dt===void 0?void 0:dt.middleware)||[],async(ct,dt)=>ft[pt.propertyName].apply(ft,[ut])],this.app);const mt=await ct(ut);await this.bindSocketResponse(mt,ut,pt.propertyName,_t)}catch(ct){this.logger.error(ct)}})))))}const bt=dt.filter((ct=>ct.eventType!==yt.WSEventTypeEnum.ON_CONNECTION));if(bt.length){for(const dt of bt){_t[dt.propertyName]=_t[dt.propertyName]||{responseEvents:[]};if(dt.eventType===yt.WSEventTypeEnum.ON_MESSAGE){ut.on(dt.messageEventName,(async(...yt)=>{await pt;const vt=await ut.requestContext.getAsync(ct);mt("got message",dt.messageEventName,yt);try{const pt=await(await this.applyMiddleware((async(ut,pt)=>{var _t;const mt=await this.middlewareService.compose([...ht,...((_t=dt===null||dt===void 0?void 0:dt.eventOptions)===null||_t===void 0?void 0:_t.middleware)||[],async(ut,pt)=>{const _t=await this.app.getFramework().runGuard(ut,ct,dt.propertyName);if(!_t){throw new ft.MidwayInvokeForbiddenError(dt.propertyName,ct)}return vt[dt.propertyName].apply(vt,yt)}],this.app);return await mt(ut,pt)})))(ut);if(typeof yt[yt.length-1]==="function"){yt[yt.length-1](pt)}else{await this.bindSocketResponse(pt,ut,dt.propertyName,_t)}}catch(ct){this.logger.error(ct)}}))}else if(dt.eventType===yt.WSEventTypeEnum.ON_DISCONNECTION){ut.on("disconnect",(async pt=>{const ft=await ut.requestContext.getAsync(ct);try{const ct=await ft[dt.propertyName].apply(ft,[pt]);await this.bindSocketResponse(ct,ut,dt.propertyName,_t)}catch(ct){this.logger.error(ct)}}))}else{_t[dt.propertyName].responseEvents.push(dt)}}}}));if(_t.adapter&&_t.adapter.on){_t.adapter.on("error",(ct=>{this.logger.error(ct)}))}_t.on("error",(ct=>{this.logger.error(ct)}))}async bindSocketResponse(ct,ut,pt,dt){if(ct&&dt[pt]){for(const ft of dt[pt].responseEvents){if(ft.eventType===yt.WSEventTypeEnum.EMIT){if(ft.roomName.length){ut=ft.roomName.reduce(((ct,ut)=>ct.to(ut)),ut)}ut.emit.apply(ut,[ft.messageEventName].concat(ct))}else if(ft.eventType===yt.WSEventTypeEnum.BROADCAST){ut.nsp.emit.apply(ut.nsp,[].concat(ct))}}}}getFrameworkName(){return"midway:socketIO"}useConnectionMiddleware(ct){this.connectionMiddlewareManager.insertLast(ct)}getConnectionMiddleware(){return this.connectionMiddlewareManager}};vt=dt([(0,yt.Framework)()],vt);ut.MidwaySocketIOFramework=vt},87735:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=ut.createRedisAdapter=ut.Framework=void 0;var _t=pt(53739);Object.defineProperty(ut,"Framework",{enumerable:true,get:function(){return _t.MidwaySocketIOFramework}});var mt=pt(47191);Object.defineProperty(ut,"createRedisAdapter",{enumerable:true,get:function(){return mt.createRedisAdapter}});ft(pt(94460),ut);var ht=pt(96313);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return ht.SocketIOConfiguration}})},94460:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},47191:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.createRedisAdapter=void 0;const dt=pt(56748);function createRedisAdapter(ct){if(ct.host&&ct.port){return(0,dt.createAdapter)("redis://"+ct.host+":"+ct.port,ct)}if(ct.pubClient&&ct.subClient){return(0,dt.createAdapter)(ct)}throw new Error("error socket adapter options")}ut.createRedisAdapter=createRedisAdapter},95567:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});const dt=pt(16928);ut["default"]=ct=>({staticFile:{dirs:{default:{prefix:"/public",dir:(0,dt.join)(ct.appDir,"public")}},dynamic:true,preload:false,buffer:false,maxFiles:1e3}})},40647:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.StaticFileConfiguration=void 0;const _t=pt(46123);const mt=pt(88218);const ht=pt(95567);let yt=class StaticFileConfiguration{async onConfigLoad(){if(this.applicationManager.getApplication("faas")){return{staticFile:{buffer:true}}}}async onReady(ct){this.applicationManager.getApplications(["koa","faas","egg"]).forEach((ut=>{if(ct.hasNamespace("cross-domain")){ut.getMiddleware().insertAfter(mt.StaticMiddleware,"cors")}else{ut.getMiddleware().insertFirst(mt.StaticMiddleware)}}))}};dt([(0,_t.Inject)(),ft("design:type",_t.MidwayApplicationManager)],yt.prototype,"applicationManager",void 0);yt=dt([(0,_t.Configuration)({namespace:"static-file",importConfigs:[{default:ht}]})],yt);ut.StaticFileConfiguration=yt},44803:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.DirectoryNotFoundError=ut.StaticFileErrorEnum=void 0;const dt=pt(46123);ut.StaticFileErrorEnum=(0,dt.registerErrorCode)("static_file",{DIRECTORY_NOT_EXISTS:1e4});class DirectoryNotFoundError extends dt.MidwayError{constructor(ct){super(`Path ${ct} not exist, please check it.`,ut.StaticFileErrorEnum.DIRECTORY_NOT_EXISTS)}}ut.DirectoryNotFoundError=DirectoryNotFoundError},2865:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=void 0;var _t=pt(40647);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.StaticFileConfiguration}});ft(pt(88218),ut);ft(pt(20066),ut);ft(pt(44803),ut)},20066:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},88218:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.StaticMiddleware=void 0;const _t=pt(46123);const mt=pt(42613);const ht=pt(4239);const yt=pt(91404);const vt=pt(93546);const St=pt(44803);const bt=pt(79896);let xt=class StaticMiddleware{async resolve(ct){const ut=Object.values(this.staticFileConfig.dirs);if(this.staticFileConfig.dir){ut.push(this.staticFileConfig.dir)}const pt=[];function rangeMiddleware(ct,ut){const dt=pt.some((ut=>ct.path.startsWith(ut)));if(dt){return vt(ct,ut)}return ut()}const dt=[rangeMiddleware];for(const ct of ut){mt(_t.Types.isObject(ct)||_t.Types.isString(ct),"`config.static.dir` must be `string | Array<string|object>`.");const ut=Object.assign({},this.staticFileConfig,ct);if(ut.dynamic&&!ut.files){ut.files=new yt(ut.maxFiles)}if(ut.prefix){pt.push(ut.prefix)}if(this.environmentService.isPkgEnvironment()){if(!bt.existsSync(ut.dir)){throw new St.DirectoryNotFoundError(ut.dir)}}else{if(!await _t.FileUtils.exists(ut.dir)){throw new St.DirectoryNotFoundError(ut.dir)}}this.logger.info("[midway:static] starting static serve %s -> %s",ut.prefix,ut.dir);dt.push(ht(ut))}return await this.middlewareService.compose(dt,ct,"staticFile")}static getName(){return"staticFile"}};dt([(0,_t.Config)("staticFile"),ft("design:type",Object)],xt.prototype,"staticFileConfig",void 0);dt([(0,_t.Inject)(),ft("design:type",_t.MidwayMiddlewareService)],xt.prototype,"middlewareService",void 0);dt([(0,_t.Inject)(),ft("design:type",_t.MidwayEnvironmentService)],xt.prototype,"environmentService",void 0);dt([(0,_t.Logger)("coreLogger"),ft("design:type",Object)],xt.prototype,"logger",void 0);xt=dt([(0,_t.Middleware)()],xt);ut.StaticMiddleware=xt},73455:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.isEnumMetadata=ut.isEnumDefined=ut.isEnumArray=ut.addEnumSchema=ut.addEnumArraySchema=ut.getEnumType=ut.getEnumValues=void 0;function getEnumValues(ct){if(Array.isArray(ct)){return ct}if(typeof ct!=="object"){return[]}const ut=Object.keys(ct).filter((ct=>isNaN(Number(ct)))).map((ut=>ct[ut]));return Array.from(new Set(ut))}ut.getEnumValues=getEnumValues;function getEnumType(ct){const ut=ct.filter((ct=>typeof ct==="string")).length>0;return ut?"string":"number"}ut.getEnumType=getEnumType;function addEnumArraySchema(ct,ut){const pt=ct.schema||{};ct.schema=pt;pt.type="array";delete ct.isArray;const dt=getEnumValues(ut.enum);pt.items={type:getEnumType(dt),enum:dt};if(ut.enumName){ct.enumName=ut.enumName}}ut.addEnumArraySchema=addEnumArraySchema;function addEnumSchema(ct,ut){const pt=ct.schema||{};const dt=getEnumValues(ut.enum);ct.schema=pt;pt.enum=dt;pt.type=getEnumType(dt);if(ut.enumName){ct.enumName=ut.enumName}}ut.addEnumSchema=addEnumSchema;const isEnumArray=ct=>ct.isArray&&ct.enum;ut.isEnumArray=isEnumArray;const isEnumDefined=ct=>ct.enum;ut.isEnumDefined=isEnumDefined;const isEnumMetadata=ct=>{var ut;return ct.enum||ct.isArray&&((ut=ct.items)===null||ut===void 0?void 0:ut["enum"])};ut.isEnumMetadata=isEnumMetadata},80163:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.HttpStatus=void 0;var pt;(function(ct){ct[ct["CONTINUE"]=100]="CONTINUE";ct[ct["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";ct[ct["PROCESSING"]=102]="PROCESSING";ct[ct["EARLYHINTS"]=103]="EARLYHINTS";ct[ct["OK"]=200]="OK";ct[ct["CREATED"]=201]="CREATED";ct[ct["ACCEPTED"]=202]="ACCEPTED";ct[ct["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";ct[ct["NO_CONTENT"]=204]="NO_CONTENT";ct[ct["RESET_CONTENT"]=205]="RESET_CONTENT";ct[ct["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";ct[ct["AMBIGUOUS"]=300]="AMBIGUOUS";ct[ct["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";ct[ct["FOUND"]=302]="FOUND";ct[ct["SEE_OTHER"]=303]="SEE_OTHER";ct[ct["NOT_MODIFIED"]=304]="NOT_MODIFIED";ct[ct["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";ct[ct["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";ct[ct["BAD_REQUEST"]=400]="BAD_REQUEST";ct[ct["UNAUTHORIZED"]=401]="UNAUTHORIZED";ct[ct["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";ct[ct["FORBIDDEN"]=403]="FORBIDDEN";ct[ct["NOT_FOUND"]=404]="NOT_FOUND";ct[ct["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";ct[ct["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";ct[ct["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";ct[ct["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";ct[ct["CONFLICT"]=409]="CONFLICT";ct[ct["GONE"]=410]="GONE";ct[ct["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";ct[ct["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";ct[ct["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";ct[ct["URI_TOO_LONG"]=414]="URI_TOO_LONG";ct[ct["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";ct[ct["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";ct[ct["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";ct[ct["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";ct[ct["MISDIRECTED"]=421]="MISDIRECTED";ct[ct["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";ct[ct["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";ct[ct["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";ct[ct["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";ct[ct["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";ct[ct["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";ct[ct["BAD_GATEWAY"]=502]="BAD_GATEWAY";ct[ct["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";ct[ct["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";ct[ct["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(pt=ut.HttpStatus||(ut.HttpStatus={}))},68641:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.swagger=void 0;const dt=pt(3376);const ft=pt(46123);const _t=(0,ft.safeRequire)("swagger-ui-dist");ut.swagger={title:"My Project",description:"This is a swagger-ui for midwayjs project",version:"1.0.0",swaggerPath:"/swagger-ui",swaggerUIRender:_t&&_t.getAbsoluteFSPath?dt.renderSwaggerUIDist:dt.renderSwaggerUIRemote,swaggerUIRenderOptions:{},isGenerateTagForController:true}},9317:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SwaggerConfiguration=void 0;const _t=pt(46123);const mt=pt(49179);const ht=pt(68641);let yt=class SwaggerConfiguration{async onReady(ct){const ut=this.applicationManager.getApplications(["express","koa","egg","faas"]);if(ut.length){const pt=await ct.getAsync(mt.SwaggerExplorer);pt.scanApp();let dt=this.configService.getConfiguration("globalPrefix")||this.configService.getConfiguration("koa.globalPrefix")||this.configService.getConfiguration("express.globalPrefix")||this.configService.getConfiguration("egg.globalPrefix");if(dt){if(!/^\//.test(dt)){dt="/"+dt}pt.addGlobalPrefix(dt)}ut.forEach((ct=>{ct.useMiddleware(mt.SwaggerMiddleware)}))}}};dt([(0,_t.Inject)(),ft("design:type",_t.MidwayApplicationManager)],yt.prototype,"applicationManager",void 0);dt([(0,_t.Inject)(),ft("design:type",_t.MidwayConfigService)],yt.prototype,"configService",void 0);yt=dt([(0,_t.Configuration)({importConfigs:[{default:ht}],namespace:"swagger"})],yt);ut.SwaggerConfiguration=yt},48574:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.DECORATORS=ut.DECORATORS_METHOD_METADATA=ut.DECORATORS_CLASS_METADATA=ut.DECORATORS_PREFIX=void 0;ut.DECORATORS_PREFIX="swagger";ut.DECORATORS_CLASS_METADATA="swagger:class_metadata";ut.DECORATORS_METHOD_METADATA="swagger:method_metadata";ut.DECORATORS={API_OPERATION:`${ut.DECORATORS_PREFIX}/apiOperation`,API_RESPONSE:`${ut.DECORATORS_PREFIX}/apiResponse`,API_TAGS:`${ut.DECORATORS_PREFIX}/apiUseTags`,API_PARAMETERS:`${ut.DECORATORS_PREFIX}/apiParameters`,API_HEADERS:`${ut.DECORATORS_PREFIX}/apiHeaders`,API_MODEL_PROPERTIES:`${ut.DECORATORS_PREFIX}/apiModelProperties`,API_EXTRA_MODEL:`${ut.DECORATORS_PREFIX}/apiExtraModel`,API_MODEL_PROPERTIES_ARRAY:`${ut.DECORATORS_PREFIX}/apiModelPropertiesArray`,API_SECURITY:`${ut.DECORATORS_PREFIX}/apiSecurity`,API_EXCLUDE_SECURITY:`${ut.DECORATORS_PREFIX}/apiExcludeSecurity`,API_EXCLUDE_ENDPOINT:`${ut.DECORATORS_PREFIX}/apiExcludeEndpoint`,API_EXCLUDE_CONTROLLER:`${ut.DECORATORS_PREFIX}/apiExcludeController`,API_EXTENSION:`${ut.DECORATORS_PREFIX}/apiExtension`}},51102:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiBasicAuth=void 0;const dt=pt(55118);function ApiBasicAuth(ct="basic"){return(0,dt.ApiSecurity)(ct)}ut.ApiBasicAuth=ApiBasicAuth},21873:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiBearerAuth=void 0;const dt=pt(55118);function ApiBearerAuth(ct="bearer"){return(0,dt.ApiSecurity)(ct)}ut.ApiBearerAuth=ApiBearerAuth},65288:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiBody=ut.BodyContentType=void 0;const dt=pt(73455);const ft=pt(15071);var _t;(function(ct){ct["FormUrlEncoded"]="application/x-www-form-urlencoded";ct["JSON"]="application/json";ct["Multipart"]="multipart/form-data";ct["MultipartMixed"]="multipart/mixed";ct["OctetStream"]="application/octet-stream"})(_t=ut.BodyContentType||(ut.BodyContentType={}));const mt={type:String,required:true};function ApiBody(ct){const[ut,pt]=(0,ft.getTypeIsArrayTuple)(ct.type,ct.isArray);const _t={in:"body",...ct,type:ut,isArray:pt};if((0,dt.isEnumArray)(ct)){(0,dt.addEnumArraySchema)(_t,ct)}else if((0,dt.isEnumDefined)(ct)){(0,dt.addEnumSchema)(_t,ct)}return(0,ft.createParamDecorator)(_t,mt)}ut.ApiBody=ApiBody},80222:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiCookieAuth=void 0;const dt=pt(55118);function ApiCookieAuth(ct="cookie"){return(0,dt.ApiSecurity)(ct)}ut.ApiCookieAuth=ApiCookieAuth},44097:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiExcludeController=void 0;const dt=pt(46123);const ft=pt(48574);function ApiExcludeController(ct=true){return ut=>{(0,dt.saveClassMetadata)(ft.DECORATORS.API_EXCLUDE_CONTROLLER,{disable:ct},ut)}}ut.ApiExcludeController=ApiExcludeController},61944:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiExcludeEndpoint=void 0;const dt=pt(48574);const ft=pt(15071);function ApiExcludeEndpoint(ct=true){return(0,ft.createMixedDecorator)(dt.DECORATORS.API_EXCLUDE_ENDPOINT,true)}ut.ApiExcludeEndpoint=ApiExcludeEndpoint},70821:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiExtension=void 0;const dt=pt(48574);const ft=pt(15071);function ApiExtension(ct,ut){if(!ct.startsWith("x-")){throw new Error("Extension key is not prefixed. Please ensure you prefix it with `x-`.")}const pt={[ct]:JSON.parse(JSON.stringify(ut))};return(0,ft.createMixedDecorator)(dt.DECORATORS.API_EXTENSION,pt)}ut.ApiExtension=ApiExtension},91582:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiExtraModel=void 0;const dt=pt(48574);const ft=pt(15071);function ApiExtraModel(ct){return(0,ft.createMixedDecorator)(dt.DECORATORS.API_EXTRA_MODEL,ct)}ut.ApiExtraModel=ApiExtraModel},40301:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiHeaders=ut.ApiHeader=void 0;const dt=pt(48574);const ft=pt(73455);const _t=pt(15071);const mt={name:""};function ApiHeader(ct){const ut={name:!ct.name?mt.name:ct.name,in:"header",description:ct.description,required:ct.required,schema:{...ct.schema||{},type:"string"}};if(ct.enum){const pt=(0,ft.getEnumValues)(ct.enum);ut.schema={enum:pt,type:(0,ft.getEnumType)(pt)}}return(ct,pt,ft)=>{if(ft){return(0,_t.createMixedDecorator)(dt.DECORATORS.API_HEADERS,ut)(ct,pt,ft)}return(0,_t.createMixedDecorator)(dt.DECORATORS.API_HEADERS,ut)(ct,undefined,undefined)}}ut.ApiHeader=ApiHeader;const ApiHeaders=ct=>(ut,pt,dt)=>{ct.forEach((ct=>ApiHeader(ct)(ut,pt,dt)))};ut.ApiHeaders=ApiHeaders},10555:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiOAuth2=void 0;const dt=pt(55118);function ApiOAuth2(ct,ut="oauth2"){return(0,dt.ApiSecurity)(ut,ct)}ut.ApiOAuth2=ApiOAuth2},39025:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiOperation=void 0;const dt=pt(48574);const ft=pt(15071);const _t={summary:""};function ApiOperation(ct){return(0,ft.createMixedDecorator)(dt.DECORATORS.API_OPERATION,{..._t,...ct})}ut.ApiOperation=ApiOperation},58729:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiParam=void 0;const dt=pt(15071);const ft=pt(73455);const _t={name:"",required:true};function ApiParam(ct){const ut={name:!ct.name?_t.name:ct.name,in:"path",...ct};const pt=ct;if(pt.enum){ut.schema=ut.schema||{};const ct=ut.schema;const dt=(0,ft.getEnumValues)(pt.enum);ct.type=(0,ft.getEnumType)(dt);ct.enum=dt;if(pt.enumName){ut.enumName=pt.enumName}}return(0,dt.createParamDecorator)(ut,_t)}ut.ApiParam=ApiParam},13529:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiResponseProperty=ut.ApiPropertyOptional=ut.createApiPropertyDecorator=ut.ApiProperty=void 0;const dt=pt(48574);const ft=pt(73455);const _t=pt(15071);const isEnumArray=ct=>ct.isArray&&!!ct.enum;function ApiProperty(ct={}){return createApiPropertyDecorator(ct)}ut.ApiProperty=ApiProperty;function createApiPropertyDecorator(ct={}){const[ut,pt]=(0,_t.getTypeIsArrayTuple)(ct.type,ct.isArray);ct={...ct,type:ut};if(isEnumArray(ct)){ct.type="array";const ut=(0,ft.getEnumValues)(ct.enum);ct.items={type:(0,ft.getEnumType)(ut),enum:ut};delete ct.enum}else if(ct.enum){const ut=(0,ft.getEnumValues)(ct.enum);ct.enum=ut;ct.type=(0,ft.getEnumType)(ut)}if(pt){ct.type="array";ct.items={type:ut}}return(0,_t.createPropertyDecorator)(dt.DECORATORS.API_MODEL_PROPERTIES,ct)}ut.createApiPropertyDecorator=createApiPropertyDecorator;function ApiPropertyOptional(ct={}){return ApiProperty({...ct,required:false})}ut.ApiPropertyOptional=ApiPropertyOptional;function ApiResponseProperty(ct={}){return ApiProperty({readOnly:true,...ct})}ut.ApiResponseProperty=ApiResponseProperty},60360:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiQuery=void 0;const dt=pt(73455);const ft=pt(15071);const _t={name:"",required:true};function ApiQuery(ct){const ut=ct;const[pt,mt]=(0,ft.getTypeIsArrayTuple)(ut.type,ut.isArray);const ht={name:!ct.name?_t.name:ct.name,in:"query",...ct,type:pt};if((0,dt.isEnumArray)(ct)){(0,dt.addEnumArraySchema)(ht,ct)}else if((0,dt.isEnumDefined)(ct)){(0,dt.addEnumSchema)(ht,ct)}if(mt){ht.isArray=mt}return(0,ft.createParamDecorator)(ht,_t)}ut.ApiQuery=ApiQuery},95555:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiDefaultResponse=ut.ApiUnsupportedMediaTypeResponse=ut.ApiUnprocessableEntityResponse=ut.ApiServiceUnavailableResponse=ut.ApiRequestTimeoutResponse=ut.ApiPayloadTooLargeResponse=ut.ApiPreconditionFailedResponse=ut.ApiNotImplementedResponse=ut.ApiNotAcceptableResponse=ut.ApiMethodNotAllowedResponse=ut.ApiGoneResponse=ut.ApiGatewayTimeoutResponse=ut.ApiForbiddenResponse=ut.ApiConflictResponse=ut.ApiBadGatewayResponse=ut.ApiInternalServerErrorResponse=ut.ApiNotFoundResponse=ut.ApiTooManyRequestsResponse=ut.ApiUnauthorizedResponse=ut.ApiBadRequestResponse=ut.ApiFoundResponse=ut.ApiMovedPermanentlyResponse=ut.ApiNoContentResponse=ut.ApiAcceptedResponse=ut.ApiCreatedResponse=ut.ApiOkResponse=ut.ApiResponse=void 0;const dt=pt(48574);const ft=pt(15071);const _t=pt(80163);function ApiResponse(ct){const[ut,pt]=(0,ft.getTypeIsArrayTuple)(ct.type,ct.isArray);ct.type=ut;ct.isArray=pt;ct.description=ct.description?ct.description:"";const _t={[ct.status||"default"]:ct};return(0,ft.createMixedDecorator)(dt.DECORATORS.API_RESPONSE,_t)}ut.ApiResponse=ApiResponse;const ApiOkResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.OK});ut.ApiOkResponse=ApiOkResponse;const ApiCreatedResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.CREATED});ut.ApiCreatedResponse=ApiCreatedResponse;const ApiAcceptedResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.ACCEPTED});ut.ApiAcceptedResponse=ApiAcceptedResponse;const ApiNoContentResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.NO_CONTENT});ut.ApiNoContentResponse=ApiNoContentResponse;const ApiMovedPermanentlyResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.MOVED_PERMANENTLY});ut.ApiMovedPermanentlyResponse=ApiMovedPermanentlyResponse;const ApiFoundResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.FOUND});ut.ApiFoundResponse=ApiFoundResponse;const ApiBadRequestResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.BAD_REQUEST});ut.ApiBadRequestResponse=ApiBadRequestResponse;const ApiUnauthorizedResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.UNAUTHORIZED});ut.ApiUnauthorizedResponse=ApiUnauthorizedResponse;const ApiTooManyRequestsResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.TOO_MANY_REQUESTS});ut.ApiTooManyRequestsResponse=ApiTooManyRequestsResponse;const ApiNotFoundResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.NOT_FOUND});ut.ApiNotFoundResponse=ApiNotFoundResponse;const ApiInternalServerErrorResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.INTERNAL_SERVER_ERROR});ut.ApiInternalServerErrorResponse=ApiInternalServerErrorResponse;const ApiBadGatewayResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.BAD_GATEWAY});ut.ApiBadGatewayResponse=ApiBadGatewayResponse;const ApiConflictResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.CONFLICT});ut.ApiConflictResponse=ApiConflictResponse;const ApiForbiddenResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.FORBIDDEN});ut.ApiForbiddenResponse=ApiForbiddenResponse;const ApiGatewayTimeoutResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.GATEWAY_TIMEOUT});ut.ApiGatewayTimeoutResponse=ApiGatewayTimeoutResponse;const ApiGoneResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.GONE});ut.ApiGoneResponse=ApiGoneResponse;const ApiMethodNotAllowedResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.METHOD_NOT_ALLOWED});ut.ApiMethodNotAllowedResponse=ApiMethodNotAllowedResponse;const ApiNotAcceptableResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.NOT_ACCEPTABLE});ut.ApiNotAcceptableResponse=ApiNotAcceptableResponse;const ApiNotImplementedResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.NOT_IMPLEMENTED});ut.ApiNotImplementedResponse=ApiNotImplementedResponse;const ApiPreconditionFailedResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.PRECONDITION_FAILED});ut.ApiPreconditionFailedResponse=ApiPreconditionFailedResponse;const ApiPayloadTooLargeResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.PAYLOAD_TOO_LARGE});ut.ApiPayloadTooLargeResponse=ApiPayloadTooLargeResponse;const ApiRequestTimeoutResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.REQUEST_TIMEOUT});ut.ApiRequestTimeoutResponse=ApiRequestTimeoutResponse;const ApiServiceUnavailableResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.SERVICE_UNAVAILABLE});ut.ApiServiceUnavailableResponse=ApiServiceUnavailableResponse;const ApiUnprocessableEntityResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.UNPROCESSABLE_ENTITY});ut.ApiUnprocessableEntityResponse=ApiUnprocessableEntityResponse;const ApiUnsupportedMediaTypeResponse=(ct={})=>ApiResponse({...ct,status:_t.HttpStatus.UNSUPPORTED_MEDIA_TYPE});ut.ApiUnsupportedMediaTypeResponse=ApiUnsupportedMediaTypeResponse;const ApiDefaultResponse=(ct={})=>ApiResponse({...ct,status:"default"});ut.ApiDefaultResponse=ApiDefaultResponse},55118:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiExcludeSecurity=ut.ApiSecurity=void 0;const dt=pt(48574);const ft=pt(15071);function ApiSecurity(ct,ut=[]){let pt;if(typeof ct==="string"){pt={[ct]:ut||[]}}else{pt=ct}return(0,ft.createMixedDecorator)(dt.DECORATORS.API_SECURITY,pt)}ut.ApiSecurity=ApiSecurity;function ApiExcludeSecurity(){return(0,ft.createMixedDecorator)(dt.DECORATORS.API_EXCLUDE_SECURITY,true)}ut.ApiExcludeSecurity=ApiExcludeSecurity},37505:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.ApiTags=void 0;const dt=pt(48574);const ft=pt(15071);function ApiTags(ct){return(0,ft.createMixedDecorator)(dt.DECORATORS.API_TAGS,ct)}ut.ApiTags=ApiTags},15071:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.getSchemaPath=ut.getTypeIsArrayTuple=ut.createParamDecorator=ut.createMixedDecorator=ut.createPropertyDecorator=void 0;const dt=pt(46123);const ft=pt(48574);function createPropertyDecorator(ct,ut){return(0,dt.createCustomPropertyDecorator)(ct,ut,false)}ut.createPropertyDecorator=createPropertyDecorator;function createMixedDecorator(ct,ut){return(pt,_t)=>{if(_t){(0,dt.attachPropertyDataToClass)(ft.DECORATORS_METHOD_METADATA,{key:ct,propertyName:_t,metadata:ut},pt,_t)}else{(0,dt.attachClassMetadata)(ft.DECORATORS_CLASS_METADATA,{key:ct,metadata:ut},pt)}}}ut.createMixedDecorator=createMixedDecorator;function createParamDecorator(ct,ut){return createMixedDecorator(ft.DECORATORS.API_PARAMETERS,{...ut,...ct})}ut.createParamDecorator=createParamDecorator;function getTypeIsArrayTuple(ct,ut){if(!ct){return[ct,ut]}if(ut){return[ct,ut]}const pt=Array.isArray(ct);const dt=pt?ct[0]:ct;return[dt,pt]}ut.getTypeIsArrayTuple=getTypeIsArrayTuple;function getSchemaPath(ct){let ut=ct;if(typeof ct!=="string"){ut=ct?ct.name:ct}return`#/components/schemas/${ut}`}ut.getSchemaPath=getSchemaPath},74398:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.getSchemaPath=ut.ApiResponseProperty=ut.ApiPropertyOptional=ut.ApiProperty=void 0;ft(pt(65288),ut);ft(pt(61944),ut);ft(pt(44097),ut);ft(pt(40301),ut);ft(pt(39025),ut);ft(pt(58729),ut);var _t=pt(13529);Object.defineProperty(ut,"ApiProperty",{enumerable:true,get:function(){return _t.ApiProperty}});Object.defineProperty(ut,"ApiPropertyOptional",{enumerable:true,get:function(){return _t.ApiPropertyOptional}});Object.defineProperty(ut,"ApiResponseProperty",{enumerable:true,get:function(){return _t.ApiResponseProperty}});ft(pt(60360),ut);ft(pt(95555),ut);ft(pt(37505),ut);ft(pt(70821),ut);ft(pt(51102),ut);ft(pt(21873),ut);ft(pt(80222),ut);ft(pt(10555),ut);ft(pt(55118),ut);ft(pt(91582),ut);var mt=pt(15071);Object.defineProperty(ut,"getSchemaPath",{enumerable:true,get:function(){return mt.getSchemaPath}})},2171:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.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(ct){this.document.info.title=ct;return this}setDescription(ct){this.document.info.description=ct;return this}setVersion(ct){this.document.info.version=ct;return this}setTermsOfService(ct){this.document.info.termsOfService=ct;return this}setContact(ct,ut,pt){this.document.info.contact={name:ct,url:ut,email:pt};return this}setLicense(ct,ut){this.document.info.license={name:ct,url:ut};return this}addServer(ct,ut,pt){this.document.servers.push({url:ct,description:ut,variables:pt});return this}setExternalDoc(ct,ut){this.document.externalDocs={description:ct,url:ut};return this}addPaths(ct){Object.assign(this.document.paths,ct);return this}getPaths(){return this.document.paths}setPaths(ct){this.document.paths=ct;return this}addSchema(ct){if(!this.document.components.schemas){this.document.components.schemas={}}Object.assign(this.document.components.schemas,ct);return this}getSchema(ct){var ut,pt;if((ut=this.document.components)===null||ut===void 0?void 0:ut.schemas){return(pt=this.document.components)===null||pt===void 0?void 0:pt.schemas[ct]}return undefined}addTag(ct,ut="",pt){const dt=this.document.tags||[];if(Array.isArray(ct)){const ut=ct;for(const pt of ut){if(!dt.find((ut=>ut.name===ct))){dt.push({name:pt,description:""})}}return this}if(!dt.find((ut=>ut.name===ct))){dt.push({name:ct,description:ut,externalDocs:pt})}else{dt.forEach((dt=>{if(dt.name===ct){if(ut){dt.description=ut}if(pt){dt.externalDocs=pt}}}))}this.document.tags=dt;return this}addSecurity(ct,ut){this.document.components.securitySchemes={...this.document.components.securitySchemes||{},[ct]:ut};return this}addSecurityRequirements(ct,ut=[]){let pt;if(typeof ct==="string"){pt={[ct]:ut}}else{pt=ct}this.document.security=(this.document.security||[]).concat({...pt});return this}addBearerAuth(ct={type:"http"},ut="bearer"){this.addSecurity(ut,{type:"http",scheme:"bearer",bearerFormat:"JWT",...ct});return this}addOAuth2(ct={type:"oauth2"},ut="oauth2"){if(!ut){ut="oauth2"}this.addSecurity(ut,{type:"oauth2",flows:{...ct===null||ct===void 0?void 0:ct.flows}});return this}addApiKey(ct={type:"apiKey"},ut="api_key"){if(!ut){ut="api_key"}this.addSecurity(ut,{type:"apiKey",in:"header",name:ut,...ct});return this}addBasicAuth(ct={type:"http"},ut="basic"){if(!ut){ut="basic"}this.addSecurity(ut,{type:"http",scheme:"basic",...ct});return this}addCookieAuth(ct="connect.sid",ut={type:"apiKey"},pt="cookie"){if(!ct){ct="connect.sid"}if(!pt){pt="cookie"}this.addSecurity(pt,{type:"apiKey",in:"cookie",name:ct,...ut});return this}sortTags(){const ct=this.document.tags;this.document.tags=ct.sort(((ct,ut)=>{const pt=ct.name;const dt=ut.name;const ft=pt.length>dt.length?dt.length:pt.length;for(let ct=0;ct<ft;ct++){if(pt.charCodeAt(ct)>dt.charCodeAt(ct)){return 1}else if(pt.charCodeAt(ct)<dt.charCodeAt(ct)){return-1}}return 0}))}build(){return this.document}}ut.DocumentBuilder=DocumentBuilder},49179:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.renderJSON=ut.renderSwaggerUIDist=ut.renderSwaggerUIRemote=ut.SwaggerMiddleware=ut.SwaggerExplorer=ut.Configuration=void 0;ft(pt(74398),ut);ft(pt(87448),ut);var _t=pt(9317);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.SwaggerConfiguration}});var mt=pt(33984);Object.defineProperty(ut,"SwaggerExplorer",{enumerable:true,get:function(){return mt.SwaggerExplorer}});var ht=pt(64811);Object.defineProperty(ut,"SwaggerMiddleware",{enumerable:true,get:function(){return ht.SwaggerMiddleware}});var yt=pt(3376);Object.defineProperty(ut,"renderSwaggerUIRemote",{enumerable:true,get:function(){return yt.renderSwaggerUIRemote}});Object.defineProperty(ut,"renderSwaggerUIDist",{enumerable:true,get:function(){return yt.renderSwaggerUIDist}});Object.defineProperty(ut,"renderJSON",{enumerable:true,get:function(){return yt.renderJSON}});ft(pt(48574),ut)},87448:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true})},33984:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SwaggerExplorer=void 0;const _t=pt(46123);const mt=pt(48574);const ht=pt(2171);const yt=pt(49179);const vt=pt(73455);let St=class SwaggerExplorer{constructor(){this.swaggerConfig={};this.documentBuilder=new ht.DocumentBuilder;this.operationIdFactory=(ct,ut)=>`${ct.toLowerCase()}_${ut.method.toLocaleLowerCase()}`}async init(){var ct,ut,pt,dt,ft,_t,mt,ht,yt,vt,St,bt,xt,$t,Et,Ct,Tt,wt,At,kt,It,Nt,Pt,Ot,Dt,Ft,Mt,Rt,Lt,Bt,Vt;this.documentBuilder.setTitle(this.swaggerConfig.title);this.documentBuilder.setVersion(this.swaggerConfig.version);this.documentBuilder.setDescription(this.swaggerConfig.description);if(((ct=this.swaggerConfig)===null||ct===void 0?void 0:ct.contact)&&typeof((ut=this.swaggerConfig)===null||ut===void 0?void 0:ut.contact)==="object"){this.documentBuilder.setContact((dt=(pt=this.swaggerConfig)===null||pt===void 0?void 0:pt.contact)===null||dt===void 0?void 0:dt.name,(_t=(ft=this.swaggerConfig)===null||ft===void 0?void 0:ft.contact)===null||_t===void 0?void 0:_t.url,(ht=(mt=this.swaggerConfig)===null||mt===void 0?void 0:mt.contact)===null||ht===void 0?void 0:ht.email)}if(((yt=this.swaggerConfig)===null||yt===void 0?void 0:yt.license)&&typeof((vt=this.swaggerConfig)===null||vt===void 0?void 0:vt.license)==="object"){this.documentBuilder.setLicense((bt=(St=this.swaggerConfig)===null||St===void 0?void 0:St.license)===null||bt===void 0?void 0:bt.name,($t=(xt=this.swaggerConfig)===null||xt===void 0?void 0:xt.license)===null||$t===void 0?void 0:$t.url)}if(this.swaggerConfig.termsOfService){this.documentBuilder.setTermsOfService(this.swaggerConfig.termsOfService)}if(((Et=this.swaggerConfig)===null||Et===void 0?void 0:Et.externalDocs)&&typeof((Ct=this.swaggerConfig)===null||Ct===void 0?void 0:Ct.externalDocs)==="object"){this.documentBuilder.setExternalDoc((wt=(Tt=this.swaggerConfig)===null||Tt===void 0?void 0:Tt.externalDocs)===null||wt===void 0?void 0:wt.description,(kt=(At=this.swaggerConfig)===null||At===void 0?void 0:At.externalDocs)===null||kt===void 0?void 0:kt.url)}if(((It=this.swaggerConfig)===null||It===void 0?void 0:It.servers)&&Array.isArray((Nt=this.swaggerConfig)===null||Nt===void 0?void 0:Nt.servers)){for(const ct of(Pt=this.swaggerConfig)===null||Pt===void 0?void 0:Pt.servers){this.documentBuilder.addServer(ct===null||ct===void 0?void 0:ct.url,ct===null||ct===void 0?void 0:ct.description,ct===null||ct===void 0?void 0:ct.variables)}}if(((Ot=this.swaggerConfig)===null||Ot===void 0?void 0:Ot.tags)&&Array.isArray((Dt=this.swaggerConfig)===null||Dt===void 0?void 0:Dt.tags)){for(const ct of(Ft=this.swaggerConfig)===null||Ft===void 0?void 0:Ft.tags){this.documentBuilder.addTag(ct.name,ct.description,ct.externalDocs)}}if((Rt=(Mt=this.swaggerConfig)===null||Mt===void 0?void 0:Mt.documentOptions)===null||Rt===void 0?void 0:Rt.operationIdFactory){this.operationIdFactory=this.swaggerConfig.documentOptions.operationIdFactory}if(Array.isArray((Lt=this.swaggerConfig)===null||Lt===void 0?void 0:Lt.auth)){for(const ct of(Bt=this.swaggerConfig)===null||Bt===void 0?void 0:Bt.auth){this.setAuth(ct)}}else{this.setAuth((Vt=this.swaggerConfig)===null||Vt===void 0?void 0:Vt.auth)}}addGlobalPrefix(ct){if(!ct){return}const ut=this.documentBuilder.getPaths();const pt={};for(const[dt,ft]of Object.entries(ut)){if(!/^\//.test(dt)){pt[`${ct}/${dt}`]=ft}else{pt[`${ct}${dt}`]=ft}}this.documentBuilder.setPaths(pt)}scanApp(){var ct;const ut=(0,_t.listModule)(_t.CONTROLLER_KEY);for(const ct of ut){this.generatePath(ct)}if((ct=this.swaggerConfig)===null||ct===void 0?void 0:ct.tagSortable){this.documentBuilder.sortTags()}}getData(){return this.documentBuilder.build()}getDocumentBuilder(){return this.documentBuilder}generatePath(ct){var ut;const pt=(0,_t.getClassMetadata)(mt.DECORATORS.API_EXCLUDE_CONTROLLER,ct);if(pt&&pt.disable){return}const dt=(ut=this.swaggerConfig.isGenerateTagForController)!==null&&ut!==void 0?ut:true;this.parseExtraModel(ct);const ft=(0,_t.getClassMetadata)(mt.DECORATORS_CLASS_METADATA,ct)||[];const ht=(0,_t.getClassMetadata)(_t.INJECT_CUSTOM_PARAM,ct)||[];const yt=(0,_t.getClassMetadata)(_t.CONTROLLER_KEY,ct);const vt=yt.prefix;const St=ft.filter((ct=>ct.key===mt.DECORATORS.API_TAGS));let bt=[];const xt=[];if(St.length>0){bt=parseTags(St);bt.forEach((ct=>{addTag(ct,xt)}))}else{if(dt){const ct={name:"",description:""};if(vt!=="/"){ct.name=(yt===null||yt===void 0?void 0:yt.routerOptions.tagName)||(/^\//.test(vt)?vt.split("/")[1]:vt);ct.description=(yt===null||yt===void 0?void 0:yt.routerOptions.description)||ct.name}else{ct.name=yt===null||yt===void 0?void 0:yt.routerOptions.tagName;ct.description=(yt===null||yt===void 0?void 0:yt.routerOptions.description)||ct.name}if(ct.name){bt.push(ct.name);addTag([ct.name,ct.description],xt)}}else{}}const $t=(0,_t.getClassMetadata)(_t.WEB_ROUTER_KEY,ct);let Et=ft.filter((ct=>ct.key===mt.DECORATORS.API_HEADERS));if(Et.length>0){Et=Et.map((ct=>ct.metadata))}const Ct=ft.filter((ct=>ct.key===mt.DECORATORS.API_SECURITY));const Tt={};if($t&&typeof $t[Symbol.iterator]==="function"){for(const ut of $t){let pt=(vt+ut.path).replace("//","/");pt=replaceUrl(pt,parseParamsInPath(pt));const dt=(0,_t.getPropertyDataFromClass)(mt.DECORATORS_METHOD_METADATA,ct,ut.method)||[];const yt=dt.filter((ct=>ct.key===mt.DECORATORS.API_SECURITY));const St=dt.filter((ct=>ct.key===mt.DECORATORS.API_EXCLUDE_ENDPOINT&&ct.propertyName===ut.method));if(St[0]){continue}if(this.swaggerConfig.routerFilter){const ct=this.swaggerConfig.routerFilter(pt,ut);if(ct){continue}}const $t=ht[ut.method]||[];const wt=$t.filter((ct=>{var ut;return ct.key===_t.WEB_ROUTER_PARAM_KEY&&((ut=ct===null||ct===void 0?void 0:ct.metadata)===null||ut===void 0?void 0:ut.type)===_t.RouteParamTypes.BODY}));if(wt.length>1){continue}this.generateRouteMethod(pt,ut,Tt,dt,$t,Et,ct);if(Tt[pt][ut.requestMethod].tags.length===0){Tt[pt][ut.requestMethod].tags=bt}else{Tt[pt][ut.requestMethod].tags.forEach((ct=>{addTag(ct,xt)}))}const At=dt.filter((ct=>ct.key===mt.DECORATORS.API_EXTENSION&&ct.propertyName===ut.method));for(const ct of At){if(ct.metadata){Object.assign(Tt[pt][ut.requestMethod],ct.metadata)}}const kt=dt.find((ct=>ct.key===mt.DECORATORS.API_EXCLUDE_SECURITY));const It=yt.length>0;const Nt=ft.find((ct=>ct.key===mt.DECORATORS.API_EXCLUDE_SECURITY));const Pt=Ct.length>0;if(kt){Tt[pt][ut.requestMethod].security=[]}else if(It){Tt[pt][ut.requestMethod].security=yt.map((ct=>ct.metadata)).filter(Boolean)}else if(Nt){Tt[pt][ut.requestMethod].security=[]}else if(Pt){Tt[pt][ut.requestMethod].security=Ct.map((ct=>ct.metadata)).filter(Boolean)}}}this.documentBuilder.addPaths(Tt);if(Object.keys(Tt).length>0){xt.forEach((ct=>{if(Array.isArray(ct)){this.documentBuilder.addTag(ct[0],ct[1])}else{this.documentBuilder.addTag(ct)}}))}}generateRouteMethod(ct,ut,pt,dt,ft,ht,vt){var St,bt,xt,$t,Et,Ct,Tt,wt,At,kt,It,Nt,Pt,Ot,Dt,Ft,Mt,Rt,Lt;const Bt=dt.filter((ct=>ct.key===mt.DECORATORS.API_OPERATION&&ct.propertyName===ut.method))[0];const Vt=dt.filter((ct=>ct.key===mt.DECORATORS.API_TAGS&&ct.propertyName===ut.method));const jt=parseTags(Vt);let Ut=pt[ct];if(!Ut){Ut={}}const Jt=[];Ut[ut.requestMethod]={summary:getNotEmptyValue((St=Bt===null||Bt===void 0?void 0:Bt.metadata)===null||St===void 0?void 0:St.summary,ut.summary),description:getNotEmptyValue((bt=Bt===null||Bt===void 0?void 0:Bt.metadata)===null||bt===void 0?void 0:bt.description,ut.description),operationId:((xt=Bt===null||Bt===void 0?void 0:Bt.metadata)===null||xt===void 0?void 0:xt.operationId)||this.getOperationId(vt.name,ut),tags:jt.length?jt:(Et=($t=Bt===null||Bt===void 0?void 0:Bt.metadata)===null||$t===void 0?void 0:$t.tags)!==null&&Et!==void 0?Et:[]};if(((Ct=Bt===null||Bt===void 0?void 0:Bt.metadata)===null||Ct===void 0?void 0:Ct.deprecated)!=null){Ut[ut.requestMethod].deprecated=!!((Tt=Bt===null||Bt===void 0?void 0:Bt.metadata)===null||Tt===void 0?void 0:Tt.deprecated)}const zt=ft.filter((ct=>{var ut;return ct.key===_t.WEB_ROUTER_PARAM_KEY&&((ut=ct===null||ct===void 0?void 0:ct.metadata)===null||ut===void 0?void 0:ut.type)!==_t.RouteParamTypes.CUSTOM}));const Wt=(0,_t.getMethodParamTypes)(vt,ut.method);const qt=dt.filter((ct=>ct.key===mt.DECORATORS.API_PARAMETERS&&ct.propertyName===ut.method));for(const ct of qt){if(ct.metadata.schema===undefined){ct.metadata.schema={};if(ct.metadata.type){ct.metadata.schema["type"]=ct.metadata.type;delete ct.metadata.type}if(ct.metadata.isArray){ct.metadata.schema["items"]={type:ct.metadata.schema["type"]};ct.metadata.schema["type"]="array";delete ct.metadata.isArray}if(ct.metadata.enum!==undefined){ct.metadata.schema.enum=ct.metadata.enum;delete ct.metadata.enum}}else{delete ct.metadata.type;delete ct.metadata.isArray;delete ct.metadata.enum}const pt=ct.metadata;pt.schema=this.formatType(ct.metadata.schema);if(pt.in==="query"||pt.in==="path"||pt.in==="header"){Jt.push(pt)}else if(pt.in==="body"){pt.content=(wt=pt.content)!==null&&wt!==void 0?wt:{};if(Object.keys(pt.content).length===0){pt.content[pt.contentType||"application/json"]=(At=pt.content[pt.contentType||"application/json"])!==null&&At!==void 0?At:{schema:pt.schema}}for(const ct in pt.content){pt.content[ct].schema=this.formatType(pt.content[ct].schema)}Ut[ut.requestMethod].requestBody=(kt=Ut[ut.requestMethod].requestBody)!==null&&kt!==void 0?kt:{};Ut[ut.requestMethod].requestBody.description=(It=Ut[ut.requestMethod].requestBody.description)!==null&&It!==void 0?It:pt.description;Ut[ut.requestMethod].requestBody.content=(Nt=Ut[ut.requestMethod].requestBody.content)!==null&&Nt!==void 0?Nt:pt.content;Ut[ut.requestMethod].requestBody.required=(Pt=Ut[ut.requestMethod].requestBody.required)!==null&&Pt!==void 0?Pt:pt.required}}for(const pt of zt){const dt=Wt[pt.parameterIndex];const ft={name:(Ot=pt===null||pt===void 0?void 0:pt.metadata)===null||Ot===void 0?void 0:Ot.propertyData,in:convertTypeToString((Dt=pt.metadata)===null||Dt===void 0?void 0:Dt.type),required:false};const mt=Jt.find((ct=>{var ut;return ct.name===((ut=pt===null||pt===void 0?void 0:pt.metadata)===null||ut===void 0?void 0:ut.propertyData)&&ct.in===ft.in}));if(mt){continue}if(ft.in==="path"){ft.required=true;if(ct.indexOf("{"+ft.name+"}")===-1){continue}}if(_t.Types.isClass(dt)){this.parseClzz(dt)}if(ft.in==="query"||ft.in==="path"){if(_t.Types.isClass(dt)){const ct=this.documentBuilder.getSchema(dt.name);Object.keys(ct.properties).forEach((ut=>{var pt,dt;const _t={name:ut,in:ft.in,description:(pt=ct.properties[ut])===null||pt===void 0?void 0:pt.description,schema:ct.properties[ut],required:((dt=ct.required)===null||dt===void 0?void 0:dt.includes(ut))||false};Jt.push(_t)}));continue}else{if(!ft.name){continue}ft.schema={type:convertSchemaType((Ft=dt===null||dt===void 0?void 0:dt.name)!==null&&Ft!==void 0?Ft:dt)}}}else if(ft.in==="body"){if(ut.requestMethod===_t.RequestMethod.GET){continue}if(Ut[ut.requestMethod].requestBody){continue}if(((Mt=pt.metadata)===null||Mt===void 0?void 0:Mt.type)===_t.RouteParamTypes.FILESSTREAM){ft.content={};ft.content[yt.BodyContentType.Multipart]={schema:{type:"object",properties:{files:{type:"array",items:{type:"string",format:"binary"},description:ft.description}}}}}else if(((Rt=pt.metadata)===null||Rt===void 0?void 0:Rt.type)===_t.RouteParamTypes.FILESTREAM){ft.content={};ft.content[yt.BodyContentType.Multipart]={schema:{type:"object",properties:{file:{type:"string",format:"binary",description:ft.description}}}}}else{if(_t.Types.isClass(dt)){ft.content={"application/json":{schema:{$ref:"#/components/schemas/"+dt.name}}}}else{ft.content={"text/plain":{schema:{type:convertSchemaType((Lt=dt===null||dt===void 0?void 0:dt.name)!==null&&Lt!==void 0?Lt:dt)}}}}}Ut[ut.requestMethod].requestBody={required:true,description:ft.description||ft.name,content:ft.content};continue}Jt.push(ft)}if(ht&&ht.length){ht.forEach((ct=>Jt.unshift(ct)))}const Ht=dt.filter((ct=>ct.key===mt.DECORATORS.API_HEADERS));if(Ht.length>0){Ht.forEach((ct=>Jt.unshift(ct.metadata)))}Ut[ut.requestMethod].parameters=Jt;const Kt=dt.filter((ct=>ct.key===mt.DECORATORS.API_RESPONSE&&ct.propertyName===ut.method));const Gt={};for(const ct of Kt){const ut=ct.metadata;const pt=Object.keys(ut);for(const ct of pt){const pt=ut[ct];if(pt.schema){pt.content={"application/json":{schema:this.formatType(pt.schema)}};delete pt.schema}else if(pt.type){if(_t.Types.isClass(pt.type)){this.parseClzz(pt.type);if(pt.isArray){pt.content={"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/"+pt.type.name}}}}}else{pt.content={"application/json":{schema:{$ref:"#/components/schemas/"+pt.type.name}}}}}else{pt.content={"text/plain":{schema:{type:convertSchemaType(pt.type)}}}}}delete pt.status;delete pt.type;delete pt.isArray;delete pt.format}Object.assign(Gt,ut)}if(Object.keys(Gt).length>0){Ut[ut.requestMethod].responses=Gt}else{Ut[ut.requestMethod].responses={200:{description:"OK"}}}pt[ct]=Ut}getOperationId(ct,ut){return this.operationIdFactory(ct,ut)}parseExtraModel(ct){const ut=(0,_t.getClassMetadata)(mt.DECORATORS_CLASS_METADATA,ct)||[];const pt=ut.filter((ct=>ct.key===mt.DECORATORS.API_EXTRA_MODEL));for(const ct of pt){if(Array.isArray(ct.metadata)){for(const ut of ct.metadata){this.parseClzz(ut)}}else{this.parseClzz(ct.metadata)}}}parseSubPropertyType(ct){var ut,pt,dt;let ft;if(ct===null||ct===void 0?void 0:ct.enum){ft={type:ct===null||ct===void 0?void 0:ct.type,enum:ct===null||ct===void 0?void 0:ct.enum,default:ct===null||ct===void 0?void 0:ct.default};if(ct===null||ct===void 0?void 0:ct.description){ft.description=ct===null||ct===void 0?void 0:ct.description}return ft}if((ut=ct===null||ct===void 0?void 0:ct.items)===null||ut===void 0?void 0:ut.enum){ft={type:ct===null||ct===void 0?void 0:ct.type,items:ct===null||ct===void 0?void 0:ct.items,default:ct===null||ct===void 0?void 0:ct.default};if(ct===null||ct===void 0?void 0:ct.description){ft.description=ct===null||ct===void 0?void 0:ct.description}return ft}let mt=false;let ht=parseTypeSchema(ct===null||ct===void 0?void 0:ct.type);ct===null||ct===void 0?true:delete ct.type;if(ht==="array"){mt=true;ht=parseTypeSchema((pt=ct===null||ct===void 0?void 0:ct.items)===null||pt===void 0?void 0:pt.type);ct===null||ct===void 0?true:delete ct.items.type}if(ct===null||ct===void 0?void 0:ct.oneOf){ft={oneOf:[]};ct===null||ct===void 0?void 0:ct.oneOf.forEach((ct=>{ft.push(this.parseSubPropertyType(ct))}));ct===null||ct===void 0?true:delete ct.oneOf}if(_t.Types.isClass(ht)){this.parseClzz(ht);if(mt){ft={type:"array",items:{$ref:"#/components/schemas/"+(ht===null||ht===void 0?void 0:ht.name)}}}else{ft={$ref:"#/components/schemas/"+(ht===null||ht===void 0?void 0:ht.name)}}delete ct.items}else{if(mt){if(!ht){if((dt=ct===null||ct===void 0?void 0:ct.items)===null||dt===void 0?void 0:dt["$ref"]){ct.items["$ref"]=parseTypeSchema(ct.items["$ref"])}ft={type:"array",items:ct===null||ct===void 0?void 0:ct.items}}else{ft={type:"array",items:{type:convertSchemaType((ht===null||ht===void 0?void 0:ht.name)||ht)}}}delete ct.items}else{ft={type:ht,format:ct===null||ct===void 0?void 0:ct.format};if(ft.type==="Date"){ft.type="string";if(!ft.format){ft.format="date"}}delete ct.format}}return Object.assign(ft,ct)}formatType(ct){if(ct===null){return null}if(ct.enum){if(Array.isArray(ct.enum)){ct.enum.map((ct=>this.formatType(ct)))}else{ct.enum=(0,vt.getEnumValues)(ct.enum)}}if(ct.not){ct.not=this.formatType(ct.not)}if(ct["$ref"]&&typeof ct["$ref"]==="function"){ct["$ref"]=ct["$ref"]()}if(ct.oneOf){ct.oneOf=ct.oneOf.map((ct=>this.formatType(ct)))}else if(ct.anyOf){ct.anyOf=ct.anyOf.map((ct=>this.formatType(ct)))}else if(ct.allOf){ct.allOf=ct.allOf.map((ct=>this.formatType(ct)))}["not","$ref","oneOf","anyOf","allOf"].forEach((ut=>{if(ct[ut]){delete ct["type"]}}));if(ct.properties){const ut={};for(const pt in ct.properties){ut[pt]=this.formatType(ct.properties[pt])}ct.properties=ut}if(ct.additionalProperties){ct.additionalProperties=this.formatType(ct.additionalProperties)}if(["string","number","boolean","integer"].includes(ct.type)){}else if(ct.type===Number){ct.type="number"}else if(ct.type===String){ct.type="string"}else if(ct.type===Boolean){ct.type="boolean"}else if(ct.type==="date"||ct.type==="Date"||ct.type===Date){ct.type="string";ct.format="date-time"}else if(ct.type===Array||ct.type==="array"){ct.type="array";if(ct.items){ct.items=this.formatType(ct.items)}}else if(Array.isArray(ct.type)){ct.items=this.formatType({type:ct.type[0]});ct.type="array"}else if(ct.type===Object||ct.type==="object"){ct.type="object"}else if(_t.Types.isClass(ct.type)){this.parseClzz(ct.type);ct["$ref"]="#/components/schemas/"+ct.type.name;delete ct["type"]}else if(ct.type instanceof Function){ct.type=ct.type();this.formatType(ct)}return ct}parseClzz(ct){if(this.documentBuilder.getSchema(ct.name)){return this.documentBuilder.getSchema(ct.name)}this.parseExtraModel(ct);const ut=(0,_t.getClassExtendedMetadata)(_t.INJECT_CUSTOM_PROPERTY,ct);const pt={type:"object",properties:{}};this.documentBuilder.addSchema({[ct.name]:pt});if(ut){for(const dt of Object.keys(ut)){const ft=ut[dt].metadata||{};if(!ft.type){ft.type=(0,_t.getPropertyType)(ct.prototype,dt).name}pt.properties[dt]=pt.properties[dt]||{};for(const ct in ft){if(ct==="required"&&ft["required"]){if(!pt.required){pt.required=[]}pt.required.push(dt)}else if(["oneOf","anyOf","allOf"].includes(ct)){pt.properties[dt][ct]=[];ft[ct].forEach((ut=>{pt.properties[dt][ct].push(this.formatType(ut))}))}else if(ct==="not"){pt.properties[dt][ct]=this.formatType(ft[ct])}else if(ct==="type"){this.formatType(ft);if(ft.type){pt.properties[dt].type=ft.type}if(ft["$ref"]){pt.properties[dt].$ref=ft["$ref"]}if(ft.items){pt.properties[dt].items=ft.items}if(ft.format){pt.properties[dt].format=ft.format}if(ft.pattern){pt.properties[dt].pattern=ft.pattern}if(ft.enum){pt.properties[dt].enum=ft.enum}}else if(ct==="items"||ct==="pattern"||ct==="format"||ct==="enum"||ct==="$ref"){}else{pt.properties[dt][ct]=ft[ct]}}}}return pt}setAuth(ct){if(!ct){return}const{authType:ut,name:pt="",addSecurityRequirements:dt=false,...ft}=ct;if(!ut){return}switch(ut){case"basic":{this.documentBuilder.addBasicAuth(ft,pt);break}case"bearer":{this.documentBuilder.addBearerAuth(ft,pt);break}case"cookie":{const{cookieName:ct,securityName:ut,...pt}=ft;this.documentBuilder.addCookieAuth(ct,pt,ut);break}case"oauth2":{this.documentBuilder.addOAuth2(ft,pt);break}case"apikey":{this.documentBuilder.addApiKey(ft,pt);break}case"custom":{this.documentBuilder.addSecurity(pt,ft);break}}if(dt){this.documentBuilder.addSecurityRequirements(pt)}}};dt([(0,_t.Config)("swagger"),ft("design:type",Object)],St.prototype,"swaggerConfig",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],St.prototype,"init",null);St=dt([(0,_t.Provide)(),(0,_t.Scope)(_t.ScopeEnum.Singleton)],St);ut.SwaggerExplorer=St;function parseParamsInPath(ct){const ut=[];ct.split("/").forEach((ct=>{if(ct.startsWith(":")){const pt=ct.slice(1);ut.push(pt)}}));return ut}function replaceUrl(ct,ut){ut.forEach((ut=>{ct=ct.replace(`:${ut}`,`{${ut}}`)}));return ct}function convertTypeToString(ct){switch(ct){case _t.RouteParamTypes.HEADERS:return"header";case _t.RouteParamTypes.QUERY:return"query";case _t.RouteParamTypes.PARAM:return"path";case _t.RouteParamTypes.BODY:case _t.RouteParamTypes.FIELDS:case _t.RouteParamTypes.FILESSTREAM:case _t.RouteParamTypes.FILESTREAM:return"body";default:return"header"}}function convertSchemaType(ct){switch(ct){case"Object":return"object";case"Boolean":return"boolean";case"Number":return"number";case"String":return"string";default:return"object"}}function getNotEmptyValue(...ct){for(const ut of ct){if(ut){return ut}}}function parseTypeSchema(ct){switch(ct){case String:return"string";case Number:return"number";case Boolean:return"boolean";default:if(typeof ct==="function"&&!_t.Types.isClass(ct)){ct=ct()}return ct}}function parseTags(ct){let ut=[];if(ct.length>0){for(const pt of ct){ut=ut.concat(pt.metadata)}}return ut}function addTag(ct,ut=[]){if(ut.find((ut=>{if(Array.isArray(ct)){return ut===ct[0]}else{return ut===ct}}))){}else{ut.push(ct)}}},64811:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.SwaggerMiddleware=void 0;const _t=pt(46123);const mt=pt(33984);let ht=class SwaggerMiddleware{async init(){if(typeof this.swaggerConfig.swaggerUIRender!=="function"){throw new _t.MidwayInvalidConfigPropertyError("swagger.swaggerRender")}this.swaggerRender=this.swaggerConfig.swaggerUIRender(this.swaggerConfig,this.swaggerExplorer)}resolve(ct){if(ct.getNamespace()==="express"){return async(ct,ut,pt)=>{const dt=ct.path;const ft=await this.swaggerRender(dt);if(ft){const{ext:ct,content:pt}=ft;if(ct===".js"){ut.type("application/javascript")}else if(ct===".map"){ut.type("application/json")}else if(ct===".css"){ut.type("text/css")}else if(ct===".png"){ut.type("image/png")}ut.send(pt)}else{return pt()}}}else{return async(ct,ut)=>{const pt=ct.path;const dt=await this.swaggerRender(pt);if(dt){const{ext:ut,content:pt}=dt;if(ut===".js"){ct.set("Content-Type","application/javascript")}else if(ut===".map"){ct.set("Content-Type","application/json")}else if(ut===".css"){ct.set("Content-Type","text/css")}else if(ut===".png"){ct.set("Content-Type","image/png")}ct.body=pt}else{return ut()}}}}static getName(){return"swagger"}};dt([(0,_t.Config)("swagger"),ft("design:type",Object)],ht.prototype,"swaggerConfig",void 0);dt([(0,_t.Inject)(),ft("design:type",mt.SwaggerExplorer)],ht.prototype,"swaggerExplorer",void 0);dt([(0,_t.Inject)(),ft("design:type",_t.MidwayEnvironmentService)],ht.prototype,"environmentService",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],ht.prototype,"init",null);ht=dt([(0,_t.Provide)(),(0,_t.Scope)(_t.ScopeEnum.Singleton)],ht);ut.SwaggerMiddleware=ht},3376:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.renderSwaggerUIRemote=ut.renderJSON=ut.renderSwaggerUIDist=void 0;const dt=pt(46123);const ft=pt(79896);const _t=pt(16928);function renderSwaggerUIDist(ct,ut){const{getAbsoluteFSPath:pt}=(0,dt.safeRequire)("swagger-ui-dist");if(!pt){throw new dt.MidwayCommonError("swagger-ui-dist is not installed")}const mt=ct.swaggerUIRenderOptions||{};if(mt.customInitializer){if((0,_t.isAbsolute)(mt.customInitializer)){mt.customInitializer=(0,ft.readFileSync)(mt.customInitializer)}else{throw new dt.MidwayInvalidConfigPropertyError("swagger.swaggerRenderOptions.customInitializer",["Buffer","String"])}}function replaceInfo(ut){let pt=`location.href.replace('${ct.swaggerPath}/index.html', '${ct.swaggerPath}/index.json'),\n validatorUrl: null,`;if(ct.displayOptions){Object.entries(ct.displayOptions).forEach((([ct,ut])=>{const dt=typeof ut==="string"?`'${ut}'`:ut;pt+=`\n${ct}: ${dt},`}))}return ut.replace('"https://petstore.swagger.io/v2/swagger.json",',pt)}const ht=pt();return async pt=>{if(!ht||pt.indexOf(ct.swaggerPath)===-1){return}const dt=pt.split("/");let yt=dt.pop();if(yt==="index.json"){return{ext:"json",content:ut.getData()}}if(!yt){yt="index.html"}let vt=(0,ft.readFileSync)((0,_t.join)(ht,yt));if(yt==="swagger-initializer.js"&&(mt===null||mt===void 0?void 0:mt.customInitializer)){return{ext:"js",content:mt.customInitializer}}if(yt==="index.html"||yt==="swagger-initializer.js"){vt=vt.toString("utf8");vt=replaceInfo(vt)}const St=(0,_t.extname)(yt);return{ext:St,content:vt}}}ut.renderSwaggerUIDist=renderSwaggerUIDist;function renderJSON(ct,ut){return async pt=>{if(pt.indexOf(ct.swaggerPath)===-1){return}const dt=pt.split("/");const ft=dt.pop();if(ft==="index.json"){return{ext:"json",content:ut.getData()}}return}}ut.renderJSON=renderJSON;function renderSwaggerUIRemote(ct,ut){const pt=ct.swaggerUIRenderOptions||{};const dt=(pt===null||pt===void 0?void 0:pt.indexPagePath)||(0,_t.join)(__dirname,"../../index.html");return async pt=>{if(pt.indexOf(ct.swaggerPath)===-1){return}const _t=pt.split("/");let mt=_t.pop();if(mt==="index.json"){return{ext:"json",content:ut.getData()}}if(!mt){mt="index.html"}if(mt==="index.html"){const ct=(0,ft.readFileSync)(dt,"utf8");return{ext:"html",content:ct}}return}}ut.renderSwaggerUIRemote=renderSwaggerUIRemote},77053:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.i18n=ut.validate=void 0;ut.validate={validationOptions:{},errorStatus:422};ut.i18n={localeTable:{en_US:{validate:pt(98044)},zh_CN:{validate:pt(62462)}}}},41601:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.ValidateConfiguration=void 0;const _t=pt(46123);const mt=pt(77053);const ht=pt(75284);const yt=pt(68255);const vt=pt(47215);const St=pt(6482);let bt=class ValidateConfiguration{async init(){this.decoratorService.registerParameterHandler(St.VALID_KEY,(({parameterIndex:ct,originParamType:ut,originArgs:pt,metadata:dt})=>{if(!dt.schema){dt.schema=this.validateService.getSchema(ut)}return pt[ct]}))}async onReady(ct){await ct.getAsync(vt.ValidationPipe);await ct.getAsync(vt.ParseIntPipe);await ct.getAsync(vt.ParseBoolPipe);await ct.getAsync(vt.ParseFloatPipe);await ct.getAsync(vt.DecoratorValidPipe);this.decoratorService.registerParameterPipes(_t.WEB_ROUTER_PARAM_KEY,[vt.ValidationPipe])}};dt([(0,_t.Inject)(),ft("design:type",_t.MidwayDecoratorService)],bt.prototype,"decoratorService",void 0);dt([(0,_t.Inject)(),ft("design:type",ht.ValidateService)],bt.prototype,"validateService",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],bt.prototype,"init",null);bt=dt([(0,_t.Configuration)({namespace:"validate",imports:[yt],importConfigs:[{default:mt}]})],bt);ut.ValidateConfiguration=bt},6482:(ct,ut)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.VALID_KEY=ut.VALIDATE_KEY=ut.RULES_CLASS_KEY=ut.RULES_KEY=void 0;ut.RULES_KEY="common:rules";ut.RULES_CLASS_KEY="common:class_rules";ut.VALIDATE_KEY="common:validate";ut.VALID_KEY="validate:valid"},61171:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.RuleType=ut.Rule=void 0;const dt=pt(15192);ut.RuleType=dt;const ft=pt(46123);const _t=pt(6482);function Rule(ct,ut={required:true}){return function(pt,mt){if(mt){if(!dt.isSchema(ct)){ct=dt.object((0,ft.getClassMetadata)(_t.RULES_KEY,ct)).meta({id:ct.name});if((0,ft.getPropertyType)(pt,mt).name==="Array"){ct=dt.array().items(ct);if(ut.min){ct=ct.min(ut.min)}if(ut.max){ct=ct.max(ut.max)}}if(ut.required){ct=ct.required()}}(0,ft.attachClassMetadata)(_t.RULES_KEY,ct,pt,mt)}else{if(dt.isSchema(ct)){}}}}ut.Rule=Rule},99419:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Valid=void 0;const dt=pt(46123);const ft=pt(6482);const _t=pt(47215);function Valid(ct,ut){if(Array.isArray(ct)){ut=ct;ct=undefined}else{ut=ut||[]}return(0,dt.createCustomParamDecorator)(ft.VALID_KEY,{schema:ct},{pipes:[_t.DecoratorValidPipe,...ut]})}ut.Valid=Valid},75995:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.Validate=void 0;const dt=pt(46123);const ft=pt(6482);function Validate(ct={}){return(ut,pt,_t)=>{(0,dt.savePropertyMetadata)(ft.VALIDATE_KEY,ct,ut,pt)}}ut.Validate=Validate},48698:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.OmitDto=ut.PickDto=void 0;const dt=pt(46123);const ft=pt(6482);function PickDto(ct,ut){const pickedDto=function(){};pickedDto.prototype=ct.prototype;const pt=(0,dt.getClassExtendedMetadata)(ft.RULES_KEY,ct);const _t={};for(const ct of ut){if(pt[ct]){_t[ct]=pt[ct]}}(0,dt.saveClassMetadata)(ft.RULES_KEY,_t,pickedDto);return pickedDto}ut.PickDto=PickDto;function OmitDto(ct,ut){const pickedDto=function(){};pickedDto.prototype=ct.prototype;const pt=(0,dt.getClassExtendedMetadata)(ft.RULES_KEY,ct);const _t=Object.assign({},pt);for(const ct of ut){delete _t[ct]}(0,dt.saveClassMetadata)(ft.RULES_KEY,_t,pickedDto);return pickedDto}ut.OmitDto=OmitDto},42429:(ct,ut,pt)=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.MidwayValidationError=void 0;const dt=pt(46123);const ft=(0,dt.registerErrorCode)("validate",{VALIDATE_FAIL:1e4});class MidwayValidationError extends dt.MidwayHttpError{constructor(ct,ut,pt){super(ct,ut,ft.VALIDATE_FAIL,{cause:pt})}}ut.MidwayValidationError=MidwayValidationError},99375:function(ct,ut,pt){"use strict";var dt=this&&this.__createBinding||(Object.create?function(ct,ut,pt,dt){if(dt===undefined)dt=pt;var ft=Object.getOwnPropertyDescriptor(ut,pt);if(!ft||("get"in ft?!ut.__esModule:ft.writable||ft.configurable)){ft={enumerable:true,get:function(){return ut[pt]}}}Object.defineProperty(ct,dt,ft)}:function(ct,ut,pt,dt){if(dt===undefined)dt=pt;ct[dt]=ut[pt]});var ft=this&&this.__exportStar||function(ct,ut){for(var pt in ct)if(pt!=="default"&&!Object.prototype.hasOwnProperty.call(ut,pt))dt(ut,ct,pt)};Object.defineProperty(ut,"__esModule",{value:true});ut.Configuration=void 0;var _t=pt(41601);Object.defineProperty(ut,"Configuration",{enumerable:true,get:function(){return _t.ValidateConfiguration}});ft(pt(61171),ut);ft(pt(75995),ut);ft(pt(99419),ut);ft(pt(48698),ut);ft(pt(75284),ut);ft(pt(42429),ut);ft(pt(47215),ut)},47215:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.DefaultValuePipe=ut.ParseFloatPipe=ut.ParseBoolPipe=ut.ParseIntPipe=ut.DecoratorValidPipe=ut.ParsePipe=ut.ValidationPipe=ut.AbstractValidationPipe=void 0;const _t=pt(46123);const mt=pt(75284);const ht=pt(68255);const yt=pt(6482);const vt=pt(15192);class AbstractValidationPipe{validateWithSchema(ct,ut,pt){const dt=this.parseValidationOptions(ut);const ft=this.validateService.validateWithSchema(pt,ct,dt);if(ft&&ft.value!==undefined){return ft.value}return ct}validate(ct,ut){const pt=this.parseValidationOptions(ut);if(ut.metaType.isBaseType){return ct}const dt=this.validateService.validate(ut.metaType.originDesign,ct,pt);if(dt&&dt.value){return dt.value}return ct}parseValidationOptions(ct){const ut=(0,_t.getPropertyMetadata)(yt.VALIDATE_KEY,ct.target,ct.methodName)||{};if(!ut.locale){const pt=ct.target[_t.REQUEST_OBJ_CTX_KEY];if(pt&&pt.getAttr){ut.locale=pt.getAttr(ht.I18N_ATTR_KEY)}}return ut}getSchema(){return undefined}}dt([(0,_t.Inject)(),ft("design:type",mt.ValidateService)],AbstractValidationPipe.prototype,"validateService",void 0);ut.AbstractValidationPipe=AbstractValidationPipe;let St=class ValidationPipe extends AbstractValidationPipe{transform(ct,ut){return this.validate(ct,ut)}};St=dt([(0,_t.Pipe)()],St);ut.ValidationPipe=St;class ParsePipe extends AbstractValidationPipe{transform(ct,ut){return this.validateWithSchema(ct,ut,ut.metadata["schema"]||this.getSchema())}}ut.ParsePipe=ParsePipe;let bt=class DecoratorValidPipe extends ParsePipe{};bt=dt([(0,_t.Pipe)()],bt);ut.DecoratorValidPipe=bt;let xt=class ParseIntPipe extends ParsePipe{getSchema(){return vt.number().integer().required()}};xt=dt([(0,_t.Pipe)()],xt);ut.ParseIntPipe=xt;let $t=class ParseBoolPipe extends ParsePipe{getSchema(){return vt.boolean().required()}};$t=dt([(0,_t.Pipe)()],$t);ut.ParseBoolPipe=$t;let Et=class ParseFloatPipe extends ParsePipe{getSchema(){return vt.number().required()}};Et=dt([(0,_t.Pipe)()],Et);ut.ParseFloatPipe=Et;class DefaultValuePipe{constructor(ct){this.defaultValue=ct}transform(ct,ut){if(ct===undefined||ct===null||typeof ct==="number"&&isNaN(ct)){return this.defaultValue}return ct}}ut.DefaultValuePipe=DefaultValuePipe},75284:function(ct,ut,pt){"use strict";var dt=this&&this.__decorate||function(ct,ut,pt,dt){var ft=arguments.length,_t=ft<3?ut:dt===null?dt=Object.getOwnPropertyDescriptor(ut,pt):dt,mt;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_t=Reflect.decorate(ct,ut,pt,dt);else for(var ht=ct.length-1;ht>=0;ht--)if(mt=ct[ht])_t=(ft<3?mt(_t):ft>3?mt(ut,pt,_t):mt(ut,pt))||_t;return ft>3&&_t&&Object.defineProperty(ut,pt,_t),_t};var ft=this&&this.__metadata||function(ct,ut){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(ct,ut)};Object.defineProperty(ut,"__esModule",{value:true});ut.getSchema=ut.ValidateService=void 0;const _t=pt(46123);const mt=pt(77053);const ht=pt(6482);const yt=pt(15192);const vt=pt(68255);const St=pt(42429);let bt=class ValidateService{constructor(){this.messages={}}async init(){const ct=Object.keys(mt.i18n.localeTable);ct.forEach((ct=>{this.messages[(0,vt.formatLocale)(ct)]=Object.fromEntries(this.i18nService.getLocaleMapping(ct,"validate"))}))}validate(ct,ut,pt={}){const dt=this.getSchema(ct);return this.validateWithSchema(dt,ut,pt)}validateWithSchema(ct,ut,pt={}){var dt,ft,_t;if(!ct){return undefined}pt.validationOptions=pt.validationOptions||{};pt.validationOptions.errors=pt.validationOptions.errors||{};pt.validationOptions.errors.language=(0,vt.formatLocale)(this.i18nService.getAvailableLocale(pt.validationOptions.errors.language||pt.locale||this.i18nConfig.defaultLocale,"validate"));const mt=ct.validate(ut,Object.assign({},(dt=this.validateConfig.validationOptions)!==null&&dt!==void 0?dt:{},{messages:this.messages},(ft=pt.validationOptions)!==null&&ft!==void 0?ft:{}));if(mt.error){throw new St.MidwayValidationError(mt.error.message,(_t=pt===null||pt===void 0?void 0:pt.errorStatus)!==null&&_t!==void 0?_t:this.validateConfig.errorStatus,mt.error)}else{return mt}}getSchema(ct){return getSchema(ct)}};dt([(0,_t.Config)("validate"),ft("design:type",Object)],bt.prototype,"validateConfig",void 0);dt([(0,_t.Config)("i18n"),ft("design:type",Object)],bt.prototype,"i18nConfig",void 0);dt([(0,_t.Inject)(),ft("design:type",vt.MidwayI18nServiceSingleton)],bt.prototype,"i18nService",void 0);dt([(0,_t.Init)(),ft("design:type",Function),ft("design:paramtypes",[]),ft("design:returntype",Promise)],bt.prototype,"init",null);bt=dt([(0,_t.Provide)(),(0,_t.Scope)(_t.ScopeEnum.Singleton)],bt);ut.ValidateService=bt;function getSchema(ct){const ut=(0,_t.getClassExtendedMetadata)(ht.RULES_KEY,ct);if(ut){return yt.object(ut)}}ut.getSchema=getSchema},6647:(ct,ut,pt)=>{"use strict";const dt=pt(87016);const ft=pt(16480);const _t={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:dt.URL||URL};ut.analyze=function(ct,ut={}){if(!ct){return ft.code("DOMAIN_NON_EMPTY_STRING")}if(typeof ct!=="string"){throw new Error("Invalid input: domain must be a string")}if(ct.length>256){return ft.code("DOMAIN_TOO_LONG")}const pt=!_t.nonAsciiRx.test(ct);if(!pt){if(ut.allowUnicode===false){return ft.code("DOMAIN_INVALID_UNICODE_CHARS")}ct=ct.normalize("NFC")}if(_t.domainControlRx.test(ct)){return ft.code("DOMAIN_INVALID_CHARS")}ct=_t.punycode(ct);if(ut.allowFullyQualified&&ct[ct.length-1]==="."){ct=ct.slice(0,-1)}const dt=ut.minDomainSegments||_t.minDomainSegments;const mt=ct.split(".");if(mt.length<dt){return ft.code("DOMAIN_SEGMENTS_COUNT")}if(ut.maxDomainSegments){if(mt.length>ut.maxDomainSegments){return ft.code("DOMAIN_SEGMENTS_COUNT_MAX")}}const ht=ut.tlds;if(ht){const ct=mt[mt.length-1].toLowerCase();if(ht.deny&&ht.deny.has(ct)||ht.allow&&!ht.allow.has(ct)){return ft.code("DOMAIN_FORBIDDEN_TLDS")}}for(let ct=0;ct<mt.length;++ct){const ut=mt[ct];if(!ut.length){return ft.code("DOMAIN_EMPTY_SEGMENT")}if(ut.length>63){return ft.code("DOMAIN_LONG_SEGMENT")}if(ct<mt.length-1){if(!_t.domainSegmentRx.test(ut)){return ft.code("DOMAIN_INVALID_CHARS")}}else{if(!_t.tldSegmentRx.test(ut)){return ft.code("DOMAIN_INVALID_TLDS_CHARS")}}}return null};ut.isValid=function(ct,pt){return!ut.analyze(ct,pt)};_t.punycode=function(ct){if(ct.includes("%")){ct=ct.replace(/%/g,"%25")}try{return new _t.URL(`http://${ct}`).host}catch(ut){return ct}}},71099:(ct,ut,pt)=>{"use strict";const dt=pt(39023);const ft=pt(6647);const _t=pt(16480);const mt={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(dt.TextEncoder||TextEncoder)};ut.analyze=function(ct,ut){return mt.email(ct,ut)};ut.isValid=function(ct,ut){return!mt.email(ct,ut)};mt.email=function(ct,ut={}){if(typeof ct!=="string"){throw new Error("Invalid input: email must be a string")}if(!ct){return _t.code("EMPTY_STRING")}const pt=!mt.nonAsciiRx.test(ct);if(!pt){if(ut.allowUnicode===false){return _t.code("FORBIDDEN_UNICODE")}ct=ct.normalize("NFC")}const dt=ct.split("@");if(dt.length!==2){return dt.length>2?_t.code("MULTIPLE_AT_CHAR"):_t.code("MISSING_AT_CHAR")}const[ht,yt]=dt;if(!ht){return _t.code("EMPTY_LOCAL")}if(!ut.ignoreLength){if(ct.length>254){return _t.code("ADDRESS_TOO_LONG")}if(mt.encoder.encode(ht).length>64){return _t.code("LOCAL_TOO_LONG")}}return mt.local(ht,pt)||ft.analyze(yt,ut)};mt.local=function(ct,ut){const pt=ct.split(".");for(const ct of pt){if(!ct.length){return _t.code("EMPTY_LOCAL_SEGMENT")}if(ut){if(!mt.atextRx.test(ct)){return _t.code("INVALID_LOCAL_CHARS")}continue}for(const ut of ct){if(mt.atextRx.test(ut)){continue}const ct=mt.binary(ut);if(!mt.atomRx.test(ct)){return _t.code("INVALID_LOCAL_CHARS")}}}};mt.binary=function(ct){return Array.from(mt.encoder.encode(ct)).map((ct=>String.fromCharCode(ct))).join("")};mt.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/;mt.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:(ct,ut)=>{"use strict";ut.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"};ut.code=function(ct){return{code:ct,error:ut.codes[ct]}}},54990:(ct,ut,pt)=>{"use strict";const dt=pt(99583);const ft=pt(63377);const _t={};ut.regex=function(ct={}){dt(ct.cidr===undefined||typeof ct.cidr==="string","options.cidr must be a string");const ut=ct.cidr?ct.cidr.toLowerCase():"optional";dt(["required","optional","forbidden"].includes(ut),"options.cidr must be one of required, optional, forbidden");dt(ct.version===undefined||typeof ct.version==="string"||Array.isArray(ct.version),"options.version must be a string or an array of string");let pt=ct.version||["ipv4","ipv6","ipvfuture"];if(!Array.isArray(pt)){pt=[pt]}dt(pt.length>=1,"options.version must have at least 1 version specified");for(let ct=0;ct<pt.length;++ct){dt(typeof pt[ct]==="string","options.version must only contain strings");pt[ct]=pt[ct].toLowerCase();dt(["ipv4","ipv6","ipvfuture"].includes(pt[ct]),"options.version contains unknown version "+pt[ct]+" - must be one of ipv4, ipv6, ipvfuture")}pt=Array.from(new Set(pt));const _t=pt.map((ct=>{if(ut==="forbidden"){return ft.ip[ct]}const pt=`\\/${ct==="ipv4"?ft.ip.v4Cidr:ft.ip.v6Cidr}`;if(ut==="required"){return`${ft.ip[ct]}${pt}`}return`${ft.ip[ct]}(?:${pt})?`}));const mt=`(?:${_t.join("|")})`;const ht=new RegExp(`^${mt}$`);return{cidr:ut,versions:pt,regex:ht,raw:mt}}},33618:ct=>{"use strict";const ut={};ut.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"];ct.exports=new Set(ut.tlds.map((ct=>ct.toLowerCase())))},63377:(ct,ut,pt)=>{"use strict";const dt=pt(99583);const ft=pt(43935);const _t={};_t.generate=function(){const ct={};const ut="\\dA-Fa-f";const pt="["+ut+"]";const dt="\\w-\\.~";const ft="!\\$&'\\(\\)\\*\\+,;=";const _t="%"+ut;const mt=dt+_t+ft+":@";const ht="["+mt+"]";const yt="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";ct.ipv4address="(?:"+yt+"\\.){3}"+yt;const vt=pt+"{1,4}";const St="(?:"+vt+":"+vt+"|"+ct.ipv4address+")";const bt="(?:"+vt+":){6}"+St;const xt="::(?:"+vt+":){5}"+St;const $t="(?:"+vt+")?::(?:"+vt+":){4}"+St;const Et="(?:(?:"+vt+":){0,1}"+vt+")?::(?:"+vt+":){3}"+St;const Ct="(?:(?:"+vt+":){0,2}"+vt+")?::(?:"+vt+":){2}"+St;const Tt="(?:(?:"+vt+":){0,3}"+vt+")?::"+vt+":"+St;const wt="(?:(?:"+vt+":){0,4}"+vt+")?::"+St;const At="(?:(?:"+vt+":){0,5}"+vt+")?::"+vt;const kt="(?:(?:"+vt+":){0,6}"+vt+")?::";ct.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])";ct.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])";ct.ipv6address="(?:"+bt+"|"+xt+"|"+$t+"|"+Et+"|"+Ct+"|"+Tt+"|"+wt+"|"+At+"|"+kt+")";ct.ipvFuture="v"+pt+"+\\.["+dt+ft+":]+";ct.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*";ct.schemeRegex=new RegExp(ct.scheme);const It="["+dt+_t+ft+":]*";const Nt="\\[(?:"+ct.ipv6address+"|"+ct.ipvFuture+")\\]";const Pt="["+dt+_t+ft+"]{1,255}";const Ot="(?:"+Nt+"|"+ct.ipv4address+"|"+Pt+")";const Dt="\\d*";const Ft="(?:"+It+"@)?"+Ot+"(?::"+Dt+")?";const Mt="(?:"+It+"@)?("+Ot+")(?::"+Dt+")?";const Rt=ht+"*";const Lt=ht+"+";const Bt="["+dt+_t+ft+"@"+"]+";const Vt="";const jt="(?:\\/"+Rt+")*";const Ut="\\/(?:"+Lt+jt+")?";const Jt=Lt+jt;const zt=Bt+jt;const Wt="(?:\\/\\/\\/"+Rt+jt+")";ct.hierPart="(?:"+"(?:\\/\\/"+Ft+jt+")"+"|"+Ut+"|"+Jt+"|"+Wt+")";ct.hierPartCapture="(?:"+"(?:\\/\\/"+Mt+jt+")"+"|"+Ut+"|"+Jt+")";ct.relativeRef="(?:"+"(?:\\/\\/"+Ft+jt+")"+"|"+Ut+"|"+zt+"|"+Vt+")";ct.relativeRefCapture="(?:"+"(?:\\/\\/"+Mt+jt+")"+"|"+Ut+"|"+zt+"|"+Vt+")";ct.query="["+mt+"\\/\\?]*(?=#|$)";ct.queryWithSquareBrackets="["+mt+"\\[\\]\\/\\?]*(?=#|$)";ct.fragment="["+mt+"\\/\\?]*";return ct};_t.rfc3986=_t.generate();ut.ip={v4Cidr:_t.rfc3986.ipv4Cidr,v6Cidr:_t.rfc3986.ipv6Cidr,ipv4:_t.rfc3986.ipv4address,ipv6:_t.rfc3986.ipv6address,ipvfuture:_t.rfc3986.ipvFuture};_t.createRegex=function(ct){const ut=_t.rfc3986;const pt=ct.allowQuerySquareBrackets?ut.queryWithSquareBrackets:ut.query;const mt="(?:\\?"+pt+")?"+"(?:#"+ut.fragment+")?";const ht=ct.domain?ut.relativeRefCapture:ut.relativeRef;if(ct.relativeOnly){return _t.wrap(ht+mt)}let yt="";if(ct.scheme){dt(ct.scheme instanceof RegExp||typeof ct.scheme==="string"||Array.isArray(ct.scheme),"scheme must be a RegExp, String, or Array");const pt=[].concat(ct.scheme);dt(pt.length>=1,"scheme must have at least 1 scheme specified");const _t=[];for(let ct=0;ct<pt.length;++ct){const mt=pt[ct];dt(mt instanceof RegExp||typeof mt==="string","scheme at position "+ct+" must be a RegExp or String");if(mt instanceof RegExp){_t.push(mt.source.toString())}else{dt(ut.schemeRegex.test(mt),"scheme at position "+ct+" must be a valid scheme");_t.push(ft(mt))}}yt=_t.join("|")}const vt=yt?"(?:"+yt+")":ut.scheme;const St="(?:"+vt+":"+(ct.domain?ut.hierPartCapture:ut.hierPart)+")";const bt=ct.allowRelative?"(?:"+St+"|"+ht+")":St;return _t.wrap(bt+mt,yt)};_t.wrap=function(ct,ut){ct=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${ct}`;return{raw:ct,regex:new RegExp(`^${ct}$`),scheme:ut}};_t.uriRegex=_t.createRegex({});ut.regex=function(ct={}){if(ct.scheme||ct.allowRelative||ct.relativeOnly||ct.allowQuerySquareBrackets||ct.domain){return _t.createRegex(ct)}return _t.uriRegex}},25673:(ct,ut)=>{"use strict";const pt={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};ut.Parser=class{constructor(ct,ut={}){if(!ut[pt.settings]&&ut.constants){for(const ct in ut.constants){const pt=ut.constants[ct];if(pt!==null&&!["boolean","number","string"].includes(typeof pt)){throw new Error(`Formula constant ${ct} contains invalid ${typeof pt} value type`)}}}this.settings=ut[pt.settings]?ut:Object.assign({[pt.settings]:true,constants:{},functions:{}},ut);this.single=null;this._parts=null;this._parse(ct)}_parse(ct){let dt=[];let ft="";let _t=0;let mt=false;const flush=ct=>{if(_t){throw new Error("Formula missing closing parenthesis")}const ht=dt.length?dt[dt.length-1]:null;if(!mt&&!ft&&!ct){return}if(ht&&ht.type==="reference"&&ct===")"){ht.type="function";ht.value=this._subFormula(ft,ht.value);ft="";return}if(ct===")"){const ct=new ut.Parser(ft,this.settings);dt.push({type:"segment",value:ct})}else if(mt){if(mt==="]"){dt.push({type:"reference",value:ft});ft="";return}dt.push({type:"literal",value:ft})}else if(pt.operatorCharacters.includes(ft)){if(ht&&ht.type==="operator"&&pt.operators.includes(ht.value+ft)){ht.value+=ft}else{dt.push({type:"operator",value:ft})}}else if(ft.match(pt.numberRx)){dt.push({type:"constant",value:parseFloat(ft)})}else if(this.settings.constants[ft]!==undefined){dt.push({type:"constant",value:this.settings.constants[ft]})}else{if(!ft.match(pt.tokenRx)){throw new Error(`Formula contains invalid token: ${ft}`)}dt.push({type:"reference",value:ft})}ft=""};for(const ut of ct){if(mt){if(ut===mt){flush();mt=false}else{ft+=ut}}else if(_t){if(ut==="("){ft+=ut;++_t}else if(ut===")"){--_t;if(!_t){flush(ut)}else{ft+=ut}}else{ft+=ut}}else if(ut in pt.literals){mt=pt.literals[ut]}else if(ut==="("){flush();++_t}else if(pt.operatorCharacters.includes(ut)){flush();ft=ut;flush()}else if(ut!==" "){ft+=ut}else{flush()}}flush();dt=dt.map(((ct,ut)=>{if(ct.type!=="operator"||ct.value!=="-"||ut&&dt[ut-1].type!=="operator"){return ct}return{type:"operator",value:"n"}}));let ht=false;for(const ct of dt){if(ct.type==="operator"){if(pt.operatorsPrefix.includes(ct.value)){continue}if(!ht){throw new Error("Formula contains an operator in invalid position")}if(!pt.operators.includes(ct.value)){throw new Error(`Formula contains an unknown operator ${ct.value}`)}}else if(ht){throw new Error("Formula missing expected operator")}ht=!ht}if(!ht){throw new Error("Formula contains invalid trailing operator")}if(dt.length===1&&["reference","literal","constant"].includes(dt[0].type)){this.single={type:dt[0].type==="reference"?"reference":"value",value:dt[0].value}}this._parts=dt.map((ct=>{if(ct.type==="operator"){return pt.operatorsPrefix.includes(ct.value)?ct:ct.value}if(ct.type!=="reference"){return ct.value}if(this.settings.tokenRx&&!this.settings.tokenRx.test(ct.value)){throw new Error(`Formula contains invalid reference ${ct.value}`)}if(this.settings.reference){return this.settings.reference(ct.value)}return pt.reference(ct.value)}))}_subFormula(ct,dt){const ft=this.settings.functions[dt];if(typeof ft!=="function"){throw new Error(`Formula contains unknown function ${dt}`)}let _t=[];if(ct){let ut="";let ft=0;let mt=false;const flush=()=>{if(!ut){throw new Error(`Formula contains function ${dt} with invalid arguments ${ct}`)}_t.push(ut);ut=""};for(let dt=0;dt<ct.length;++dt){const _t=ct[dt];if(mt){ut+=_t;if(_t===mt){mt=false}}else if(_t in pt.literals&&!ft){ut+=_t;mt=pt.literals[_t]}else if(_t===","&&!ft){flush()}else{ut+=_t;if(_t==="("){++ft}else if(_t===")"){--ft}}}flush()}_t=_t.map((ct=>new ut.Parser(ct,this.settings)));return function(ct){const ut=[];for(const pt of _t){ut.push(pt.evaluate(ct))}return ft.call(ct,...ut)}}evaluate(ct){const ut=this._parts.slice();for(let dt=ut.length-2;dt>=0;--dt){const ft=ut[dt];if(ft&&ft.type==="operator"){const _t=ut[dt+1];ut.splice(dt+1,1);const mt=pt.evaluate(_t,ct);ut[dt]=pt.single(ft.value,mt)}}pt.operatorsOrder.forEach((dt=>{for(let ft=1;ft<ut.length-1;){if(dt.includes(ut[ft])){const dt=ut[ft];const _t=pt.evaluate(ut[ft-1],ct);const mt=pt.evaluate(ut[ft+1],ct);ut.splice(ft,2);const ht=pt.calculate(dt,_t,mt);ut[ft-1]=ht===0?0:ht}else{ft+=2}}}));return pt.evaluate(ut[0],ct)}};ut.Parser.prototype[pt.symbol]=true;pt.reference=function(ct){return function(ut){return ut&&ut[ct]!==undefined?ut[ct]:null}};pt.evaluate=function(ct,ut){if(ct===null){return null}if(typeof ct==="function"){return ct(ut)}if(ct[pt.symbol]){return ct.evaluate(ut)}return ct};pt.single=function(ct,ut){if(ct==="!"){return ut?false:true}const pt=-ut;if(pt===0){return 0}return pt};pt.calculate=function(ct,ut,dt){if(ct==="??"){return pt.exists(ut)?ut:dt}if(typeof ut==="string"||typeof dt==="string"){if(ct==="+"){ut=pt.exists(ut)?ut:"";dt=pt.exists(dt)?dt:"";return ut+dt}}else{switch(ct){case"^":return Math.pow(ut,dt);case"*":return ut*dt;case"/":return ut/dt;case"%":return ut%dt;case"+":return ut+dt;case"-":return ut-dt}}switch(ct){case"<":return ut<dt;case"<=":return ut<=dt;case">":return ut>dt;case">=":return ut>=dt;case"==":return ut===dt;case"!=":return ut!==dt;case"&&":return ut&&dt;case"||":return ut||dt}return null};pt.exists=function(ct){return ct!==null&&ct!==undefined}},533:(ct,ut)=>{"use strict";const pt={};ut.location=function(ct=0){const ut=Error.prepareStackTrace;Error.prepareStackTrace=(ct,ut)=>ut;const pt={};Error.captureStackTrace(pt,this);const dt=pt.stack[ct+1];Error.prepareStackTrace=ut;return{filename:dt.getFileName(),line:dt.getLineNumber()}}},1136:(ct,ut,pt)=>{"use strict";
3
3
  /**
4
4
  * @vue/compiler-core v3.5.35