koa-ts-core 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -36,4 +36,4 @@ import{AsyncLocalStorage as e}from"async_hooks";import n,{statSync as t,readdirS
36
36
  * copy-to - index.js
37
37
  * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
38
38
  * MIT Licensed
39
- */var Ei=function(){if(_a)return Ca;_a=1;const e=ki(),n=function(){if(Oa)return ja;Oa=1;var e=Array.prototype.slice;function n(e,t){if(!(this instanceof n))return new n(e,t);this.src=e,this._withAccess=t}function t(e,n){return void 0===e[n]&&void 0===e.__lookupGetter__(n)&&void 0===e.__lookupSetter__(n)}return ja=n,n.prototype.withAccess=function(e){return this._withAccess=!1!==e,this},n.prototype.pick=function(n){return Array.isArray(n)||(n=e.call(arguments)),n.length&&(this.keys=n),this},n.prototype.to=function(e){if(e=e||{},!this.src)return e;var n=this.keys||Object.keys(this.src);if(!this._withAccess){for(var a=0;a<n.length;a++)void 0===e[i=n[a]]&&(e[i]=this.src[i]);return e}for(a=0;a<n.length;a++){var i=n[a];if(t(e,i)){var o=this.src.__lookupGetter__(i),r=this.src.__lookupSetter__(i);o&&e.__defineGetter__(i,o),r&&e.__defineSetter__(i,r),o||r||(e[i]=this.src[i])}}return e},n.prototype.toCover=function(e){for(var n=this.keys||Object.keys(this.src),t=0;t<n.length;t++){var a=n[t];delete e[a];var i=this.src.__lookupGetter__(a),o=this.src.__lookupSetter__(a);i&&e.__defineGetter__(a,i),o&&e.__defineSetter__(a,o),i||o||(e[a]=this.src[a])}},n.prototype.override=n.prototype.toCover,n.prototype.and=function(e){var n={};return this.to(n),this.src=e,this.to(n),this.src=n,this},ja}(),t=se();function a(e,t){const a={};return n(e).to(a),a.limit=e[t+"Limit"],a}function i(e,n){n&&(Array.isArray(n)||(n=[n]),n.forEach((function(n){e.push(n)})))}function o(e,n){return e.includes(n)}return Ca=function(n){n=n||{};const{detectJSON:r}=n,{onerror:s}=n,c=n.enableTypes||["json","form"],p=o(c,"form"),l=o(c,"json"),u=o(c,"text"),d=o(c,"xml");n.detectJSON=void 0,n.onerror=void 0,n.returnRawBody=!0;const f=["application/json","application/json-patch+json","application/vnd.api+json","application/csp-report","application/scim+json"],m=["application/x-www-form-urlencoded"],h=["text/plain"],v=["text/xml","application/xml"],x=a(n,"json"),b=a(n,"form"),y=a(n,"text"),g=a(n,"xml"),w=n.extendTypes||{};return i(f,w.json),i(m,w.form),i(h,w.text),i(v,w.xml),async function(n,a){if(void 0!==n.request.body||n.disableBodyParser)return await a();try{const a=await async function(n){if(l&&(r&&r(n)||function(e,n){"string"==typeof e&&(e=e.replace(/;$/,""));return t.is(e,n)}(n.request.get("content-type"),f)))return await e.json(n,x);if(p&&n.request.is(m))return await e.form(n,b);if(u&&n.request.is(h))return await e.text(n,y)||"";if(d&&n.request.is(v))return await e.text(n,g)||"";return{}}(n);n.request.body="parsed"in a?a.parsed:{},void 0===n.request.rawBody&&(n.request.rawBody=a.raw)}catch(e){if(!s)throw e;s(e,n)}await a()}}}(),ji=J(Ei),Oi={};function Ci(e,...n){return(...t)=>e(...n,...t)}function _i(e){return function(...n){var t=n.pop();return e.call(this,n,t)}}var Ai="function"==typeof queueMicrotask&&queueMicrotask,Fi="function"==typeof setImmediate&&setImmediate,Ti="object"==typeof process&&"function"==typeof process.nextTick;function Pi(e){setTimeout(e,0)}function Ni(e){return(n,...t)=>e((()=>n(...t)))}var Ii=Ni(Ai?queueMicrotask:Fi?setImmediate:Ti?process.nextTick:Pi);function Li(e){return Bi(e)?function(...n){const t=n.pop();return Mi(e.apply(this,n),t)}:_i((function(n,t){var a;try{a=e.apply(this,n)}catch(e){return t(e)}if(a&&"function"==typeof a.then)return Mi(a,t);t(null,a)}))}function Mi(e,n){return e.then((e=>{Di(n,null,e)}),(e=>{Di(n,e&&(e instanceof Error||e.message)?e:new Error(e))}))}function Di(e,n,t){try{e(n,t)}catch(e){Ii((e=>{throw e}),e)}}function Bi(e){return"AsyncFunction"===e[Symbol.toStringTag]}function qi(e){if("function"!=typeof e)throw new Error("expected a function");return Bi(e)?Li(e):e}function Ri(e,n){if(n||(n=e.length),!n)throw new Error("arity is undefined");return function(...t){return"function"==typeof t[n-1]?e.apply(this,t):new Promise(((a,i)=>{t[n-1]=(e,...n)=>{if(e)return i(e);a(n.length>1?n:n[0])},e.apply(this,t)}))}}function zi(e){return function(n,...t){return Ri((function(a){var i=this;return e(n,((e,n)=>{qi(e).apply(i,t.concat(n))}),a)}))}}function $i(e,n,t,a){n=n||[];var i=[],o=0,r=qi(t);return e(n,((e,n,t)=>{var a=o++;r(e,((e,n)=>{i[a]=n,t(e)}))}),(e=>{a(e,i)}))}function Ui(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}const Wi={};function Gi(e){function n(...n){if(null!==e){var t=e;e=null,t.apply(this,n)}}return Object.assign(n,e),n}function Hi(e){if(Ui(e))return function(e){var n=-1,t=e.length;return function(){return++n<t?{value:e[n],key:n}:null}}(e);var n,t,a,i,o=function(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}(e);return o?function(e){var n=-1;return function(){var t=e.next();return t.done?null:(n++,{value:t.value,key:n})}}(o):(t=(n=e)?Object.keys(n):[],a=-1,i=t.length,function e(){var o=t[++a];return"__proto__"===o?e():a<i?{value:n[o],key:o}:null})}function Ji(e){return function(...n){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,n)}}function Ki(e,n,t,a){let i=!1,o=!1,r=!1,s=0,c=0;function p(){s>=n||r||i||(r=!0,e.next().then((({value:e,done:n})=>{if(!o&&!i){if(r=!1,n)return i=!0,void(s<=0&&a(null));s++,t(e,c,l),c++,p()}})).catch(u))}function l(e,n){if(s-=1,!o)return e?u(e):!1===e?(i=!0,void(o=!0)):n===Wi||i&&s<=0?(i=!0,a(null)):void p()}function u(e){o||(r=!1,i=!0,a(e))}p()}var Vi=e=>(n,t,a)=>{if(a=Gi(a),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!n)return a(null);if("AsyncGenerator"===n[Symbol.toStringTag])return Ki(n,e,t,a);if(function(e){return"function"==typeof e[Symbol.asyncIterator]}(n))return Ki(n[Symbol.asyncIterator](),e,t,a);var i=Hi(n),o=!1,r=!1,s=0,c=!1;function p(e,n){if(!r)if(s-=1,e)o=!0,a(e);else if(!1===e)o=!0,r=!0;else{if(n===Wi||o&&s<=0)return o=!0,a(null);c||l()}}function l(){for(c=!0;s<e&&!o;){var n=i();if(null===n)return o=!0,void(s<=0&&a(null));s+=1,t(n.value,n.key,Ji(p))}c=!1}l()};var Zi=Ri((function(e,n,t,a){return Vi(n)(e,qi(t),a)}),4);function Qi(e,n,t){t=Gi(t);var a=0,i=0,{length:o}=e,r=!1;function s(e,n){!1===e&&(r=!0),!0!==r&&(e?t(e):++i!==o&&n!==Wi||t(null))}for(0===o&&t(null);a<o;a++)n(e[a],a,Ji(s))}function Yi(e,n,t){return Zi(e,1/0,n,t)}var Xi=Ri((function(e,n,t){return(Ui(e)?Qi:Yi)(e,qi(n),t)}),3);var eo=Ri((function(e,n,t){return $i(Xi,e,n,t)}),3),no=zi(eo);var to=Ri((function(e,n,t){return Zi(e,1,n,t)}),3);var ao=Ri((function(e,n,t){return $i(to,e,n,t)}),3),io=zi(ao);const oo=Symbol("promiseCallback");function ro(){let e,n;function t(t,...a){if(t)return n(t);e(a.length>1?a:a[0])}return t[oo]=new Promise(((t,a)=>{e=t,n=a})),t}function so(e,n,t){"number"!=typeof n&&(t=n,n=null),t=Gi(t||ro());var a=Object.keys(e).length;if(!a)return t(null);n||(n=a);var i={},o=0,r=!1,s=!1,c=Object.create(null),p=[],l=[],u={};function d(e,n){p.push((()=>function(e,n){if(s)return;var a=Ji(((n,...a)=>{if(o--,!1!==n)if(a.length<2&&([a]=a),n){var p={};if(Object.keys(i).forEach((e=>{p[e]=i[e]})),p[e]=a,s=!0,c=Object.create(null),r)return;t(n,p)}else i[e]=a,(c[e]||[]).forEach((e=>e())),f();else r=!0}));o++;var p=qi(n[n.length-1]);n.length>1?p(i,a):p(a)}(e,n)))}function f(){if(!r){if(0===p.length&&0===o)return t(null,i);for(;p.length&&o<n;){p.shift()()}}}function m(n){var t=[];return Object.keys(e).forEach((a=>{const i=e[a];Array.isArray(i)&&i.indexOf(n)>=0&&t.push(a)})),t}return Object.keys(e).forEach((n=>{var t=e[n];if(!Array.isArray(t))return d(n,[t]),void l.push(n);var a=t.slice(0,t.length-1),i=a.length;if(0===i)return d(n,t),void l.push(n);u[n]=i,a.forEach((o=>{if(!e[o])throw new Error("async.auto task `"+n+"` has a non-existent dependency `"+o+"` in "+a.join(", "));!function(e,n){var t=c[e];t||(t=c[e]=[]);t.push(n)}(o,(()=>{0===--i&&d(n,t)}))}))})),function(){var e=0;for(;l.length;)e++,m(l.pop()).forEach((e=>{0==--u[e]&&l.push(e)}));if(e!==a)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),f(),t[oo]}var co=/^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/,po=/^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/,lo=/,/,uo=/(=.+)?(\s*)$/;function fo(e,n){var t={};return Object.keys(e).forEach((n=>{var a,i=e[n],o=Bi(i),r=!o&&1===i.length||o&&0===i.length;if(Array.isArray(i))a=[...i],i=a.pop(),t[n]=a.concat(a.length>0?s:i);else if(r)t[n]=i;else{if(a=function(e){const n=function(e){let n="",t=0,a=e.indexOf("*/");for(;t<e.length;)if("/"===e[t]&&"/"===e[t+1]){let n=e.indexOf("\n",t);t=-1===n?e.length:n}else if(-1!==a&&"/"===e[t]&&"*"===e[t+1]){let i=e.indexOf("*/",t);-1!==i?(t=i+2,a=e.indexOf("*/",t)):(n+=e[t],t++)}else n+=e[t],t++;return n}(e.toString());let t=n.match(co);if(t||(t=n.match(po)),!t)throw new Error("could not parse args in autoInject\nSource:\n"+n);let[,a]=t;return a.replace(/\s/g,"").split(lo).map((e=>e.replace(uo,"").trim()))}(i),0===i.length&&!o&&0===a.length)throw new Error("autoInject task functions require explicit parameters.");o||a.pop(),t[n]=a.concat(s)}function s(e,n){var t=a.map((n=>e[n]));t.push(n),qi(i)(...t)}})),so(t,n)}class mo{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,n){n.prev=e,n.next=e.next,e.next?e.next.prev=n:this.tail=n,e.next=n,this.length+=1}insertBefore(e,n){n.prev=e.prev,n.next=e,e.prev?e.prev.next=n:this.head=n,e.prev=n,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):ho(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):ho(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var n=this.head;n;){var{next:t}=n;e(n)&&this.removeLink(n),n=t}return this}}function ho(e,n){e.length=1,e.head=e.tail=n}function vo(e,n,t){if(null==n)n=1;else if(0===n)throw new RangeError("Concurrency must not be zero");var a=qi(e),i=0,o=[];const r={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function s(e,n){return e?n?void(r[e]=r[e].filter((e=>e!==n))):r[e]=[]:Object.keys(r).forEach((e=>r[e]=[]))}function c(e,...n){r[e].forEach((e=>e(...n)))}var p=!1;function l(e,n,t,a){if(null!=a&&"function"!=typeof a)throw new Error("task callback must be a function");var i,o;function r(e,...n){return e?t?o(e):i():n.length<=1?i(n[0]):void i(n)}h.started=!0;var s=h._createTaskItem(e,t?r:a||r);if(n?h._tasks.unshift(s):h._tasks.push(s),p||(p=!0,Ii((()=>{p=!1,h.process()}))),t||!a)return new Promise(((e,n)=>{i=e,o=n}))}function u(e){return function(n,...t){i-=1;for(var a=0,r=e.length;a<r;a++){var s=e[a],p=o.indexOf(s);0===p?o.shift():p>0&&o.splice(p,1),s.callback(n,...t),null!=n&&c("error",n,s.data)}i<=h.concurrency-h.buffer&&c("unsaturated"),h.idle()&&c("drain"),h.process()}}function d(e){return!(0!==e.length||!h.idle())&&(Ii((()=>c("drain"))),!0)}const f=e=>n=>{if(!n)return new Promise(((n,t)=>{!function(e,n){const t=(...a)=>{s(e,t),n(...a)};r[e].push(t)}(e,((e,a)=>{if(e)return t(e);n(a)}))}));s(e),function(e,n){r[e].push(n)}(e,n)};var m=!1,h={_tasks:new mo,_createTaskItem:(e,n)=>({data:e,callback:n}),*[Symbol.iterator](){yield*h._tasks[Symbol.iterator]()},concurrency:n,payload:t,buffer:n/4,started:!1,paused:!1,push(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!1,!1,n)))}return l(e,!1,!1,n)},pushAsync(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!1,!0,n)))}return l(e,!1,!0,n)},kill(){s(),h._tasks.empty()},unshift(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!0,!1,n)))}return l(e,!0,!1,n)},unshiftAsync(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!0,!0,n)))}return l(e,!0,!0,n)},remove(e){h._tasks.remove(e)},process(){if(!m){for(m=!0;!h.paused&&i<h.concurrency&&h._tasks.length;){var e=[],n=[],t=h._tasks.length;h.payload&&(t=Math.min(t,h.payload));for(var r=0;r<t;r++){var s=h._tasks.shift();e.push(s),o.push(s),n.push(s.data)}i+=1,0===h._tasks.length&&c("empty"),i===h.concurrency&&c("saturated");var p=Ji(u(e));a(n,p)}m=!1}},length:()=>h._tasks.length,running:()=>i,workersList:()=>o,idle:()=>h._tasks.length+i===0,pause(){h.paused=!0},resume(){!1!==h.paused&&(h.paused=!1,Ii(h.process))}};return Object.defineProperties(h,{saturated:{writable:!1,value:f("saturated")},unsaturated:{writable:!1,value:f("unsaturated")},empty:{writable:!1,value:f("empty")},drain:{writable:!1,value:f("drain")},error:{writable:!1,value:f("error")}}),h}function xo(e,n){return vo(e,1,n)}function bo(e,n,t){return vo(e,n,t)}var yo=Ri((function(e,n,t,a){a=Gi(a);var i=qi(t);return to(e,((e,t,a)=>{i(n,e,((e,t)=>{n=t,a(e)}))}),(e=>a(e,n)))}),4);function go(...e){var n=e.map(qi);return function(...e){var t=this,a=e[e.length-1];return"function"==typeof a?e.pop():a=ro(),yo(n,e,((e,n,a)=>{n.apply(t,e.concat(((e,...n)=>{a(e,n)})))}),((e,n)=>a(e,...n))),a[oo]}}function wo(...e){return go(...e.reverse())}var So=Ri((function(e,n,t,a){return $i(Vi(n),e,t,a)}),4);var ko=Ri((function(e,n,t,a){var i=qi(t);return So(e,n,((e,n)=>{i(e,((e,...t)=>e?n(e):n(e,t)))}),((e,n)=>{for(var t=[],i=0;i<n.length;i++)n[i]&&(t=t.concat(...n[i]));return a(e,t)}))}),4);var Eo=Ri((function(e,n,t){return ko(e,1/0,n,t)}),3);var jo=Ri((function(e,n,t){return ko(e,1,n,t)}),3);function Oo(...e){return function(...n){return n.pop()(null,...e)}}function Co(e,n){return(t,a,i,o)=>{var r,s=!1;const c=qi(i);t(a,((t,a,i)=>{c(t,((a,o)=>a||!1===a?i(a):e(o)&&!r?(s=!0,r=n(!0,t),i(null,Wi)):void i()))}),(e=>{if(e)return o(e);o(null,s?r:n(!1))}))}}var _o=Ri((function(e,n,t){return Co((e=>e),((e,n)=>n))(Xi,e,n,t)}),3);var Ao=Ri((function(e,n,t,a){return Co((e=>e),((e,n)=>n))(Vi(n),e,t,a)}),4);var Fo=Ri((function(e,n,t){return Co((e=>e),((e,n)=>n))(Vi(1),e,n,t)}),3);function To(e){return(n,...t)=>qi(n)(...t,((n,...t)=>{"object"==typeof console&&(n?console.error&&console.error(n):console[e]&&t.forEach((n=>console[e](n))))}))}var Po=To("dir");var No=Ri((function(e,n,t){t=Ji(t);var a,i=qi(e),o=qi(n);function r(e,...n){if(e)return t(e);!1!==e&&(a=n,o(...n,s))}function s(e,n){return e?t(e):!1!==e?n?void i(r):t(null,...a):void 0}return s(null,!0)}),3);function Io(e,n,t){const a=qi(n);return No(e,((...e)=>{const n=e.pop();a(...e,((e,t)=>n(e,!t)))}),t)}function Lo(e){return(n,t,a)=>e(n,a)}var Mo=Ri((function(e,n,t){return Xi(e,Lo(qi(n)),t)}),3);var Do=Ri((function(e,n,t,a){return Vi(n)(e,Lo(qi(t)),a)}),4);var Bo=Ri((function(e,n,t){return Do(e,1,n,t)}),3);function qo(e){return Bi(e)?e:function(...n){var t=n.pop(),a=!0;n.push(((...e)=>{a?Ii((()=>t(...e))):t(...e)})),e.apply(this,n),a=!1}}var Ro=Ri((function(e,n,t){return Co((e=>!e),(e=>!e))(Xi,e,n,t)}),3);var zo=Ri((function(e,n,t,a){return Co((e=>!e),(e=>!e))(Vi(n),e,t,a)}),4);var $o=Ri((function(e,n,t){return Co((e=>!e),(e=>!e))(to,e,n,t)}),3);function Uo(e,n,t,a){var i=new Array(n.length);e(n,((e,n,a)=>{t(e,((e,t)=>{i[n]=!!t,a(e)}))}),(e=>{if(e)return a(e);for(var t=[],o=0;o<n.length;o++)i[o]&&t.push(n[o]);a(null,t)}))}function Wo(e,n,t,a){var i=[];e(n,((e,n,a)=>{t(e,((t,o)=>{if(t)return a(t);o&&i.push({index:n,value:e}),a(t)}))}),(e=>{if(e)return a(e);a(null,i.sort(((e,n)=>e.index-n.index)).map((e=>e.value)))}))}function Go(e,n,t,a){return(Ui(n)?Uo:Wo)(e,n,qi(t),a)}var Ho=Ri((function(e,n,t){return Go(Xi,e,n,t)}),3);var Jo=Ri((function(e,n,t,a){return Go(Vi(n),e,t,a)}),4);var Ko=Ri((function(e,n,t){return Go(to,e,n,t)}),3);var Vo=Ri((function(e,n){var t=Ji(n),a=qi(qo(e));return function e(n){if(n)return t(n);!1!==n&&a(e)}()}),2);var Zo=Ri((function(e,n,t,a){var i=qi(t);return So(e,n,((e,n)=>{i(e,((t,a)=>t?n(t):n(t,{key:a,val:e})))}),((e,n)=>{for(var t={},{hasOwnProperty:i}=Object.prototype,o=0;o<n.length;o++)if(n[o]){var{key:r}=n[o],{val:s}=n[o];i.call(t,r)?t[r].push(s):t[r]=[s]}return a(e,t)}))}),4);function Qo(e,n,t){return Zo(e,1/0,n,t)}function Yo(e,n,t){return Zo(e,1,n,t)}var Xo=To("log");var er=Ri((function(e,n,t,a){a=Gi(a);var i={},o=qi(t);return Vi(n)(e,((e,n,t)=>{o(e,n,((e,a)=>{if(e)return t(e);i[n]=a,t(e)}))}),(e=>a(e,i)))}),4);function nr(e,n,t){return er(e,1/0,n,t)}function tr(e,n,t){return er(e,1,n,t)}function ar(e,n=e=>e){var t=Object.create(null),a=Object.create(null),i=qi(e),o=_i(((e,o)=>{var r=n(...e);r in t?Ii((()=>o(null,...t[r]))):r in a?a[r].push(o):(a[r]=[o],i(...e,((e,...n)=>{e||(t[r]=n);var i=a[r];delete a[r];for(var o=0,s=i.length;o<s;o++)i[o](e,...n)})))}));return o.memo=t,o.unmemoized=e,o}var ir=Ni(Ti?process.nextTick:Fi?setImmediate:Pi),or=Ri(((e,n,t)=>{var a=Ui(n)?[]:{};e(n,((e,n,t)=>{qi(e)(((e,...i)=>{i.length<2&&([i]=i),a[n]=i,t(e)}))}),(e=>t(e,a)))}),3);function rr(e,n){return or(Xi,e,n)}function sr(e,n,t){return or(Vi(n),e,t)}function cr(e,n){var t=qi(e);return vo(((e,n)=>{t(e[0],n)}),n,1)}class pr{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){let n;for(;e>0&&ur(this.heap[e],this.heap[n=lr(e)]);){let t=this.heap[e];this.heap[e]=this.heap[n],this.heap[n]=t,e=n}}percDown(e){let n;for(;(n=1+(e<<1))<this.heap.length&&(n+1<this.heap.length&&ur(this.heap[n+1],this.heap[n])&&(n+=1),!ur(this.heap[e],this.heap[n]));){let t=this.heap[e];this.heap[e]=this.heap[n],this.heap[n]=t,e=n}}push(e){e.pushCount=++this.pushCount,this.heap.push(e),this.percUp(this.heap.length-1)}unshift(e){return this.heap.push(e)}shift(){let[e]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),e}toArray(){return[...this]}*[Symbol.iterator](){for(let e=0;e<this.heap.length;e++)yield this.heap[e].data}remove(e){let n=0;for(let t=0;t<this.heap.length;t++)e(this.heap[t])||(this.heap[n]=this.heap[t],n++);this.heap.splice(n);for(let e=lr(this.heap.length-1);e>=0;e--)this.percDown(e);return this}}function lr(e){return(e+1>>1)-1}function ur(e,n){return e.priority!==n.priority?e.priority<n.priority:e.pushCount<n.pushCount}function dr(e,n){var t=cr(e,n),{push:a,pushAsync:i}=t;function o(e,n){return Array.isArray(e)?e.map((e=>({data:e,priority:n}))):{data:e,priority:n}}return t._tasks=new pr,t._createTaskItem=({data:e,priority:n},t)=>({data:e,priority:n,callback:t}),t.push=function(e,n=0,t){return a(o(e,n),t)},t.pushAsync=function(e,n=0,t){return i(o(e,n),t)},delete t.unshift,delete t.unshiftAsync,t}var fr=Ri((function(e,n){if(n=Gi(n),!Array.isArray(e))return n(new TypeError("First argument to race must be an array of functions"));if(!e.length)return n();for(var t=0,a=e.length;t<a;t++)qi(e[t])(n)}),2);function mr(e,n,t,a){var i=[...e].reverse();return yo(i,n,t,a)}function hr(e){var n=qi(e);return _i((function(e,t){return e.push(((e,...n)=>{let a={};if(e&&(a.error=e),n.length>0){var i=n;n.length<=1&&([i]=n),a.value=i}t(null,a)})),n.apply(this,e)}))}function vr(e){var n;return Array.isArray(e)?n=e.map(hr):(n={},Object.keys(e).forEach((t=>{n[t]=hr.call(this,e[t])}))),n}function xr(e,n,t,a){const i=qi(t);return Go(e,n,((e,n)=>{i(e,((e,t)=>{n(e,!t)}))}),a)}var br=Ri((function(e,n,t){return xr(Xi,e,n,t)}),3);var yr=Ri((function(e,n,t,a){return xr(Vi(n),e,t,a)}),4);var gr=Ri((function(e,n,t){return xr(to,e,n,t)}),3);function wr(e){return function(){return e}}function Sr(e,n,t){var a={times:5,intervalFunc:wr(0)};if(arguments.length<3&&"function"==typeof e?(t=n||ro(),n=e):(!function(e,n){if("object"==typeof n)e.times=+n.times||5,e.intervalFunc="function"==typeof n.interval?n.interval:wr(+n.interval||0),e.errorFilter=n.errorFilter;else{if("number"!=typeof n&&"string"!=typeof n)throw new Error("Invalid arguments for async.retry");e.times=+n||5}}(a,e),t=t||ro()),"function"!=typeof n)throw new Error("Invalid arguments for async.retry");var i=qi(n),o=1;return function e(){i(((n,...i)=>{!1!==n&&(n&&o++<a.times&&("function"!=typeof a.errorFilter||a.errorFilter(n))?setTimeout(e,a.intervalFunc(o-1)):t(n,...i))}))}(),t[oo]}function kr(e,n){n||(n=e,e=null);let t=e&&e.arity||n.length;Bi(n)&&(t+=1);var a=qi(n);return _i(((n,i)=>{function o(e){a(...n,e)}return(n.length<t-1||null==i)&&(n.push(i),i=ro()),e?Sr(e,o,i):Sr(o,i),i[oo]}))}function Er(e,n){return or(to,e,n)}var jr=Ri((function(e,n,t){return Co(Boolean,(e=>e))(Xi,e,n,t)}),3);var Or=Ri((function(e,n,t,a){return Co(Boolean,(e=>e))(Vi(n),e,t,a)}),4);var Cr=Ri((function(e,n,t){return Co(Boolean,(e=>e))(to,e,n,t)}),3);var _r=Ri((function(e,n,t){var a=qi(n);return eo(e,((e,n)=>{a(e,((t,a)=>{if(t)return n(t);n(t,{value:e,criteria:a})}))}),((e,n)=>{if(e)return t(e);t(null,n.sort(i).map((e=>e.value)))}));function i(e,n){var t=e.criteria,a=n.criteria;return t<a?-1:t>a?1:0}}),3);function Ar(e,n,t){var a=qi(e);return _i(((i,o)=>{var r,s=!1;i.push(((...e)=>{s||(o(...e),clearTimeout(r))})),r=setTimeout((function(){var n=e.name||"anonymous",a=new Error('Callback function "'+n+'" timed out.');a.code="ETIMEDOUT",t&&(a.info=t),s=!0,o(a)}),n),a(...i)}))}function Fr(e,n,t,a){var i=qi(t);return So(function(e){for(var n=Array(e);e--;)n[e]=e;return n}(e),n,i,a)}function Tr(e,n,t){return Fr(e,1/0,n,t)}function Pr(e,n,t){return Fr(e,1,n,t)}function Nr(e,n,t,a){arguments.length<=3&&"function"==typeof n&&(a=t,t=n,n=Array.isArray(e)?[]:{}),a=Gi(a||ro());var i=qi(t);return Xi(e,((e,t,a)=>{i(n,e,t,a)}),(e=>a(e,n))),a[oo]}var Ir=Ri((function(e,n){var t,a=null;return Bo(e,((e,n)=>{qi(e)(((e,...i)=>{if(!1===e)return n(e);i.length<2?[t]=i:t=i,a=e,n(e?null:{})}))}),(()=>n(a,t)))}));function Lr(e){return(...n)=>(e.unmemoized||e)(...n)}var Mr=Ri((function(e,n,t){t=Ji(t);var a=qi(n),i=qi(e),o=[];function r(e,...n){if(e)return t(e);o=n,!1!==e&&i(s)}function s(e,n){return e?t(e):!1!==e?n?void a(r):t(null,...o):void 0}return i(s)}),3);function Dr(e,n,t){const a=qi(e);return Mr((e=>a(((n,t)=>e(n,!t)))),n,t)}var Br,qr,Rr,zr,$r,Ur=Ri((function(e,n){if(n=Gi(n),!Array.isArray(e))return n(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return n();var t=0;function a(n){qi(e[t++])(...n,Ji(i))}function i(i,...o){if(!1!==i)return i||t===e.length?n(i,...o):void a(o)}a([])})),Wr={apply:Ci,applyEach:no,applyEachSeries:io,asyncify:Li,auto:so,autoInject:fo,cargo:xo,cargoQueue:bo,compose:wo,concat:Eo,concatLimit:ko,concatSeries:jo,constant:Oo,detect:_o,detectLimit:Ao,detectSeries:Fo,dir:Po,doUntil:Io,doWhilst:No,each:Mo,eachLimit:Do,eachOf:Xi,eachOfLimit:Zi,eachOfSeries:to,eachSeries:Bo,ensureAsync:qo,every:Ro,everyLimit:zo,everySeries:$o,filter:Ho,filterLimit:Jo,filterSeries:Ko,forever:Vo,groupBy:Qo,groupByLimit:Zo,groupBySeries:Yo,log:Xo,map:eo,mapLimit:So,mapSeries:ao,mapValues:nr,mapValuesLimit:er,mapValuesSeries:tr,memoize:ar,nextTick:ir,parallel:rr,parallelLimit:sr,priorityQueue:dr,queue:cr,race:fr,reduce:yo,reduceRight:mr,reflect:hr,reflectAll:vr,reject:br,rejectLimit:yr,rejectSeries:gr,retry:Sr,retryable:kr,seq:go,series:Er,setImmediate:Ii,some:jr,someLimit:Or,someSeries:Cr,sortBy:_r,timeout:Ar,times:Tr,timesLimit:Fr,timesSeries:Pr,transform:Nr,tryEach:Ir,unmemoize:Lr,until:Dr,waterfall:Ur,whilst:Mr,all:Ro,allLimit:zo,allSeries:$o,any:jr,anyLimit:Or,anySeries:Cr,find:_o,findLimit:Ao,findSeries:Fo,flatMap:Eo,flatMapLimit:ko,flatMapSeries:jo,forEach:Mo,forEachSeries:Bo,forEachLimit:Do,forEachOf:Xi,forEachOfSeries:to,forEachOfLimit:Zi,inject:yo,foldl:yo,foldr:mr,select:Ho,selectLimit:Jo,selectSeries:Ko,wrapSync:Li,during:Mr,doDuring:No},Gr=K(Object.freeze({__proto__:null,all:Ro,allLimit:zo,allSeries:$o,any:jr,anyLimit:Or,anySeries:Cr,apply:Ci,applyEach:no,applyEachSeries:io,asyncify:Li,auto:so,autoInject:fo,cargo:xo,cargoQueue:bo,compose:wo,concat:Eo,concatLimit:ko,concatSeries:jo,constant:Oo,default:Wr,detect:_o,detectLimit:Ao,detectSeries:Fo,dir:Po,doDuring:No,doUntil:Io,doWhilst:No,during:Mr,each:Mo,eachLimit:Do,eachOf:Xi,eachOfLimit:Zi,eachOfSeries:to,eachSeries:Bo,ensureAsync:qo,every:Ro,everyLimit:zo,everySeries:$o,filter:Ho,filterLimit:Jo,filterSeries:Ko,find:_o,findLimit:Ao,findSeries:Fo,flatMap:Eo,flatMapLimit:ko,flatMapSeries:jo,foldl:yo,foldr:mr,forEach:Mo,forEachLimit:Do,forEachOf:Xi,forEachOfLimit:Zi,forEachOfSeries:to,forEachSeries:Bo,forever:Vo,groupBy:Qo,groupByLimit:Zo,groupBySeries:Yo,inject:yo,log:Xo,map:eo,mapLimit:So,mapSeries:ao,mapValues:nr,mapValuesLimit:er,mapValuesSeries:tr,memoize:ar,nextTick:ir,parallel:rr,parallelLimit:sr,priorityQueue:dr,queue:cr,race:fr,reduce:yo,reduceRight:mr,reflect:hr,reflectAll:vr,reject:br,rejectLimit:yr,rejectSeries:gr,retry:Sr,retryable:kr,select:Ho,selectLimit:Jo,selectSeries:Ko,seq:go,series:Er,setImmediate:Ii,some:jr,someLimit:Or,someSeries:Cr,sortBy:_r,timeout:Ar,times:Tr,timesLimit:Fr,timesSeries:Pr,transform:Nr,tryEach:Ir,unmemoize:Lr,until:Dr,waterfall:Ur,whilst:Mr,wrapSync:Li})),Hr={exports:{}},Jr={exports:{}};function Kr(){if(qr)return Br;qr=1;var e=1e3,n=60*e,t=60*n,a=24*t,i=7*a,o=365.25*a;function r(e,n,t,a){var i=n>=1.5*t;return Math.round(e/t)+" "+a+(i?"s":"")}return Br=function(s,c){c=c||{};var p=typeof s;if("string"===p&&s.length>0)return function(r){if((r=String(r)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*a;case"hours":case"hour":case"hrs":case"hr":case"h":return c*t;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===p&&isFinite(s))return c.long?function(i){var o=Math.abs(i);if(o>=a)return r(i,o,a,"day");if(o>=t)return r(i,o,t,"hour");if(o>=n)return r(i,o,n,"minute");if(o>=e)return r(i,o,e,"second");return i+" ms"}(s):function(i){var o=Math.abs(i);if(o>=a)return Math.round(i/a)+"d";if(o>=t)return Math.round(i/t)+"h";if(o>=n)return Math.round(i/n)+"m";if(o>=e)return Math.round(i/e)+"s";return i+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},Br}function Vr(){if(zr)return Rr;return zr=1,Rr=function(e){function n(e){let a,i,o,r=null;function s(...e){if(!s.enabled)return;const t=s,i=Number(new Date),o=i-(a||i);t.diff=o,t.prev=a,t.curr=i,a=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let r=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((a,i)=>{if("%%"===a)return"%";r++;const o=n.formatters[i];if("function"==typeof o){const n=e[r];a=o.call(t,n),e.splice(r,1),r--}return a})),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=t,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(i!==n.namespaces&&(i=n.namespaces,o=n.enabled(e)),o),set:e=>{r=e}}),"function"==typeof n.init&&n.init(s),s}function t(e,t){const a=n(this.namespace+(void 0===t?":":t)+e);return a.log=this.log,a}function a(e,n){let t=0,a=0,i=-1,o=0;for(;t<e.length;)if(a<n.length&&(n[a]===e[t]||"*"===n[a]))"*"===n[a]?(i=a,o=t,a++):(t++,a++);else{if(-1===i)return!1;a=i+1,o++,t=o}for(;a<n.length&&"*"===n[a];)a++;return a===n.length}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names,...n.skips.map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];const t=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of t)"-"===e[0]?n.skips.push(e.slice(1)):n.names.push(e)},n.enabled=function(e){for(const t of n.skips)if(a(e,t))return!1;for(const t of n.names)if(a(e,t))return!0;return!1},n.humanize=Kr(),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((t=>{n[t]=e[t]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n},Rr}var Zr,Qr,Yr,Xr={exports:{}};function es(){return Zr||(Zr=1,function(e,n){const t=x,a=m;n.init=function(e){e.inspectOpts={};const t=Object.keys(n.inspectOpts);for(let a=0;a<t.length;a++)e.inspectOpts[t[a]]=n.inspectOpts[t[a]]},n.log=function(...e){return process.stderr.write(a.formatWithOptions(n.inspectOpts,...e)+"\n")},n.formatArgs=function(t){const{namespace:a,useColors:i}=this;if(i){const n=this.color,i="[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${a} `;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"")}else t[0]=function(){if(n.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+a+" "+t[0]},n.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},n.load=function(){return process.env.DEBUG},n.useColors=function(){return"colors"in n.inspectOpts?Boolean(n.inspectOpts.colors):t.isatty(process.stderr.fd)},n.destroy=a.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),n.colors=[6,2,3,4,5,1];try{const e=require("supports-color");e&&(e.stderr||e).level>=2&&(n.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}n.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,n)=>{const t=n.substring(6).toLowerCase().replace(/_([a-z])/g,((e,n)=>n.toUpperCase()));let a=process.env[n];return a=!!/^(yes|on|true|enabled)$/i.test(a)||!/^(no|off|false|disabled)$/i.test(a)&&("null"===a?null:Number(a)),e[t]=a,e}),{}),e.exports=Vr()(n);const{formatters:i}=e.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}}(Xr,Xr.exports)),Xr.exports}function ns(){return Qr||(Qr=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Hr.exports=($r||($r=1,function(e,n){n.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const t="color: "+this.color;n.splice(1,0,t,"color: inherit");let a=0,i=0;n[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(a++,"%c"===e&&(i=a))})),n.splice(i,0,t)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),e.exports=Vr()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Jr,Jr.exports)),Jr.exports):Hr.exports=es()),Hr.exports}var ts=(Yr||(Yr=1,function(e){const t=n,a=h,i=v,r=o,s=Gr,c=ns(),p=c("portfinder:testPort"),l=c("portfinder:getPort"),u=c("portfinder:defaultHosts"),d={testPort:function(n,t){function a(){p("done w/ testPort(): OK",n.host,"port",n.port),n.server.removeListener("error",o),n.server.close((function(){p("done w/ testPort(): Server closed",n.host,"port",n.port),t(null,n.port)}))}function o(i){if(p("done w/ testPort(): failed",n.host,"w/ port",n.port,"with error",i.code),n.server.removeListener("listening",a),"EADDRINUSE"!=i.code&&"EACCES"!=i.code)return t(i);const o=e.nextPort(n.port);if(o>e.highestPort)return t(new Error("No open ports available"));d.testPort({port:o,host:n.host,server:n.server},t)}t||(t=n,n={}),n.server=n.server||i.createServer((function(){})),p("entered testPort(): trying",n.host,"port",n.port),n.server.once("error",o),n.server.once("listening",a),n.host?n.server.listen(n.port,n.host):n.server.listen(n.port)}};e.basePort=8e3,e.setBasePort=function(n){e.basePort=n},e.highestPort=65535,e.setHighestPort=function(n){e.highestPort=n},e.basePath="/tmp/portfinder",e.setBasePath=function(n){e.basePath=n},d.getPort=function(n,t){if(n.port=Number(n.port)||Number(n.startPort)||Number(e.basePort),n.host=n.host||null,n.stopPort=Number(n.stopPort)||Number(e.highestPort),!n.startPort){if(n.startPort=n.port,n.startPort<0)return t(Error(`Provided options.port(${n.port}) is less than 0, which are cannot be bound.`));if(n.stopPort<n.startPort)return t(Error(`Provided options.stopPort(${n.stopPort}) is less than options.port(${n.startPort})`))}n.host&&-1===e._defaultHosts.indexOf(n.host)&&e._defaultHosts.push(n.host);const a=[];let i;return s.eachSeries(e._defaultHosts,(function(e,t){return l("in eachSeries() iteration callback: host is",e),d.testPort({host:e,port:n.port},(function(n,o){return n?(l("in eachSeries() iteration callback testPort() callback","with an err:",n.code),i=e,t(n)):(l("in eachSeries() iteration callback testPort() callback","with a success for port",o),a.push(o),t())}))}),(function(o){if(o){if(l("in eachSeries() result callback: err is",o),"EADDRNOTAVAIL"===o.code||"EINVAL"===o.code){if(n.host===i){const e="Provided host "+n.host+" could NOT be bound. Please provide a different host address or hostname";return t(Error(e))}{const a=e._defaultHosts.indexOf(i);return e._defaultHosts.splice(a,1),d.getPort(n,t)}}return t(o)}if(a.sort((function(e,n){return e-n})),l("in eachSeries() result callback: openPorts is",a),a[0]===a[a.length-1]){if(a[0]<=n.stopPort)return t(null,a[0]);{const e="No open ports found in between "+n.startPort+" and "+n.stopPort;return t(Error(e))}}return d.getPort({port:a.pop(),host:n.host,startPort:n.startPort,stopPort:n.stopPort},t)}))},e.getPort=function(e,n){if("function"==typeof e&&(n=e,e={}),e=e||{},!n)return new Promise((function(n,t){d.getPort(e,(function(e,a){if(e)return t(e);n(a)}))}));d.getPort(e,n)},e.getPortPromise=e.getPort,d.getPorts=function(n,t,a){let i=null;s.timesSeries(n,(function(n,a){i&&(t.port=e.nextPort(i)),d.getPort(t,(function(e,n){e?a(e):(i=n,a(null,n))}))}),a)},e.getPorts=function(e,n,t){if("function"==typeof n&&(t=n,n={}),n=n||{},!t)return new Promise((function(t,a){d.getPorts(e,n,(function(e,n){if(e)return a(e);t(n)}))}));d.getPorts(e,n,t)},e.getPortsPromise=e.getPorts,d.getSocket=function(n,a){function i(){t.stat(n.path,(function(t){t?"ENOENT"==t.code?a(null,n.path):a(t):(n.path=e.nextSocket(n.path),d.getSocket(n,a))}))}return n.mod=n.mod||parseInt(755,8),n.path=n.path||e.basePath+".sock",n.exists?i():function(){const e=r.dirname(n.path);t.stat(e,(function(o,r){if(o||!r.isDirectory())return function(e){t.mkdir(e,{mode:n.mod,recursive:!0},(function(e){if(e)return a(e);n.exists=!0,i()}))}(e);n.exists=!0,i()}))}()},e.getSocket=function(e,n){if("function"==typeof e&&(n=e,e={}),e=e||{},!n)return new Promise((function(n,t){d.getSocket(e,(function(e,a){if(e)return t(e);n(a)}))}));d.getSocket(e,n)},e.getSocketPromise=e.getSocket,e.nextPort=function(e){return e+1},e.nextSocket=function(e){const n=r.dirname(e),t=r.basename(e,".sock").match(/^([a-zA-z]+)(\d*)$/i),a=t[1];let i=parseInt(t[2]);return isNaN(i)&&(i=0),i+=1,r.join(n,a+i+".sock")},e._defaultHosts=function(){let e={};try{e=a.networkInterfaces()}catch(e){if("uv_interface_addresses"!==e.syscall)throw e}const n=Object.keys(e),t=["0.0.0.0"];for(let a=0;a<n.length;a++){const i=e[n[a]];for(let e=0;e<i.length;e++){const n=i[e];t.push(n.address)}}return t.push(null),u("exports._defaultHosts is: %o",t),t}()}(Oi)),Oi),as=J(ts);const is=p.prototype.listen,os=e=>{const n=e.address();if(n){((e,n)=>{const t=null!==n?`http://${e}:${n}`:e;console.log(`app listen ${t}`)})("object"==typeof n?(e=>"::"===e?"0.0.0.0":e)(n.address):n,"object"==typeof n?n.port:null)}},rs=(e,n,t,a)=>{const{pathPrefix:i,moduleName:o,name:r}=z(n,"controller"),s=`${i}/${o}`;if(!t)return;const c=q(`${e}${`${i}/${r}`}`);t.forEach((e=>{const{method:n,path:t,handler:o,functionName:r,authRequired:p,middlewares:l}=e;var u;c&&"function"==typeof c[r]&&l.push((u=c[r].bind(c),async(e,n)=>{const t=u(e);t instanceof Promise&&await t,await n()}));const d=(f=p,m=o,async(e,n)=>{let t=a(f,e);return t instanceof Promise&&(t=await t),t?m(e,n):e.throw(403,"无权限")});var f,m;const h=[...l,d],v=ss(t,s,r,h,n);e.path=v,e.apiPrePath=i}))},ss=(e,n,t,a,i)=>{const o=`${n}${e}`;if(t===E){const e=`${n}/index`;G[i](e,...a)}return G[i](o,...a),o};var cs,ps,ls,us={exports:{}},ds={exports:{}};function fs(){if(ps)return cs;return ps=1,cs=function(e){function n(e){let a,i,o,r=null;function s(...e){if(!s.enabled)return;const t=s,i=Number(new Date),o=i-(a||i);t.diff=o,t.prev=a,t.curr=i,a=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let r=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((a,i)=>{if("%%"===a)return"%";r++;const o=n.formatters[i];if("function"==typeof o){const n=e[r];a=o.call(t,n),e.splice(r,1),r--}return a})),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=t,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(i!==n.namespaces&&(i=n.namespaces,o=n.enabled(e)),o),set:e=>{r=e}}),"function"==typeof n.init&&n.init(s),s}function t(e,t){const a=n(this.namespace+(void 0===t?":":t)+e);return a.log=this.log,a}function a(e,n){let t=0,a=0,i=-1,o=0;for(;t<e.length;)if(a<n.length&&(n[a]===e[t]||"*"===n[a]))"*"===n[a]?(i=a,o=t,a++):(t++,a++);else{if(-1===i)return!1;a=i+1,o++,t=o}for(;a<n.length&&"*"===n[a];)a++;return a===n.length}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names,...n.skips.map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];const t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of t)"-"===e[0]?n.skips.push(e.slice(1)):n.names.push(e)},n.enabled=function(e){for(const t of n.skips)if(a(e,t))return!1;for(const t of n.names)if(a(e,t))return!0;return!1},n.humanize=Kr(),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((t=>{n[t]=e[t]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n},cs}var ms,hs,vs,xs,bs,ys,gs={exports:{}};function ws(){return ms||(ms=1,function(e,n){const t=x,a=m;n.init=function(e){e.inspectOpts={};const t=Object.keys(n.inspectOpts);for(let a=0;a<t.length;a++)e.inspectOpts[t[a]]=n.inspectOpts[t[a]]},n.log=function(...e){return process.stderr.write(a.formatWithOptions(n.inspectOpts,...e)+"\n")},n.formatArgs=function(t){const{namespace:a,useColors:i}=this;if(i){const n=this.color,i="[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${a} `;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"")}else t[0]=function(){if(n.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+a+" "+t[0]},n.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},n.load=function(){return process.env.DEBUG},n.useColors=function(){return"colors"in n.inspectOpts?Boolean(n.inspectOpts.colors):t.isatty(process.stderr.fd)},n.destroy=a.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),n.colors=[6,2,3,4,5,1];try{const e=require("supports-color");e&&(e.stderr||e).level>=2&&(n.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}n.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,n)=>{const t=n.substring(6).toLowerCase().replace(/_([a-z])/g,((e,n)=>n.toUpperCase()));let a=process.env[n];return a=!!/^(yes|on|true|enabled)$/i.test(a)||!/^(no|off|false|disabled)$/i.test(a)&&("null"===a?null:Number(a)),e[t]=a,e}),{}),e.exports=fs()(n);const{formatters:i}=e.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}}(gs,gs.exports)),gs.exports}function Ss(){return hs||(hs=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?us.exports=(ls||(ls=1,function(e,n){n.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const t="color: "+this.color;n.splice(1,0,t,"color: inherit");let a=0,i=0;n[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(a++,"%c"===e&&(i=a))})),n.splice(i,0,t)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")||n.storage.getItem("DEBUG")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),e.exports=fs()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(ds,ds.exports)),ds.exports):us.exports=ws()),us.exports}function ks(){if(xs)return vs;function e(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}return xs=1,vs=function(n){if((n=n||{}).circles)return function(n){const t=[],a=[],i=new Map;if(i.set(Date,(e=>new Date(e))),i.set(Map,((e,n)=>new Map(r(Array.from(e),n)))),i.set(Set,((e,n)=>new Set(r(Array.from(e),n)))),n.constructorHandlers)for(const e of n.constructorHandlers)i.set(e[0],e[1]);let o=null;return n.proto?c:s;function r(n,r){const s=Object.keys(n),c=new Array(s.length);for(let p=0;p<s.length;p++){const l=s[p],u=n[l];if("object"!=typeof u||null===u)c[l]=u;else if(u.constructor!==Object&&(o=i.get(u.constructor)))c[l]=o(u,r);else if(ArrayBuffer.isView(u))c[l]=e(u);else{const e=t.indexOf(u);c[l]=-1!==e?a[e]:r(u)}}return c}function s(n){if("object"!=typeof n||null===n)return n;if(Array.isArray(n))return r(n,s);if(n.constructor!==Object&&(o=i.get(n.constructor)))return o(n,s);const c={};t.push(n),a.push(c);for(const r in n){if(!1===Object.hasOwnProperty.call(n,r))continue;const p=n[r];if("object"!=typeof p||null===p)c[r]=p;else if(p.constructor!==Object&&(o=i.get(p.constructor)))c[r]=o(p,s);else if(ArrayBuffer.isView(p))c[r]=e(p);else{const e=t.indexOf(p);c[r]=-1!==e?a[e]:s(p)}}return t.pop(),a.pop(),c}function c(n){if("object"!=typeof n||null===n)return n;if(Array.isArray(n))return r(n,c);if(n.constructor!==Object&&(o=i.get(n.constructor)))return o(n,c);const s={};t.push(n),a.push(s);for(const r in n){const p=n[r];if("object"!=typeof p||null===p)s[r]=p;else if(p.constructor!==Object&&(o=i.get(p.constructor)))s[r]=o(p,c);else if(ArrayBuffer.isView(p))s[r]=e(p);else{const e=t.indexOf(p);s[r]=-1!==e?a[e]:c(p)}}return t.pop(),a.pop(),s}}(n);const t=new Map;if(t.set(Date,(e=>new Date(e))),t.set(Map,((e,n)=>new Map(i(Array.from(e),n)))),t.set(Set,((e,n)=>new Set(i(Array.from(e),n)))),n.constructorHandlers)for(const e of n.constructorHandlers)t.set(e[0],e[1]);let a=null;return n.proto?function n(o){if("object"!=typeof o||null===o)return o;if(Array.isArray(o))return i(o,n);if(o.constructor!==Object&&(a=t.get(o.constructor)))return a(o,n);const r={};for(const i in o){const s=o[i];"object"!=typeof s||null===s?r[i]=s:s.constructor!==Object&&(a=t.get(s.constructor))?r[i]=a(s,n):ArrayBuffer.isView(s)?r[i]=e(s):r[i]=n(s)}return r}:function n(o){if("object"!=typeof o||null===o)return o;if(Array.isArray(o))return i(o,n);if(o.constructor!==Object&&(a=t.get(o.constructor)))return a(o,n);const r={};for(const i in o){if(!1===Object.hasOwnProperty.call(o,i))continue;const s=o[i];"object"!=typeof s||null===s?r[i]=s:s.constructor!==Object&&(a=t.get(s.constructor))?r[i]=a(s,n):ArrayBuffer.isView(s)?r[i]=e(s):r[i]=n(s)}return r};function i(n,i){const o=Object.keys(n),r=new Array(o.length);for(let s=0;s<o.length;s++){const c=o[s],p=n[c];"object"!=typeof p||null===p?r[c]=p:p.constructor!==Object&&(a=t.get(p.constructor))?r[c]=a(p,i):ArrayBuffer.isView(p)?r[c]=e(p):r[c]=i(p)}return r}},vs}function Es(){if(ys)return bs;ys=1;const e=m,n=Ss()("log4js:configuration"),t=[],a=[],i=e=>!e,o=e=>e&&"object"==typeof e&&!Array.isArray(e),r=(n,t,a)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${e.inspect(n,{depth:5})}) - ${a}`)}))};return bs={configure:e=>{n("New configuration to be validated: ",e),r(e,i(o(e)),"must be an object."),n(`Calling pre-processing listeners (${t.length})`),t.forEach((n=>n(e))),n("Configuration pre-processing finished."),n(`Calling configuration listeners (${a.length})`),a.forEach((n=>n(e))),n("Configuration finished.")},addListener:e=>{a.push(e),n(`Added listener, now ${a.length} listeners`)},addPreProcessingListener:e=>{t.push(e),n(`Added pre-processing listener, now ${t.length} listeners`)},throwExceptionIf:r,anObject:o,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:i}}var js,Os,Cs,_s,As,Fs={exports:{}};function Ts(){return js||(js=1,function(e){function n(e,n){for(var t=e.toString();t.length<n;)t="0"+t;return t}function t(e){return n(e,2)}function a(a,i){"string"!=typeof a&&(i=a,a=e.exports.ISO8601_FORMAT),i||(i=e.exports.now());var o,r,s,c,p=t(i.getDate()),l=t(i.getMonth()+1),u=t(i.getFullYear()),d=t(u.substring(2,4)),f=a.indexOf("yyyy")>-1?u:d,m=t(i.getHours()),h=t(i.getMinutes()),v=t(i.getSeconds()),x=n(i.getMilliseconds(),3),b=(o=i.getTimezoneOffset(),r=Math.abs(o),s=String(Math.floor(r/60)),c=String(r%60),s=("0"+s).slice(-2),c=("0"+c).slice(-2),0===o?"Z":(o<0?"+":"-")+s+":"+c);return a.replace(/dd/g,p).replace(/MM/g,l).replace(/y{1,4}/g,f).replace(/hh/g,m).replace(/mm/g,h).replace(/ss/g,v).replace(/SSS/g,x).replace(/O/g,b)}function i(e,n,t,a){e["set"+(a?"":"UTC")+n](t)}e.exports=a,e.exports.asString=a,e.exports.parse=function(n,t,a){if(!n)throw new Error("pattern must be supplied");return function(n,t,a){var o=n.indexOf("O")<0,r=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,n){i(e,"FullYear",n,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,n){i(e,"Month",n-1,o),e.getMonth()!==n-1&&(r=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,n){r&&i(e,"Month",e.getMonth()-1,o),i(e,"Date",n,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,n){i(e,"Hours",n,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,n){i(e,"Minutes",n,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,n){i(e,"Seconds",n,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,n){i(e,"Milliseconds",n,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,n){n="Z"===n?0:n.replace(":","");var t=Math.abs(n),a=(n>0?-1:1)*(t%100+60*Math.floor(t/100));e.setUTCMinutes(e.getUTCMinutes()+a)}}],c=s.reduce((function(e,n){return n.pattern.test(e.regexp)?(n.index=e.regexp.match(n.pattern).index,e.regexp=e.regexp.replace(n.pattern,"("+n.regexp+")")):n.index=-1,e}),{regexp:n,index:[]}),p=s.filter((function(e){return e.index>-1}));p.sort((function(e,n){return e.index-n.index}));var l=new RegExp(c.regexp).exec(t);if(l){var u=a||e.exports.now();return p.forEach((function(e,n){e.fn(u,l[n+1])})),u}throw new Error("String '"+t+"' could not be parsed as '"+n+"'")}(n,t,a)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(Fs)),Fs.exports}function Ps(){if(Cs)return Os;Cs=1;const e=Ts(),n=h,t=m,a=o,i=y,r=Ss()("log4js:layouts"),s={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function c(e){return e?`[${s[e][0]}m`:""}function p(e){return e?`[${s[e][1]}m`:""}function l(n,a){return i=t.format("[%s] [%s] %s - ",e.asString(n.startTime),n.level.toString(),n.categoryName),c(o=a)+i+p(o);var i,o}function u(e){return l(e)+t.format(...e.data)}function d(e){return l(e,e.level.colour)+t.format(...e.data)}function f(e){return t.format(...e.data)}function v(e){return e.data[0]}function x(o,s){const l=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function u(e){return e&&e.pid?e.pid.toString():process.pid.toString()}o=o||"%r %p %c - %m%n";const d={c:function(e,n){let t=e.categoryName;if(n){const e=parseInt(n,10),a=t.split(".");e<a.length&&(t=a.slice(a.length-e).join("."))}return t},d:function(n,t){let a=e.ISO8601_FORMAT;if(t)switch(a=t,a){case"ISO8601":case"ISO8601_FORMAT":a=e.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":a=e.ISO8601_WITH_TZ_OFFSET_FORMAT;break;case"ABSOLUTE":process.emitWarning("Pattern %d{ABSOLUTE} is deprecated in favor of %d{ABSOLUTETIME}. Please use %d{ABSOLUTETIME} instead.","DeprecationWarning","log4js-node-DEP0003"),r("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":a=e.ABSOLUTETIME_FORMAT;break;case"DATE":process.emitWarning("Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.","DeprecationWarning","log4js-node-DEP0004"),r("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":a=e.DATETIME_FORMAT}return e.asString(a,n.startTime)},h:function(){return n.hostname().toString()},m:function(e,n){let a=e.data;if(n){const[e,t]=n.split(",");a=a.slice(e,t)}return t.format(...a)},n:function(){return n.EOL},p:function(e){return e.level.toString()},r:function(n){return e.asString("hh:mm:ss",n.startTime)},"[":function(e){return c(e.level.colour)},"]":function(e){return p(e.level.colour)},y:function(){return u()},z:u,"%":function(){return"%"},x:function(e,n){return void 0!==s[n]?"function"==typeof s[n]?s[n](e):s[n]:null},X:function(e,n){const t=e.context[n];return void 0!==t?"function"==typeof t?t(e):t:null},f:function(e,n){let t=e.fileName||"";if(t=function(e){const n="file://";return e.startsWith(n)&&("function"==typeof i.fileURLToPath?e=i.fileURLToPath(e):(e=a.normalize(e.replace(new RegExp(`^${n}`),"")),"win32"===process.platform&&(e=e.startsWith("\\")?e.slice(1):a.sep+a.sep+e))),e}(t),n){const e=parseInt(n,10),i=t.split(a.sep);i.length>e&&(t=i.slice(-e).join(a.sep))}return t},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function f(e,n,t){return d[e](n,t)}function m(e,n,t){let a=e;return a=function(e,n){let t;return e?(t=parseInt(e.slice(1),10),t>0?n.slice(0,t):n.slice(t)):n}(n,a),a=function(e,n){let t;if(e)if("-"===e.charAt(0))for(t=parseInt(e.slice(1),10);n.length<t;)n+=" ";else for(t=parseInt(e,10);n.length<t;)n=` ${n}`;return n}(t,a),a}return function(e){let n,t="",a=o;for(;null!==(n=l.exec(a));){const i=n[1],o=n[2],r=n[3],s=n[5],c=n[6];if(c)t+=c.toString();else{t+=m(f(r,e,s),o,i)}a=a.slice(n.index+n[0].length)}return t}}const b={messagePassThrough:()=>f,basic:()=>u,colored:()=>d,coloured:()=>d,pattern:e=>x(e&&e.pattern,e&&e.tokens),dummy:()=>v};return Os={basicLayout:u,messagePassThroughLayout:f,patternLayout:x,colouredLayout:d,coloredLayout:d,dummyLayout:v,addLayout(e,n){b[e]=n},layout:(e,n)=>b[e]&&b[e](n)}}function Ns(){if(As)return _s;As=1;const e=Es(),n=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class t{constructor(e,n,t){this.level=e,this.levelStr=n,this.colour=t}toString(){return this.levelStr}static getLevel(e,n){return e?e instanceof t?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),t[e.toString().toUpperCase()]||n):n}static addLevels(e){if(e){Object.keys(e).forEach((n=>{const a=n.toUpperCase();t[a]=new t(e[n].value,a,e[n].colour);const i=t.levels.findIndex((e=>e.levelStr===a));i>-1?t.levels[i]=t[a]:t.levels.push(t[a])})),t.levels.sort(((e,n)=>e.level-n.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level===e.level}}return t.levels=[],t.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),e.addListener((t=>{const a=t.levels;if(a){e.throwExceptionIf(t,e.not(e.anObject(a)),"levels must be an object");Object.keys(a).forEach((i=>{e.throwExceptionIf(t,e.not(e.validIdentifier(i)),`level name "${i}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),e.throwExceptionIf(t,e.not(e.anObject(a[i])),`level "${i}" must be an object`),e.throwExceptionIf(t,e.not(a[i].value),`level "${i}" must have a 'value' property`),e.throwExceptionIf(t,e.not(e.anInteger(a[i].value)),`level "${i}".value must have an integer value`),e.throwExceptionIf(t,e.not(a[i].colour),`level "${i}" must have a 'colour' property`),e.throwExceptionIf(t,e.not(n.indexOf(a[i].colour)>-1),`level "${i}".colour must be one of ${n.join(", ")}`)}))}})),e.addListener((e=>{t.addLevels(e.levels)})),_s=t}var Is,Ls,Ms,Ds,Bs,qs={exports:{}},Rs={};function zs(){if(Ms)return Ls;Ms=1;const e=function(){if(Is)return Rs;Is=1;const{parse:e,stringify:n}=JSON,{keys:t}=Object,a=String,i="string",o={},r="object",s=(e,n)=>n,c=e=>e instanceof a?a(e):e,p=(e,n)=>typeof n===i?new a(n):n,l=(e,n,i,s)=>{const c=[];for(let p=t(i),{length:l}=p,u=0;u<l;u++){const t=p[u],l=i[t];if(l instanceof a){const a=e[l];typeof a!==r||n.has(a)?i[t]=s.call(i,t,a):(n.add(a),i[t]=o,c.push({k:t,a:[e,n,a,s]}))}else i[t]!==o&&(i[t]=s.call(i,t,l))}for(let{length:e}=c,n=0;n<e;n++){const{k:e,a:t}=c[n];i[e]=s.call(i,e,l.apply(null,t))}return i},u=(e,n,t)=>{const i=a(n.push(t)-1);return e.set(t,i),i},d=(n,t)=>{const a=e(n,p).map(c),i=a[0],o=t||s,u=typeof i===r&&i?l(a,new Set,i,o):i;return o.call({"":u},"",u)};Rs.parse=d;const f=(e,t,a)=>{const o=t&&typeof t===r?(e,n)=>""===e||-1<t.indexOf(e)?n:void 0:t||s,c=new Map,p=[],l=[];let d=+u(c,p,o.call({"":e},"",e)),f=!d;for(;d<p.length;)f=!0,l[d]=n(p[d++],m,a);return"["+l.join(",")+"]";function m(e,n){if(f)return f=!f,n;const t=o.call(this,e,n);switch(typeof t){case r:if(null===t)return t;case i:return c.get(t)||u(c,p,t)}return t}};return Rs.stringify=f,Rs.toJSON=n=>e(f(n)),Rs.fromJSON=e=>d(n(e)),Rs}(),n=Ns();const t=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const n=this.deMap[e];this.serMap[n]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};class a{constructor(e,n,t,a,i,o){if(this.startTime=new Date,this.categoryName=e,this.data=t,this.level=n,this.context=Object.assign({},a),this.pid=process.pid,this.error=o,void 0!==i){if(!i||"object"!=typeof i||Array.isArray(i))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==i[e]&&(this[e]=i[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return e.stringify(this,((e,n)=>(n instanceof Error&&(n=Object.assign({message:n.message,stack:n.stack},n)),t.serialise(n))))}static deserialise(i){let o;try{const r=e.parse(i,((e,n)=>{if(n&&n.message&&n.stack){const e=new Error(n);Object.keys(n).forEach((t=>{e[t]=n[t]})),n=e}return t.deserialise(n)}));this._getLocationKeys().forEach((e=>{void 0!==r[e]&&(r.location||(r.location={}),r.location[e]=r[e])})),o=new a(r.categoryName,n.getLevel(r.level.levelStr),r.data,r.context,r.location,r.error),o.startTime=new Date(r.startTime),o.pid=r.pid,r.cluster&&(o.cluster=r.cluster)}catch(e){o=new a("log4js",n.ERROR,["Unable to parse log:",i,"because: ",e])}return o}}return Ls=a}function $s(){if(Bs)return Ds;Bs=1;const e=Ss()("log4js:clustering"),n=zs(),t=Es();let a=!1,i=null;try{i=require("cluster")}catch(n){e("cluster module not present"),a=!0}const o=[];let r=!1,s="NODE_APP_INSTANCE";const c=()=>r&&"0"===process.env[s],p=()=>a||i&&i.isMaster||c(),l=e=>{o.forEach((n=>n(e)))},u=(t,a)=>{if(e("cluster message received from worker ",t,": ",a),t.topic&&t.data&&(a=t,t=void 0),a&&a.topic&&"log4js:message"===a.topic){e("received message: ",a.data);const t=n.deserialise(a.data);l(t)}};return a||t.addListener((n=>{o.length=0,({pm2:r,disableClustering:a,pm2InstanceVar:s="NODE_APP_INSTANCE"}=n),e(`clustering disabled ? ${a}`),e(`cluster.isMaster ? ${i&&i.isMaster}`),e(`pm2 enabled ? ${r}`),e(`pm2InstanceVar = ${s}`),e(`process.env[${s}] = ${process.env[s]}`),r&&process.removeListener("message",u),i&&i.removeListener&&i.removeListener("message",u),a||n.disableClustering?e("Not listening for cluster messages, because clustering disabled."):c()?(e("listening for PM2 broadcast messages"),process.on("message",u)):i&&i.isMaster?(e("listening for cluster messages"),i.on("message",u)):e("not listening for messages, because we are not a master process")})),Ds={onlyOnMaster:(e,n)=>p()?e():n,isMaster:p,send:e=>{p()?l(e):(r||(e.cluster={workerId:i.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{o.push(e)}}}var Us,Ws={};function Gs(){if(Us)return Ws;function e(e){if("number"==typeof e&&Number.isInteger(e))return e;const n={K:1024,M:1048576,G:1073741824},t=Object.keys(n),a=e.slice(-1).toLocaleUpperCase(),i=e.slice(0,-1).trim();if(t.indexOf(a)<0||!Number.isInteger(Number(i)))throw Error(`maxLogSize: "${e}" is invalid`);return i*n[a]}function n(n){return function(e,n){const t=Object.assign({},n);return Object.keys(e).forEach((a=>{t[a]&&(t[a]=e[a](n[a]))})),t}({maxLogSize:e},n)}Us=1;const t={dateFile:n,file:n,fileSync:n};return Ws.modifyConfig=e=>t[e.type]?t[e.type](e):e,Ws}var Hs,Js={};function Ks(){if(Hs)return Js;Hs=1;const e=console.log.bind(console);return Js.configure=function(n,t){let a=t.colouredLayout;return n.layout&&(a=t.layout(n.layout.type,n.layout)),function(n,t){return a=>{e(n(a,t))}}(a,n.timezoneOffset)},Js}var Vs,Zs={};function Qs(){if(Vs)return Zs;return Vs=1,Zs.configure=function(e,n){let t=n.colouredLayout;return e.layout&&(t=n.layout(e.layout.type,e.layout)),function(e,n){return t=>{process.stdout.write(`${e(t,n)}\n`)}}(t,e.timezoneOffset)},Zs}var Ys,Xs={};function ec(){if(Ys)return Xs;return Ys=1,Xs.configure=function(e,n){let t=n.colouredLayout;return e.layout&&(t=n.layout(e.layout.type,e.layout)),function(e,n){return t=>{process.stderr.write(`${e(t,n)}\n`)}}(t,e.timezoneOffset)},Xs}var nc,tc={};var ac,ic={};function oc(){if(ac)return ic;ac=1;const e=Ss()("log4js:categoryFilter");return ic.configure=function(n,t,a){const i=a(n.appender);return function(n,t){return"string"==typeof n&&(n=[n]),a=>{e(`Checking ${a.categoryName} against ${n}`),-1===n.indexOf(a.categoryName)&&(e("Not excluded, sending to appender"),t(a))}}(n.exclude,i)},ic}var rc,sc={};function cc(){if(rc)return sc;rc=1;const e=Ss()("log4js:noLogFilter");return sc.configure=function(n,t,a){const i=a(n.appender);return function(n,t){return a=>{e(`Checking data: ${a.data} against filters: ${n}`),"string"==typeof n&&(n=[n]),n=n.filter((e=>null!=e&&""!==e));const i=new RegExp(n.join("|"),"i");(0===n.length||a.data.findIndex((e=>i.test(e)))<0)&&(e("Not excluded, sending to appender"),t(a))}}(n.exclude,i)},sc}var pc,lc,uc,dc,fc,mc,hc,vc,xc,bc,yc,gc,wc,Sc,kc,Ec,jc,Oc,Cc,_c,Ac,Fc,Tc,Pc,Nc,Ic,Lc,Mc,Dc,Bc,qc,Rc,zc,$c,Uc,Wc,Gc,Hc,Jc,Kc,Vc,Zc,Qc,Yc,Xc,ep,np,tp,ap,ip,op,rp,sp,cp,pp,lp,up,dp,fp,mp,hp,vp,xp,bp,yp,gp,wp,Sp,kp,Ep,jp,Op,Cp,_p,Ap,Fp,Tp,Pp,Np,Ip,Lp,Mp,Dp,Bp,qp,Rp,zp,$p,Up,Wp,Gp={},Hp={exports:{}},Jp={},Kp={};function Vp(){return pc||(pc=1,Kp.fromCallback=function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((n,t)=>{arguments[arguments.length]=(e,a)=>{if(e)return t(e);n(a)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},Kp.fromPromise=function(e){return Object.defineProperty((function(){const n=arguments[arguments.length-1];if("function"!=typeof n)return e.apply(this,arguments);e.apply(this,arguments).then((e=>n(null,e)),n)}),"name",{value:e.name})}),Kp}function Zp(){if(uc)return lc;uc=1;var e=g,n=process.cwd,t=null,a=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return t||(t=n.call(process)),t};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var i=process.chdir;process.chdir=function(e){t=null,i.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,i)}return lc=function(n){e.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(n){n.lchmod=function(t,a,i){n.open(t,e.O_WRONLY|e.O_SYMLINK,a,(function(e,t){e?i&&i(e):n.fchmod(t,a,(function(e){n.close(t,(function(n){i&&i(e||n)}))}))}))},n.lchmodSync=function(t,a){var i,o=n.openSync(t,e.O_WRONLY|e.O_SYMLINK,a),r=!0;try{i=n.fchmodSync(o,a),r=!1}finally{if(r)try{n.closeSync(o)}catch(e){}else n.closeSync(o)}return i}}(n);n.lutimes||function(n){e.hasOwnProperty("O_SYMLINK")&&n.futimes?(n.lutimes=function(t,a,i,o){n.open(t,e.O_SYMLINK,(function(e,t){e?o&&o(e):n.futimes(t,a,i,(function(e){n.close(t,(function(n){o&&o(e||n)}))}))}))},n.lutimesSync=function(t,a,i){var o,r=n.openSync(t,e.O_SYMLINK),s=!0;try{o=n.futimesSync(r,a,i),s=!1}finally{if(s)try{n.closeSync(r)}catch(e){}else n.closeSync(r)}return o}):n.futimes&&(n.lutimes=function(e,n,t,a){a&&process.nextTick(a)},n.lutimesSync=function(){})}(n);n.chown=o(n.chown),n.fchown=o(n.fchown),n.lchown=o(n.lchown),n.chmod=t(n.chmod),n.fchmod=t(n.fchmod),n.lchmod=t(n.lchmod),n.chownSync=r(n.chownSync),n.fchownSync=r(n.fchownSync),n.lchownSync=r(n.lchownSync),n.chmodSync=i(n.chmodSync),n.fchmodSync=i(n.fchmodSync),n.lchmodSync=i(n.lchmodSync),n.stat=s(n.stat),n.fstat=s(n.fstat),n.lstat=s(n.lstat),n.statSync=c(n.statSync),n.fstatSync=c(n.fstatSync),n.lstatSync=c(n.lstatSync),n.chmod&&!n.lchmod&&(n.lchmod=function(e,n,t){t&&process.nextTick(t)},n.lchmodSync=function(){});n.chown&&!n.lchown&&(n.lchown=function(e,n,t,a){a&&process.nextTick(a)},n.lchownSync=function(){});"win32"===a&&(n.rename="function"!=typeof n.rename?n.rename:function(e){function t(t,a,i){var o=Date.now(),r=0;e(t,a,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){n.stat(a,(function(n,o){n&&"ENOENT"===n.code?e(t,a,s):i(c)}))}),r),void(r<100&&(r+=10));i&&i(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(n.rename));function t(e){return e?function(t,a,i){return e.call(n,t,a,(function(e){p(e)&&(e=null),i&&i.apply(this,arguments)}))}:e}function i(e){return e?function(t,a){try{return e.call(n,t,a)}catch(e){if(!p(e))throw e}}:e}function o(e){return e?function(t,a,i,o){return e.call(n,t,a,i,(function(e){p(e)&&(e=null),o&&o.apply(this,arguments)}))}:e}function r(e){return e?function(t,a,i){try{return e.call(n,t,a,i)}catch(e){if(!p(e))throw e}}:e}function s(e){return e?function(t,a,i){function o(e,n){n&&(n.uid<0&&(n.uid+=4294967296),n.gid<0&&(n.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof a&&(i=a,a=null),a?e.call(n,t,a,o):e.call(n,t,o)}:e}function c(e){return e?function(t,a){var i=a?e.call(n,t,a):e.call(n,t);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:e}function p(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}n.read="function"!=typeof n.read?n.read:function(e){function t(t,a,i,o,r,s){var c;if(s&&"function"==typeof s){var p=0;c=function(l,u,d){if(l&&"EAGAIN"===l.code&&p<10)return p++,e.call(n,t,a,i,o,r,c);s.apply(this,arguments)}}return e.call(n,t,a,i,o,r,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(n.read),n.readSync="function"!=typeof n.readSync?n.readSync:(l=n.readSync,function(e,t,a,i,o){for(var r=0;;)try{return l.call(n,e,t,a,i,o)}catch(e){if("EAGAIN"===e.code&&r<10){r++;continue}throw e}});var l},lc}function Qp(){if(xc)return vc;xc=1;var e,t,a=n,i=Zp(),o=function(){if(fc)return dc;fc=1;var e=d.Stream;return dc=function(n){return{ReadStream:function t(a,i){if(!(this instanceof t))return new t(a,i);e.call(this);var o=this;this.path=a,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,i=i||{};for(var r=Object.keys(i),s=0,c=r.length;s<c;s++){var p=r[s];this[p]=i[p]}if(this.encoding&&this.setEncoding(this.encoding),void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}null===this.fd?n.open(this.path,this.flags,this.mode,(function(e,n){if(e)return o.emit("error",e),void(o.readable=!1);o.fd=n,o.emit("open",n),o._read()})):process.nextTick((function(){o._read()}))},WriteStream:function t(a,i){if(!(this instanceof t))return new t(a,i);e.call(this),this.path=a,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),r=0,s=o.length;r<s;r++){var c=o[r];this[c]=i[c]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=n.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}},dc}(),r=function(){if(hc)return mc;hc=1,mc=function(n){if(null===n||"object"!=typeof n)return n;if(n instanceof Object)var t={__proto__:e(n)};else t=Object.create(null);return Object.getOwnPropertyNames(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t};var e=Object.getPrototypeOf||function(e){return e.__proto__};return mc}(),s=m;function c(n,t){Object.defineProperty(n,e,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(e=Symbol.for("graceful-fs.queue"),t=Symbol.for("graceful-fs.previous")):(e="___graceful-fs.queue",t="___graceful-fs.previous");var p,l=function(){};if(s.debuglog?l=s.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(l=function(){var e=s.format.apply(s,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!a[e]){var u=H[e]||[];c(a,u),a.close=function(e){function n(n,t){return e.call(a,n,(function(e){e||v(),"function"==typeof t&&t.apply(this,arguments)}))}return Object.defineProperty(n,t,{value:e}),n}(a.close),a.closeSync=function(e){function n(n){e.apply(a,arguments),v()}return Object.defineProperty(n,t,{value:e}),n}(a.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){l(a[e]),w.equal(a[e].length,0)}))}function f(e){i(e),e.gracefulify=f,e.createReadStream=function(n,t){return new e.ReadStream(n,t)},e.createWriteStream=function(n,t){return new e.WriteStream(n,t)};var n=e.readFile;e.readFile=function(e,t,a){"function"==typeof t&&(a=t,t=null);return function e(t,a,i,o){return n(t,a,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof i&&i.apply(this,arguments):h([e,[t,a,i],n,o||Date.now(),Date.now()])}))}(e,t,a)};var t=e.writeFile;e.writeFile=function(e,n,a,i){"function"==typeof a&&(i=a,a=null);return function e(n,a,i,o,r){return t(n,a,i,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof o&&o.apply(this,arguments):h([e,[n,a,i,o],t,r||Date.now(),Date.now()])}))}(e,n,a,i)};var a=e.appendFile;a&&(e.appendFile=function(e,n,t,i){"function"==typeof t&&(i=t,t=null);return function e(n,t,i,o,r){return a(n,t,i,(function(a){!a||"EMFILE"!==a.code&&"ENFILE"!==a.code?"function"==typeof o&&o.apply(this,arguments):h([e,[n,t,i,o],a,r||Date.now(),Date.now()])}))}(e,n,t,i)});var r=e.copyFile;r&&(e.copyFile=function(e,n,t,a){"function"==typeof t&&(a=t,t=0);return function e(n,t,a,i,o){return r(n,t,a,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof i&&i.apply(this,arguments):h([e,[n,t,a,i],r,o||Date.now(),Date.now()])}))}(e,n,t,a)});var s=e.readdir;e.readdir=function(e,n,t){"function"==typeof n&&(t=n,n=null);var a=c.test(process.version)?function(e,n,t,a){return s(e,i(e,n,t,a))}:function(e,n,t,a){return s(e,n,i(e,n,t,a))};return a(e,n,t);function i(e,n,t,i){return function(o,r){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(r&&r.sort&&r.sort(),"function"==typeof t&&t.call(this,o,r)):h([a,[e,n,t],o,i||Date.now(),Date.now()])}}};var c=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var p=o(e);v=p.ReadStream,x=p.WriteStream}var l=e.ReadStream;l&&(v.prototype=Object.create(l.prototype),v.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(n,t){n?(e.autoClose&&e.destroy(),e.emit("error",n)):(e.fd=t,e.emit("open",t),e.read())}))});var u=e.WriteStream;u&&(x.prototype=Object.create(u.prototype),x.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(n,t){n?(e.destroy(),e.emit("error",n)):(e.fd=t,e.emit("open",t))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return v},set:function(e){v=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0});var d=v;Object.defineProperty(e,"FileReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var m=x;function v(e,n){return this instanceof v?(l.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function x(e,n){return this instanceof x?(u.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return m},set:function(e){m=e},enumerable:!0,configurable:!0});var b=e.open;function y(e,n,t,a){return"function"==typeof t&&(a=t,t=null),function e(n,t,a,i,o){return b(n,t,a,(function(r,s){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof i&&i.apply(this,arguments):h([e,[n,t,a,i],r,o||Date.now(),Date.now()])}))}(e,n,t,a)}return e.open=y,e}function h(n){l("ENQUEUE",n[0].name,n[1]),a[e].push(n),x()}function v(){for(var n=Date.now(),t=0;t<a[e].length;++t)a[e][t].length>2&&(a[e][t][3]=n,a[e][t][4]=n);x()}function x(){if(clearTimeout(p),p=void 0,0!==a[e].length){var n=a[e].shift(),t=n[0],i=n[1],o=n[2],r=n[3],s=n[4];if(void 0===r)l("RETRY",t.name,i),t.apply(null,i);else if(Date.now()-r>=6e4){l("TIMEOUT",t.name,i);var c=i.pop();"function"==typeof c&&c.call(null,o)}else{var u=Date.now()-s,d=Math.max(s-r,1);u>=Math.min(1.2*d,100)?(l("RETRY",t.name,i),t.apply(null,i.concat([r]))):a[e].push(n)}void 0===p&&(p=setTimeout(x,0))}}return H[e]||c(H,a[e]),vc=f(r(a)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!a.__patched&&(vc=f(a),a.__patched=!0),vc}function Yp(){return bc||(bc=1,function(e){const n=Vp().fromCallback,t=Qp(),a=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof t[e]));Object.keys(t).forEach((n=>{"promises"!==n&&(e[n]=t[n])})),a.forEach((a=>{e[a]=n(t[a])})),e.exists=function(e,n){return"function"==typeof n?t.exists(e,n):new Promise((n=>t.exists(e,n)))},e.read=function(e,n,a,i,o,r){return"function"==typeof r?t.read(e,n,a,i,o,r):new Promise(((r,s)=>{t.read(e,n,a,i,o,((e,n,t)=>{if(e)return s(e);r({bytesRead:n,buffer:t})}))}))},e.write=function(e,n,...a){return"function"==typeof a[a.length-1]?t.write(e,n,...a):new Promise(((i,o)=>{t.write(e,n,...a,((e,n,t)=>{if(e)return o(e);i({bytesWritten:n,buffer:t})}))}))},"function"==typeof t.realpath.native&&(e.realpath.native=n(t.realpath.native))}(Jp)),Jp}function Xp(){if(gc)return yc;gc=1;const e=o;function n(n){return(n=e.normalize(e.resolve(n)).split(e.sep)).length>0?n[0]:null}const t=/[<>:"|?*]/;return yc={getRootPath:n,invalidWin32Path:function(e){const a=n(e);return e=e.replace(a,""),t.test(e)}}}function el(){if(Oc)return jc;Oc=1;const e=(0,Vp().fromCallback)(function(){if(Sc)return wc;Sc=1;const e=Qp(),n=o,t=Xp().invalidWin32Path,a=parseInt("0777",8);return wc=function i(o,r,s,c){if("function"==typeof r?(s=r,r={}):r&&"object"==typeof r||(r={mode:r}),"win32"===process.platform&&t(o)){const e=new Error(o+" contains invalid WIN32 path characters.");return e.code="EINVAL",s(e)}let p=r.mode;const l=r.fs||e;void 0===p&&(p=a&~process.umask()),c||(c=null),s=s||function(){},o=n.resolve(o),l.mkdir(o,p,(e=>{if(!e)return s(null,c=c||o);if("ENOENT"===e.code){if(n.dirname(o)===o)return s(e);i(n.dirname(o),r,((e,n)=>{e?s(e,n):i(o,r,s,n)}))}else l.stat(o,((n,t)=>{n||!t.isDirectory()?s(e,c):s(null,c)}))}))},wc}()),n=function(){if(Ec)return kc;Ec=1;const e=Qp(),n=o,t=Xp().invalidWin32Path,a=parseInt("0777",8);return kc=function i(o,r,s){r&&"object"==typeof r||(r={mode:r});let c=r.mode;const p=r.fs||e;if("win32"===process.platform&&t(o)){const e=new Error(o+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===c&&(c=a&~process.umask()),s||(s=null),o=n.resolve(o);try{p.mkdirSync(o,c),s=s||o}catch(e){if("ENOENT"===e.code){if(n.dirname(o)===o)throw e;s=i(n.dirname(o),r,s),i(o,r,s)}else{let n;try{n=p.statSync(o)}catch(n){throw e}if(!n.isDirectory())throw e}}return s},kc}();return jc={mkdirs:e,mkdirsSync:n,mkdirp:e,mkdirpSync:n,ensureDir:e,ensureDirSync:n}}function nl(){if(_c)return Cc;_c=1;const e=Qp(),n=h,t=o;return Cc={hasMillisRes:function(a){let i=t.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));i=t.join(n.tmpdir(),i);const o=new Date(1435410243862);e.writeFile(i,"https://github.com/jprichardson/node-fs-extra/pull/141",(n=>{if(n)return a(n);e.open(i,"r+",((n,t)=>{if(n)return a(n);e.futimes(t,o,o,(n=>{if(n)return a(n);e.close(t,(n=>{if(n)return a(n);e.stat(i,((e,n)=>{if(e)return a(e);a(null,n.mtime>1435410243e3)}))}))}))}))}))},hasMillisResSync:function(){let a=t.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));a=t.join(n.tmpdir(),a);const i=new Date(1435410243862);e.writeFileSync(a,"https://github.com/jprichardson/node-fs-extra/pull/141");const o=e.openSync(a,"r+");return e.futimesSync(o,i,i),e.closeSync(o),e.statSync(a).mtime>1435410243e3},timeRemoveMillis:function(e){if("number"==typeof e)return 1e3*Math.floor(e/1e3);if(e instanceof Date)return new Date(1e3*Math.floor(e.getTime()/1e3));throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")},utimesMillis:function(n,t,a,i){e.open(n,"r+",((n,o)=>{if(n)return i(n);e.futimes(o,t,a,(n=>{e.close(o,(e=>{i&&i(n||e)}))}))}))},utimesMillisSync:function(n,t,a){const i=e.openSync(n,"r+");return e.futimesSync(i,t,a),e.closeSync(i)}}}function tl(){if(Fc)return Ac;Fc=1;const e=Qp(),n=o,t=process.versions.node.split("."),a=Number.parseInt(t[0],10),i=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);function s(){if(a>10)return!0;if(10===a){if(i>5)return!0;if(5===i&&r>=0)return!0}return!1}function c(e,t){const a=n.resolve(e).split(n.sep).filter((e=>e)),i=n.resolve(t).split(n.sep).filter((e=>e));return a.reduce(((e,n,t)=>e&&i[t]===n),!0)}function p(e,n,t){return`Cannot ${t} '${e}' to a subdirectory of itself, '${n}'.`}return Ac={checkPaths:function(n,t,a,i){!function(n,t,a){s()?e.stat(n,{bigint:!0},((n,i)=>{if(n)return a(n);e.stat(t,{bigint:!0},((e,n)=>e?"ENOENT"===e.code?a(null,{srcStat:i,destStat:null}):a(e):a(null,{srcStat:i,destStat:n})))})):e.stat(n,((n,i)=>{if(n)return a(n);e.stat(t,((e,n)=>e?"ENOENT"===e.code?a(null,{srcStat:i,destStat:null}):a(e):a(null,{srcStat:i,destStat:n})))}))}(n,t,((e,o)=>{if(e)return i(e);const{srcStat:r,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===r.ino&&s.dev===r.dev?i(new Error("Source and destination must not be the same.")):r.isDirectory()&&c(n,t)?i(new Error(p(n,t,a))):i(null,{srcStat:r,destStat:s})}))},checkPathsSync:function(n,t,a){const{srcStat:i,destStat:o}=function(n,t){let a,i;a=s()?e.statSync(n,{bigint:!0}):e.statSync(n);try{i=s()?e.statSync(t,{bigint:!0}):e.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:a,destStat:null};throw e}return{srcStat:a,destStat:i}}(n,t);if(o&&o.ino&&o.dev&&o.ino===i.ino&&o.dev===i.dev)throw new Error("Source and destination must not be the same.");if(i.isDirectory()&&c(n,t))throw new Error(p(n,t,a));return{srcStat:i,destStat:o}},checkParentPaths:function t(a,i,o,r,c){const l=n.resolve(n.dirname(a)),u=n.resolve(n.dirname(o));if(u===l||u===n.parse(u).root)return c();s()?e.stat(u,{bigint:!0},((e,n)=>e?"ENOENT"===e.code?c():c(e):n.ino&&n.dev&&n.ino===i.ino&&n.dev===i.dev?c(new Error(p(a,o,r))):t(a,i,u,r,c))):e.stat(u,((e,n)=>e?"ENOENT"===e.code?c():c(e):n.ino&&n.dev&&n.ino===i.ino&&n.dev===i.dev?c(new Error(p(a,o,r))):t(a,i,u,r,c)))},checkParentPathsSync:function t(a,i,o,r){const c=n.resolve(n.dirname(a)),l=n.resolve(n.dirname(o));if(l===c||l===n.parse(l).root)return;let u;try{u=s()?e.statSync(l,{bigint:!0}):e.statSync(l)}catch(e){if("ENOENT"===e.code)return;throw e}if(u.ino&&u.dev&&u.ino===i.ino&&u.dev===i.dev)throw new Error(p(a,o,r));return t(a,i,l,r)},isSrcSubdir:c},Ac}function al(){if(Ic)return Nc;Ic=1;const e=Qp(),n=o,t=el().mkdirsSync,a=nl().utimesMillisSync,i=tl();function r(t,a,o,r){if(!r.filter||r.filter(a,o))return function(t,a,o,r){const p=r.dereference?e.statSync:e.lstatSync,l=p(a);if(l.isDirectory())return function(n,t,a,i,o){if(!t)return function(n,t,a,i){return e.mkdirSync(a),c(t,a,i),e.chmodSync(a,n.mode)}(n,a,i,o);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${i}' with directory '${a}'.`);return c(a,i,o)}(l,t,a,o,r);if(l.isFile()||l.isCharacterDevice()||l.isBlockDevice())return function(n,t,a,i,o){return t?function(n,t,a,i){if(i.overwrite)return e.unlinkSync(a),s(n,t,a,i);if(i.errorOnExist)throw new Error(`'${a}' already exists`)}(n,a,i,o):s(n,a,i,o)}(l,t,a,o,r);if(l.isSymbolicLink())return function(t,a,o,r){let s=e.readlinkSync(a);r.dereference&&(s=n.resolve(process.cwd(),s));if(t){let t;try{t=e.readlinkSync(o)}catch(n){if("EINVAL"===n.code||"UNKNOWN"===n.code)return e.symlinkSync(s,o);throw n}if(r.dereference&&(t=n.resolve(process.cwd(),t)),i.isSrcSubdir(s,t))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${t}'.`);if(e.statSync(o).isDirectory()&&i.isSrcSubdir(t,s))throw new Error(`Cannot overwrite '${t}' with '${s}'.`);return function(n,t){return e.unlinkSync(t),e.symlinkSync(n,t)}(s,o)}return e.symlinkSync(s,o)}(t,a,o,r)}(t,a,o,r)}function s(n,t,i,o){return"function"==typeof e.copyFileSync?(e.copyFileSync(t,i),e.chmodSync(i,n.mode),o.preserveTimestamps?a(i,n.atime,n.mtime):void 0):function(n,t,a,i){const o=65536,r=(Pc?Tc:(Pc=1,Tc=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(n){return new Buffer(e)}return new Buffer(e)}))(o),s=e.openSync(t,"r"),c=e.openSync(a,"w",n.mode);let p=0;for(;p<n.size;){const n=e.readSync(s,r,0,o,p);e.writeSync(c,r,0,n),p+=n}i.preserveTimestamps&&e.futimesSync(c,n.atime,n.mtime);e.closeSync(s),e.closeSync(c)}(n,t,i,o)}function c(t,a,o){e.readdirSync(t).forEach((e=>function(e,t,a,o){const s=n.join(t,e),c=n.join(a,e),{destStat:p}=i.checkPathsSync(s,c,"copy");return r(p,s,c,o)}(e,t,a,o)))}return Nc=function(a,o,s){"function"==typeof s&&(s={filter:s}),(s=s||{}).clobber=!("clobber"in s)||!!s.clobber,s.overwrite="overwrite"in s?!!s.overwrite:s.clobber,s.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:c,destStat:p}=i.checkPathsSync(a,o,"copy");return i.checkParentPathsSync(a,c,o,"copy"),function(a,i,o,s){if(s.filter&&!s.filter(i,o))return;const c=n.dirname(o);e.existsSync(c)||t(c);return r(a,i,o,s)}(p,a,o,s)},Nc}function il(){return Mc?Lc:(Mc=1,Lc={copySync:al()})}function ol(){if(Bc)return Dc;Bc=1;const e=Vp().fromPromise,n=Yp();return Dc={pathExists:e((function(e){return n.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:n.existsSync}}function rl(){if(Rc)return qc;Rc=1;const e=Qp(),n=o,t=el().mkdirs,a=ol().pathExists,i=nl().utimesMillis,r=tl();function s(e,i,o,r,s){const c=n.dirname(o);a(c,((n,a)=>n?s(n):a?p(e,i,o,r,s):void t(c,(n=>n?s(n):p(e,i,o,r,s)))))}function c(e,n,t,a,i,o){Promise.resolve(i.filter(t,a)).then((r=>r?e(n,t,a,i,o):o()),(e=>o(e)))}function p(e,n,t,a,i){return a.filter?c(l,e,n,t,a,i):l(e,n,t,a,i)}function l(n,t,a,i,o){(i.dereference?e.stat:e.lstat)(t,((r,s)=>r?o(r):s.isDirectory()?function(n,t,a,i,o,r){if(!t)return function(n,t,a,i,o){e.mkdir(a,(r=>{if(r)return o(r);f(t,a,i,(t=>t?o(t):e.chmod(a,n.mode,o)))}))}(n,a,i,o,r);if(t&&!t.isDirectory())return r(new Error(`Cannot overwrite non-directory '${i}' with directory '${a}'.`));return f(a,i,o,r)}(s,n,t,a,i,o):s.isFile()||s.isCharacterDevice()||s.isBlockDevice()?function(n,t,a,i,o,r){return t?function(n,t,a,i,o){if(!i.overwrite)return i.errorOnExist?o(new Error(`'${a}' already exists`)):o();e.unlink(a,(e=>e?o(e):u(n,t,a,i,o)))}(n,a,i,o,r):u(n,a,i,o,r)}(s,n,t,a,i,o):s.isSymbolicLink()?h(n,t,a,i,o):void 0))}function u(n,t,a,i,o){return"function"==typeof e.copyFile?e.copyFile(t,a,(e=>e?o(e):d(n,a,i,o))):function(n,t,a,i,o){const r=e.createReadStream(t);r.on("error",(e=>o(e))).once("open",(()=>{const t=e.createWriteStream(a,{mode:n.mode});t.on("error",(e=>o(e))).on("open",(()=>r.pipe(t))).once("close",(()=>d(n,a,i,o)))}))}(n,t,a,i,o)}function d(n,t,a,o){e.chmod(t,n.mode,(e=>e?o(e):a.preserveTimestamps?i(t,n.atime,n.mtime,o):o()))}function f(n,t,a,i){e.readdir(n,((e,o)=>e?i(e):m(o,n,t,a,i)))}function m(e,t,a,i,o){const s=e.pop();return s?function(e,t,a,i,o,s){const c=n.join(a,t),l=n.join(i,t);r.checkPaths(c,l,"copy",((n,t)=>{if(n)return s(n);const{destStat:r}=t;p(r,c,l,o,(n=>n?s(n):m(e,a,i,o,s)))}))}(e,s,t,a,i,o):o()}function h(t,a,i,o,s){e.readlink(a,((a,c)=>a?s(a):(o.dereference&&(c=n.resolve(process.cwd(),c)),t?void e.readlink(i,((a,p)=>a?"EINVAL"===a.code||"UNKNOWN"===a.code?e.symlink(c,i,s):s(a):(o.dereference&&(p=n.resolve(process.cwd(),p)),r.isSrcSubdir(c,p)?s(new Error(`Cannot copy '${c}' to a subdirectory of itself, '${p}'.`)):t.isDirectory()&&r.isSrcSubdir(p,c)?s(new Error(`Cannot overwrite '${p}' with '${c}'.`)):function(n,t,a){e.unlink(t,(i=>i?a(i):e.symlink(n,t,a)))}(c,i,s)))):e.symlink(c,i,s))))}return qc=function(e,n,t,a){"function"!=typeof t||a?"function"==typeof t&&(t={filter:t}):(a=t,t={}),a=a||function(){},(t=t||{}).clobber=!("clobber"in t)||!!t.clobber,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),r.checkPaths(e,n,"copy",((i,o)=>{if(i)return a(i);const{srcStat:p,destStat:l}=o;r.checkParentPaths(e,p,n,"copy",(i=>i?a(i):t.filter?c(s,l,e,n,t,a):s(l,e,n,t,a)))}))},qc}function sl(){if($c)return zc;$c=1;const e=Vp().fromCallback;return zc={copy:e(rl())}}function cl(){if(Wc)return Uc;Wc=1;const e=Qp(),n=o,t=w,a="win32"===process.platform;function i(n){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{n[t]=n[t]||e[t],n[t+="Sync"]=n[t]||e[t]})),n.maxBusyTries=n.maxBusyTries||3}function r(e,n,a){let o=0;"function"==typeof n&&(a=n,n={}),t(e,"rimraf: missing path"),t.strictEqual(typeof e,"string","rimraf: path should be a string"),t.strictEqual(typeof a,"function","rimraf: callback function required"),t(n,"rimraf: invalid options argument provided"),t.strictEqual(typeof n,"object","rimraf: options should be object"),i(n),s(e,n,(function t(i){if(i){if(("EBUSY"===i.code||"ENOTEMPTY"===i.code||"EPERM"===i.code)&&o<n.maxBusyTries){o++;return setTimeout((()=>s(e,n,t)),100*o)}"ENOENT"===i.code&&(i=null)}a(i)}))}function s(e,n,i){t(e),t(n),t("function"==typeof i),n.lstat(e,((t,o)=>t&&"ENOENT"===t.code?i(null):t&&"EPERM"===t.code&&a?c(e,n,t,i):o&&o.isDirectory()?l(e,n,t,i):void n.unlink(e,(t=>{if(t){if("ENOENT"===t.code)return i(null);if("EPERM"===t.code)return a?c(e,n,t,i):l(e,n,t,i);if("EISDIR"===t.code)return l(e,n,t,i)}return i(t)}))))}function c(e,n,a,i){t(e),t(n),t("function"==typeof i),a&&t(a instanceof Error),n.chmod(e,438,(t=>{t?i("ENOENT"===t.code?null:a):n.stat(e,((t,o)=>{t?i("ENOENT"===t.code?null:a):o.isDirectory()?l(e,n,a,i):n.unlink(e,i)}))}))}function p(e,n,a){let i;t(e),t(n),a&&t(a instanceof Error);try{n.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw a}try{i=n.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw a}i.isDirectory()?d(e,n,a):n.unlinkSync(e)}function l(e,a,i,o){t(e),t(a),i&&t(i instanceof Error),t("function"==typeof o),a.rmdir(e,(s=>{!s||"ENOTEMPTY"!==s.code&&"EEXIST"!==s.code&&"EPERM"!==s.code?s&&"ENOTDIR"===s.code?o(i):o(s):function(e,a,i){t(e),t(a),t("function"==typeof i),a.readdir(e,((t,o)=>{if(t)return i(t);let s,c=o.length;if(0===c)return a.rmdir(e,i);o.forEach((t=>{r(n.join(e,t),a,(n=>{if(!s)return n?i(s=n):void(0==--c&&a.rmdir(e,i))}))}))}))}(e,a,o)}))}function u(e,n){let o;i(n=n||{}),t(e,"rimraf: missing path"),t.strictEqual(typeof e,"string","rimraf: path should be a string"),t(n,"rimraf: missing options"),t.strictEqual(typeof n,"object","rimraf: options should be object");try{o=n.lstatSync(e)}catch(t){if("ENOENT"===t.code)return;"EPERM"===t.code&&a&&p(e,n,t)}try{o&&o.isDirectory()?d(e,n,null):n.unlinkSync(e)}catch(t){if("ENOENT"===t.code)return;if("EPERM"===t.code)return a?p(e,n,t):d(e,n,t);if("EISDIR"!==t.code)throw t;d(e,n,t)}}function d(e,i,o){t(e),t(i),o&&t(o instanceof Error);try{i.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw o;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,i){if(t(e),t(i),i.readdirSync(e).forEach((t=>u(n.join(e,t),i))),!a){return i.rmdirSync(e,i)}{const n=Date.now();do{try{return i.rmdirSync(e,i)}catch(e){}}while(Date.now()-n<500)}}(e,i);else if("ENOENT"!==r.code)throw r}}return Uc=r,r.sync=u,Uc}function pl(){if(Hc)return Gc;Hc=1;const e=Vp().fromCallback,n=cl();return Gc={remove:e(n),removeSync:n.sync}}function ll(){if(Zc)return Vc;Zc=1;const e=Vp().fromCallback,n=o,t=Qp(),a=el(),i=ol().pathExists;return Vc={createFile:e((function(e,o){function r(){t.writeFile(e,"",(e=>{if(e)return o(e);o()}))}t.stat(e,((t,s)=>{if(!t&&s.isFile())return o();const c=n.dirname(e);i(c,((e,n)=>e?o(e):n?r():void a.mkdirs(c,(e=>{if(e)return o(e);r()}))))}))})),createFileSync:function(e){let i;try{i=t.statSync(e)}catch(e){}if(i&&i.isFile())return;const o=n.dirname(e);t.existsSync(o)||a.mkdirsSync(o),t.writeFileSync(e,"")}},Vc}function ul(){if(Yc)return Qc;Yc=1;const e=Vp().fromCallback,n=o,t=Qp(),a=el(),i=ol().pathExists;return Qc={createLink:e((function(e,o,r){function s(e,n){t.link(e,n,(e=>{if(e)return r(e);r(null)}))}i(o,((c,p)=>c?r(c):p?r(null):void t.lstat(e,(t=>{if(t)return t.message=t.message.replace("lstat","ensureLink"),r(t);const c=n.dirname(o);i(c,((n,t)=>n?r(n):t?s(e,o):void a.mkdirs(c,(n=>{if(n)return r(n);s(e,o)}))))}))))})),createLinkSync:function(e,i){if(t.existsSync(i))return;try{t.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const o=n.dirname(i);return t.existsSync(o)||a.mkdirsSync(o),t.linkSync(e,i)}},Qc}function dl(){if(ip)return ap;ip=1;const e=Vp().fromCallback,n=o,t=Qp(),a=el(),i=a.mkdirs,r=a.mkdirsSync,s=function(){if(ep)return Xc;ep=1;const e=o,n=Qp(),t=ol().pathExists;return Xc={symlinkPaths:function(a,i,o){if(e.isAbsolute(a))return n.lstat(a,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),o(e)):o(null,{toCwd:a,toDst:a})));{const r=e.dirname(i),s=e.join(r,a);return t(s,((t,i)=>t?o(t):i?o(null,{toCwd:s,toDst:a}):n.lstat(a,(n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),o(n)):o(null,{toCwd:a,toDst:e.relative(r,a)})))))}},symlinkPathsSync:function(t,a){let i;if(e.isAbsolute(t)){if(i=n.existsSync(t),!i)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}{const o=e.dirname(a),r=e.join(o,t);if(i=n.existsSync(r),i)return{toCwd:r,toDst:t};if(i=n.existsSync(t),!i)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:e.relative(o,t)}}}}}(),c=s.symlinkPaths,p=s.symlinkPathsSync,l=function(){if(tp)return np;tp=1;const e=Qp();return np={symlinkType:function(n,t,a){if(a="function"==typeof t?t:a,t="function"!=typeof t&&t)return a(null,t);e.lstat(n,((e,n)=>{if(e)return a(null,"file");t=n&&n.isDirectory()?"dir":"file",a(null,t)}))},symlinkTypeSync:function(n,t){let a;if(t)return t;try{a=e.lstatSync(n)}catch(e){return"file"}return a&&a.isDirectory()?"dir":"file"}},np}(),u=l.symlinkType,d=l.symlinkTypeSync,f=ol().pathExists;return ap={createSymlink:e((function(e,a,o,r){r="function"==typeof o?o:r,o="function"!=typeof o&&o,f(a,((s,p)=>s?r(s):p?r(null):void c(e,a,((s,c)=>{if(s)return r(s);e=c.toDst,u(c.toCwd,o,((o,s)=>{if(o)return r(o);const c=n.dirname(a);f(c,((n,o)=>n?r(n):o?t.symlink(e,a,s,r):void i(c,(n=>{if(n)return r(n);t.symlink(e,a,s,r)}))))}))}))))})),createSymlinkSync:function(e,a,i){if(t.existsSync(a))return;const o=p(e,a);e=o.toDst,i=d(o.toCwd,i);const s=n.dirname(a);return t.existsSync(s)||r(s),t.symlinkSync(e,a,i)}},ap}function fl(){if(lp)return pp;lp=1;const e=Vp().fromCallback,t=function(){if(cp)return sp;var e;cp=1;try{e=Qp()}catch(t){e=n}function t(e,n){var t,a="\n";return"object"==typeof n&&null!==n&&(n.spaces&&(t=n.spaces),n.EOL&&(a=n.EOL)),JSON.stringify(e,n?n.replacer:null,t).replace(/\n/g,a)+a}function a(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}var i={readFile:function(n,t,i){null==i&&(i=t,t={}),"string"==typeof t&&(t={encoding:t});var o=(t=t||{}).fs||e,r=!0;"throws"in t&&(r=t.throws),o.readFile(n,t,(function(e,o){if(e)return i(e);var s;o=a(o);try{s=JSON.parse(o,t?t.reviver:null)}catch(e){return r?(e.message=n+": "+e.message,i(e)):i(null,null)}i(null,s)}))},readFileSync:function(n,t){"string"==typeof(t=t||{})&&(t={encoding:t});var i=t.fs||e,o=!0;"throws"in t&&(o=t.throws);try{var r=i.readFileSync(n,t);return r=a(r),JSON.parse(r,t.reviver)}catch(e){if(o)throw e.message=n+": "+e.message,e;return null}},writeFile:function(n,a,i,o){null==o&&(o=i,i={});var r=(i=i||{}).fs||e,s="";try{s=t(a,i)}catch(e){return void(o&&o(e,null))}r.writeFile(n,s,i,o)},writeFileSync:function(n,a,i){var o=(i=i||{}).fs||e,r=t(a,i);return o.writeFileSync(n,r,i)}};return sp=i}();return pp={readJson:e(t.readFile),readJsonSync:t.readFileSync,writeJson:e(t.writeFile),writeJsonSync:t.writeFileSync}}function ml(){if(vp)return hp;vp=1;const e=Vp().fromCallback,n=fl();return n.outputJson=e(function(){if(dp)return up;dp=1;const e=o,n=el(),t=ol().pathExists,a=fl();return up=function(i,o,r,s){"function"==typeof r&&(s=r,r={});const c=e.dirname(i);t(c,((e,t)=>e?s(e):t?a.writeJson(i,o,r,s):void n.mkdirs(c,(e=>{if(e)return s(e);a.writeJson(i,o,r,s)}))))},up}()),n.outputJsonSync=function(){if(mp)return fp;mp=1;const e=Qp(),n=o,t=el(),a=fl();return fp=function(i,o,r){const s=n.dirname(i);e.existsSync(s)||t.mkdirsSync(s),a.writeJsonSync(i,o,r)},fp}(),n.outputJSON=n.outputJson,n.outputJSONSync=n.outputJsonSync,n.writeJSON=n.writeJson,n.writeJSONSync=n.writeJsonSync,n.readJSON=n.readJson,n.readJSONSync=n.readJsonSync,hp=n}function hl(){if(bp)return xp;bp=1;const e=Qp(),n=o,t=il().copySync,a=pl().removeSync,i=el().mkdirpSync,r=tl();function s(n,i,o){try{e.renameSync(n,i)}catch(e){if("EXDEV"!==e.code)throw e;return function(e,n,i){const o={overwrite:i,errorOnExist:!0};return t(e,n,o),a(e)}(n,i,o)}}return xp=function(t,o,c){const p=(c=c||{}).overwrite||c.clobber||!1,{srcStat:l}=r.checkPathsSync(t,o,"move");return r.checkParentPathsSync(t,l,o,"move"),i(n.dirname(o)),function(n,t,i){if(i)return a(t),s(n,t,i);if(e.existsSync(t))throw new Error("dest already exists.");return s(n,t,i)}(t,o,p)},xp}function vl(){if(Sp)return wp;Sp=1;const e=Qp(),n=o,t=sl().copy,a=pl().remove,i=el().mkdirp,r=ol().pathExists,s=tl();function c(n,i,o,r){e.rename(n,i,(e=>e?"EXDEV"!==e.code?r(e):function(e,n,i,o){const r={overwrite:i,errorOnExist:!0};t(e,n,r,(n=>n?o(n):a(e,o)))}(n,i,o,r):r()))}return wp=function(e,t,o,p){"function"==typeof o&&(p=o,o={});const l=o.overwrite||o.clobber||!1;s.checkPaths(e,t,"move",((o,u)=>{if(o)return p(o);const{srcStat:d}=u;s.checkParentPaths(e,d,t,"move",(o=>{if(o)return p(o);i(n.dirname(t),(n=>n?p(n):function(e,n,t,i){if(t)return a(n,(a=>a?i(a):c(e,n,t,i)));r(n,((a,o)=>a?i(a):o?i(new Error("dest already exists.")):c(e,n,t,i)))}(e,t,l,p)))}))}))},wp}function xl(){return Cp||(Cp=1,function(e){e.exports=Object.assign({},Yp(),il(),sl(),function(){if(Kc)return Jc;Kc=1;const e=Vp().fromCallback,n=Qp(),t=o,a=el(),i=pl(),r=e((function(e,o){o=o||function(){},n.readdir(e,((n,r)=>{if(n)return a.mkdirs(e,o);r=r.map((n=>t.join(e,n))),function e(){const n=r.pop();if(!n)return o();i.remove(n,(n=>{if(n)return o(n);e()}))}()}))}));function s(e){let o;try{o=n.readdirSync(e)}catch(n){return a.mkdirsSync(e)}o.forEach((n=>{n=t.join(e,n),i.removeSync(n)}))}return Jc={emptyDirSync:s,emptydirSync:s,emptyDir:r,emptydir:r}}(),function(){if(rp)return op;rp=1;const e=ll(),n=ul(),t=dl();return op={createFile:e.createFile,createFileSync:e.createFileSync,ensureFile:e.createFile,ensureFileSync:e.createFileSync,createLink:n.createLink,createLinkSync:n.createLinkSync,ensureLink:n.createLink,ensureLinkSync:n.createLinkSync,createSymlink:t.createSymlink,createSymlinkSync:t.createSymlinkSync,ensureSymlink:t.createSymlink,ensureSymlinkSync:t.createSymlinkSync}}(),ml(),el(),gp?yp:(gp=1,yp={moveSync:hl()}),function(){if(Ep)return kp;Ep=1;const e=Vp().fromCallback;return kp={move:e(vl())}}(),function(){if(Op)return jp;Op=1;const e=Vp().fromCallback,n=Qp(),t=o,a=el(),i=ol().pathExists;return jp={outputFile:e((function(e,o,r,s){"function"==typeof r&&(s=r,r="utf8");const c=t.dirname(e);i(c,((t,i)=>t?s(t):i?n.writeFile(e,o,r,s):void a.mkdirs(c,(t=>{if(t)return s(t);n.writeFile(e,o,r,s)}))))})),outputFileSync:function(e,...i){const o=t.dirname(e);if(n.existsSync(o))return n.writeFileSync(e,...i);a.mkdirsSync(o),n.writeFileSync(e,...i)}},jp}(),ol(),pl());const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Hp)),Hp.exports}function bl(){if(Tp)return Fp;Tp=1;const e=Ss()("streamroller:fileNameFormatter"),n=o;return Fp=({file:t,keepFileExt:a,needsIndex:i,alwaysIncludeDate:o,compress:r,fileNameSep:s})=>{let c=s||".";const p=n.join(t.dir,t.name),l=e=>e+t.ext,u=(e,n,t)=>!i&&t||!n?e:e+c+n,d=(e,n,t)=>(n>0||o)&&t?e+c+t:e,f=(e,n)=>n&&r?e+".gz":e,m=a?[d,u,l,f]:[l,d,u,f];return({date:n,index:t})=>(e(`_formatFileName: date=${n}, index=${t}`),m.reduce(((e,a)=>a(e,t,n)),p))},Fp}function yl(){if(Np)return Pp;Np=1;const e=Ss()("streamroller:fileNameParser"),n=Ts();return Pp=({file:t,keepFileExt:a,pattern:i,fileNameSep:o})=>{let r=o||".";const s="__NOT_MATCHING__";let c=[(n,t)=>n.endsWith(".gz")?(e("it is gzipped"),t.isCompressed=!0,n.slice(0,-3)):n,a?n=>n.startsWith(t.name)&&n.endsWith(t.ext)?(e("it starts and ends with the right things"),n.slice(t.name.length+1,-1*t.ext.length)):s:n=>n.startsWith(t.base)?(e("it starts with the right things"),n.slice(t.base.length+1)):s,i?(t,a)=>{const o=t.split(r);let s=o[o.length-1];e("items: ",o,", indexStr: ",s);let c=t;void 0!==s&&s.match(/^\d+$/)?(c=t.slice(0,-1*(s.length+1)),e(`dateStr is ${c}`),i&&!c&&(c=s,s="0")):s="0";try{const e=n.parse(i,c,new Date(0,0));return n.asString(i,e)!==c?t:(a.index=parseInt(s,10),a.date=c,a.timestamp=e.getTime(),"")}catch(n){return e(`Problem parsing ${c} as ${i}, error was: `,n),t}}:(n,t)=>n.match(/^\d+$/)?(e("it has an index"),t.index=parseInt(n,10),""):n];return e=>{let n={filename:e,index:0,isCompressed:!1};return c.reduce(((e,t)=>t(e,n)),e)?null:n}},Pp}function gl(){if(Lp)return Ip;Lp=1;const e=Ss()("streamroller:moveAndMaybeCompressFile"),n=xl(),t=f;return Ip=async(a,i,o)=>{if(o=function(n){const t={mode:parseInt("0600",8),compress:!1},a=Object.assign({},t,n);return e(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(a)}`),a}(o),a!==i){if(await n.pathExists(a))if(e(`moveAndMaybeCompressFile: moving file from ${a} to ${i} ${o.compress?"with":"without"} compress`),o.compress)await new Promise(((r,s)=>{let c=!1;const p=n.createWriteStream(i,{mode:o.mode,flags:"wx"}).on("open",(()=>{c=!0;const i=n.createReadStream(a).on("open",(()=>{i.pipe(t.createGzip()).pipe(p)})).on("error",(n=>{e(`moveAndMaybeCompressFile: error reading ${a}`,n),p.destroy(n)}))})).on("finish",(()=>{e(`moveAndMaybeCompressFile: finished compressing ${i}, deleting ${a}`),n.unlink(a).then(r).catch((t=>{e(`moveAndMaybeCompressFile: error deleting ${a}, truncating instead`,t),n.truncate(a).then(r).catch((n=>{e(`moveAndMaybeCompressFile: error truncating ${a}`,n),s(n)}))}))})).on("error",(t=>{c?(e(`moveAndMaybeCompressFile: error writing ${i}, deleting`,t),n.unlink(i).then((()=>{s(t)})).catch((n=>{e(`moveAndMaybeCompressFile: error deleting ${i}`,n),s(n)}))):(e(`moveAndMaybeCompressFile: error creating ${i}`,t),s(t))}))})).catch((()=>{}));else{e(`moveAndMaybeCompressFile: renaming ${a} to ${i}`);try{await n.move(a,i,{overwrite:!0})}catch(t){if(e(`moveAndMaybeCompressFile: error renaming ${a} to ${i}`,t),"ENOENT"!==t.code){e("moveAndMaybeCompressFile: trying copy+truncate instead");try{await n.copy(a,i,{overwrite:!0}),await n.truncate(a)}catch(n){e("moveAndMaybeCompressFile: error copy+truncate",n)}}}}}else e("moveAndMaybeCompressFile: source and target are the same, not doing anything")},Ip}function wl(){if(Dp)return Mp;Dp=1;const e=Ss()("streamroller:RollingFileWriteStream"),n=xl(),t=o,a=h,i=Ap?_p:(Ap=1,_p=()=>new Date),r=Ts(),{Writable:s}=d,c=bl(),p=yl(),l=gl();return Mp=class extends s{constructor(n,o){if(e(`constructor: creating RollingFileWriteStream. path=${n}`),"string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(t.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${t.sep}`)&&(n=n.replace("~",a.homedir())),super(o),this.options=this._parseOption(o),this.fileObject=t.parse(n),""===this.fileObject.dir&&(this.fileObject=t.parse(t.join(process.cwd(),n))),this.fileFormatter=c({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize<Number.MAX_SAFE_INTEGER,compress:this.options.compress,keepFileExt:this.options.keepFileExt,fileNameSep:this.options.fileNameSep}),this.fileNameParser=p({file:this.fileObject,keepFileExt:this.options.keepFileExt,pattern:this.options.pattern,fileNameSep:this.options.fileNameSep}),this.state={currentSize:0},this.options.pattern&&(this.state.currentDate=r(this.options.pattern,i())),this.filename=this.fileFormatter({index:0,date:this.state.currentDate}),["a","a+","as","as+"].includes(this.options.flags)&&this._setExistingSizeAndDate(),e(`constructor: create new file ${this.filename}, state=${JSON.stringify(this.state)}`),this._renewWriteStream()}_setExistingSizeAndDate(){try{const e=n.statSync(this.filename);this.state.currentSize=e.size,this.options.pattern&&(this.state.currentDate=r(this.options.pattern,e.mtime))}catch(e){return}}_parseOption(n){const t={maxSize:0,numToKeep:Number.MAX_SAFE_INTEGER,encoding:"utf8",mode:parseInt("0600",8),flags:"a",compress:!1,keepFileExt:!1,alwaysIncludePattern:!1},a=Object.assign({},t,n);if(a.maxSize){if(a.maxSize<=0)throw new Error(`options.maxSize (${a.maxSize}) should be > 0`)}else delete a.maxSize;if(a.numBackups||0===a.numBackups){if(a.numBackups<0)throw new Error(`options.numBackups (${a.numBackups}) should be >= 0`);if(a.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${a.numBackups}) should be < Number.MAX_SAFE_INTEGER`);a.numToKeep=a.numBackups+1}else if(a.numToKeep<=0)throw new Error(`options.numToKeep (${a.numToKeep}) should be > 0`);return e(`_parseOption: creating stream with option=${JSON.stringify(a)}`),a}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(n,t,a){this._shouldRoll().then((()=>{e(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${n}`),this.currentFileStream.write(n,t,(e=>{this.state.currentSize+=n.length,a(e)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(e(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==r(this.options.pattern,i())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return e("_roll: closing the current stream"),new Promise(((e,n)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(n)}))}))}async _moveOldFiles(){const n=await this._getExistingFiles();for(let t=(this.state.currentDate?n.filter((e=>e.date===this.state.currentDate)):n).length;t>=0;t--){e(`_moveOldFiles: i = ${t}`);const n=this.fileFormatter({date:this.state.currentDate,index:t}),a=this.fileFormatter({date:this.state.currentDate,index:t+1}),i={compress:this.options.compress&&0===t,mode:this.options.mode};await l(n,a,i)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?r(this.options.pattern,i()):null,e(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,n)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(n)}))}))}async _getExistingFiles(){const t=await n.readdir(this.fileObject.dir).catch((()=>[]));e(`_getExistingFiles: files=${t}`);const a=t.map((e=>this.fileNameParser(e))).filter((e=>e)),o=e=>(e.timestamp?e.timestamp:i().getTime())-e.index;return a.sort(((e,n)=>o(e)-o(n))),a}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),a=e=>{try{return n.mkdirSync(e,{recursive:!0})}catch(i){if("ENOENT"===i.code)return a(t.dirname(e)),a(e);if("EEXIST"!==i.code&&"EROFS"!==i.code)throw i;try{if(n.statSync(e).isDirectory())return e;throw i}catch(e){throw i}}};a(this.fileObject.dir);const i={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var o,r;n.appendFileSync(e,"",(o={...i},r="flags",o["flag"]=o[r],delete o[r],o)),this.currentFileStream=n.createWriteStream(e,i),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const a=await this._getExistingFiles();if(e(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${a.length}`),e("_clean: existing files are: ",a),this._tooManyFiles(a.length)){const o=a.slice(0,a.length-this.options.numToKeep).map((e=>t.format({dir:this.fileObject.dir,base:e.filename})));await(i=o,e(`deleteFiles: files to delete: ${i}`),Promise.all(i.map((t=>n.unlink(t).catch((n=>{e(`deleteFiles: error when unlinking ${t}, ignoring. Error was ${n}`)}))))))}var i}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}},Mp}function Sl(){if(qp)return Bp;qp=1;const e=wl();return Bp=class extends e{constructor(e,n,t,a){a||(a={}),n&&(a.maxSize=n),a.numBackups||0===a.numBackups||(t||0===t||(t=1),a.numBackups=t),super(e,a),this.backups=a.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}}}function kl(){if(zp)return Rp;zp=1;const e=wl();return Rp=class extends e{constructor(e,n,t){n&&"object"==typeof n&&(t=n,n=null),t||(t={}),n||(n="yyyy-MM-dd"),t.pattern=n,t.numBackups||0===t.numBackups?t.daysToKeep=t.numBackups:(t.daysToKeep||0===t.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):t.daysToKeep=1,t.numBackups=t.daysToKeep),super(e,t),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}}function El(){return Up?$p:(Up=1,$p={RollingFileWriteStream:wl(),RollingFileStream:Sl(),DateRollingFileStream:kl()})}function jl(){if(Wp)return Gp;Wp=1;const e=Ss()("log4js:file"),n=o,t=El(),a=h,i=a.EOL;let r=!1;const s=new Set;function c(){s.forEach((e=>{e.sighupHandler()}))}return Gp.configure=function(o,p){let l=p.basicLayout;return o.layout&&(l=p.layout(o.layout.type,o.layout)),o.mode=o.mode||384,function(o,p,l,u,d,f){if("string"!=typeof o||0===o.length)throw new Error(`Invalid filename: ${o}`);if(o.endsWith(n.sep))throw new Error(`Filename is a directory: ${o}`);function m(e,n,a,i){const o=new t.RollingFileStream(e,n,a,i);return o.on("error",(n=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,n)})),o.on("drain",(()=>{process.emit("log4js:pause",!1)})),o}0===o.indexOf(`~${n.sep}`)&&(o=o.replace("~",a.homedir())),o=n.normalize(o),e("Creating file appender (",o,", ",l,", ",u=u||0===u?u:5,", ",d,", ",f,")");let h=m(o,l,u,d);const v=function(e){if(h.writable){if(!0===d.removeColor){const n=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(n,""):e))}h.write(p(e,f)+i,"utf8")||process.emit("log4js:pause",!0)}};return v.reopen=function(){h.end((()=>{h=m(o,l,u,d)}))},v.sighupHandler=function(){e("SIGHUP handler called."),v.reopen()},v.shutdown=function(e){s.delete(v),0===s.size&&r&&(process.removeListener("SIGHUP",c),r=!1),h.end("","utf-8",e)},s.add(v),r||(process.on("SIGHUP",c),r=!0),v}(o.filename,l,o.maxLogSize,o.backups,o,o.timezoneOffset)},Gp}var Ol,Cl={};function _l(){if(Ol)return Cl;Ol=1;const e=El(),n=h.EOL;function t(t,a,i,o,r){o.maxSize=o.maxLogSize;const s=function(n,t,a){const i=new e.DateRollingFileStream(n,t,a);return i.on("error",(e=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",n,e)})),i.on("drain",(()=>{process.emit("log4js:pause",!1)})),i}(t,a,o),c=function(e){s.writable&&(s.write(i(e,r)+n,"utf8")||process.emit("log4js:pause",!0))};return c.shutdown=function(e){s.end("","utf-8",e)},c}return Cl.configure=function(e,n){let a=n.basicLayout;return e.layout&&(a=n.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,t(e.filename,e.pattern,a,e,e.timezoneOffset)},Cl}var Al,Fl={};function Tl(){if(Al)return Fl;Al=1;const e=Ss()("log4js:fileSync"),t=o,a=n,i=h,r=i.EOL;function s(e,n){const i=e=>{try{return a.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return i(t.dirname(e)),i(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(a.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};i(t.dirname(e)),a.appendFileSync(e,"",{mode:n.mode,flag:n.flags})}class c{constructor(n,t,i,o){if(e("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=n,this.size=t,this.backups=i,this.options=o,this.currentSize=0,this.currentSize=function(e){let n=0;try{n=a.statSync(e).size}catch(n){s(e,o)}return n}(this.filename)}shouldRoll(){return e("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(n){const i=this,o=new RegExp(`^${t.basename(n)}`);function r(e){return o.test(e)}function s(e){return parseInt(e.slice(`${t.basename(n)}.`.length),10)||0}function c(e,n){return s(e)-s(n)}function p(o){const r=s(o);if(e(`Index of ${o} is ${r}`),0===i.backups)a.truncateSync(n,0);else if(r<i.backups){try{a.unlinkSync(`${n}.${r+1}`)}catch(e){}e(`Renaming ${o} -> ${n}.${r+1}`),a.renameSync(t.join(t.dirname(n),o),`${n}.${r+1}`)}}e("Rolling, rolling, rolling"),e("Renaming the old files"),a.readdirSync(t.dirname(n)).filter(r).sort(c).reverse().forEach(p)}write(n,t){const i=this;e("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),e("writing the chunk to the file"),i.currentSize+=n.length,a.appendFileSync(i.filename,n)}}return Fl.configure=function(n,o){let p=o.basicLayout;n.layout&&(p=o.layout(n.layout.type,n.layout));const l={flags:n.flags||"a",encoding:n.encoding||"utf8",mode:n.mode||384};return function(n,o,p,l,u,d){if("string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(t.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${t.sep}`)&&(n=n.replace("~",i.homedir())),n=t.normalize(n),e("Creating fileSync appender (",n,", ",p,", ",l=l||0===l?l:5,", ",u,", ",d,")");const f=function(e,n,t){let i;var o;return n?i=new c(e,n,t,u):(s(o=e,u),i={write(e){a.appendFileSync(o,e)}}),i}(n,p,l);return e=>{f.write(o(e,d)+r)}}(n.filename,p,n.maxLogSize,n.backups,l,n.timezoneOffset)},Fl}var Pl,Nl,Il={};function Ll(){if(Pl)return Il;Pl=1;const e=Ss()("log4js:tcp"),n=v;return Il.configure=function(t,a){e(`configure with config = ${t}`);let i=function(e){return e.serialise()};return t.layout&&(i=a.layout(t.layout.type,t.layout)),function(t,a){let i=!1;const o=[];let r,s=3,c="__LOG4JS__";function p(n){e("Writing log event to socket"),i=r.write(`${a(n)}${c}`,"utf8")}function l(){let n;for(e("emptying buffer");n=o.shift();)p(n)}function u(n){i?p(n):(e("buffering log event because it cannot write at the moment"),o.push(n))}return function a(){e(`appender creating socket to ${t.host||"localhost"}:${t.port||5e3}`),c=`${t.endMsg||"__LOG4JS__"}`,r=n.createConnection(t.port||5e3,t.host||"localhost"),r.on("connect",(()=>{e("socket connected"),l(),i=!0})),r.on("drain",(()=>{e("drain event received, emptying buffer"),i=!0,l()})),r.on("timeout",r.end.bind(r)),r.on("error",(n=>{e("connection error",n),i=!1,l()})),r.on("close",a)}(),u.shutdown=function(n){e("shutdown called"),o.length&&s?(e("buffer has items, waiting 100ms to empty"),s-=1,setTimeout((()=>{u.shutdown(n)}),100)):(r.removeAllListeners("close"),r.end(n))},u}(t,i)},Il}function Ml(){if(Nl)return qs.exports;Nl=1;const e=o,n=Ss()("log4js:appenders"),t=Es(),a=$s(),i=Ns(),r=Ps(),s=Gs(),c=new Map;c.set("console",Ks()),c.set("stdout",Qs()),c.set("stderr",ec()),c.set("logLevelFilter",(nc||(nc=1,tc.configure=function(e,n,t,a){const i=t(e.appender);return function(e,n,t,a){const i=a.getLevel(e),o=a.getLevel(n,a.FATAL);return e=>{const n=e.level;i.isLessThanOrEqualTo(n)&&o.isGreaterThanOrEqualTo(n)&&t(e)}}(e.level,e.maxLevel,i,a)}),tc)),c.set("categoryFilter",oc()),c.set("noLogFilter",cc()),c.set("file",jl()),c.set("dateFile",_l()),c.set("fileSync",Tl()),c.set("tcp",Ll());const p=new Map,l=(e,a)=>{let i;try{const t=`${e}.cjs`;i=require.resolve(t),n("Loading module from ",t)}catch(t){i=e,n("Loading module from ",e)}try{return function(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(i)}catch(n){return void t.throwExceptionIf(a,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},u=new Set,d=(e,t)=>{if(p.has(e))return p.get(e);if(!t.appenders[e])return!1;if(u.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);u.add(e),n(`Creating appender ${e}`);const a=f(e,t);return u.delete(e),p.set(e,a),a},f=(o,p)=>{const u=p.appenders[o],f=u.type.configure?u.type:((n,t)=>c.get(n)||l(`./${n}`,t)||l(n,t)||require.main&&require.main.filename&&l(e.join(e.dirname(require.main.filename),n),t)||l(e.join(process.cwd(),n),t))(u.type,p);return t.throwExceptionIf(p,t.not(f),`appender "${o}" is not valid (type "${u.type}" could not be found)`),f.appender&&(process.emitWarning(`Appender ${u.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),n("[log4js-node-DEP0001]",`DEPRECATION: Appender ${u.type} exports an appender function.`)),f.shutdown&&(process.emitWarning(`Appender ${u.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),n("[log4js-node-DEP0002]",`DEPRECATION: Appender ${u.type} exports a shutdown function.`)),n(`${o}: clustering.isMaster ? ${a.isMaster()}`),n(`${o}: appenderModule is ${m.inspect(f)}`),a.onlyOnMaster((()=>(n(`calling appenderModule.configure for ${o} / ${u.type}`),f.configure(s.modifyConfig(u),r,(e=>d(e,p)),i))),(()=>{}))},h=e=>{if(p.clear(),u.clear(),!e)return;const n=[];Object.values(e.categories).forEach((e=>{n.push(...e.appenders)})),Object.keys(e.appenders).forEach((t=>{(n.includes(t)||"tcp-server"===e.appenders[t].type||"multiprocess"===e.appenders[t].type)&&d(t,e)}))},v=()=>{h()};return v(),t.addListener((e=>{t.throwExceptionIf(e,t.not(t.anObject(e.appenders)),'must have a property "appenders" of type object.');const n=Object.keys(e.appenders);t.throwExceptionIf(e,t.not(n.length),"must define at least one appender."),n.forEach((n=>{t.throwExceptionIf(e,t.not(e.appenders[n].type),`appender "${n}" is not valid (must be an object with property "type")`)}))})),t.addListener(h),qs.exports=p,qs.exports.init=v,qs.exports}var Dl,Bl,ql,Rl,zl,$l,Ul,Wl,Gl,Hl={exports:{}};function Jl(){return Dl||(Dl=1,function(e){const n=Ss()("log4js:categories"),t=Es(),a=Ns(),i=Ml(),o=new Map;function r(e,n,t){if(!1===n.inherit)return;const a=t.lastIndexOf(".");if(a<0)return;const i=t.slice(0,a);let o=e.categories[i];o||(o={inherit:!0,appenders:[]}),r(e,o,i),!e.categories[i]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[i]=o),n.appenders=n.appenders||[],n.level=n.level||o.level,o.appenders.forEach((e=>{n.appenders.includes(e)||n.appenders.push(e)})),n.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((n=>{const t=e.categories[n];r(e,t,n)}))}t.addPreProcessingListener((e=>s(e))),t.addListener((e=>{t.throwExceptionIf(e,t.not(t.anObject(e.categories)),'must have a property "categories" of type object.');const n=Object.keys(e.categories);t.throwExceptionIf(e,t.not(n.length),"must define at least one category."),n.forEach((n=>{const o=e.categories[n];t.throwExceptionIf(e,[t.not(o.appenders),t.not(o.level)],`category "${n}" is not valid (must be an object with properties "appenders" and "level")`),t.throwExceptionIf(e,t.not(Array.isArray(o.appenders)),`category "${n}" is not valid (appenders must be an array of appender names)`),t.throwExceptionIf(e,t.not(o.appenders.length),`category "${n}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&t.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${n}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((a=>{t.throwExceptionIf(e,t.not(i.get(a)),`category "${n}" is not valid (appender "${a}" is not defined)`)})),t.throwExceptionIf(e,t.not(a.getLevel(o.level)),`category "${n}" is not valid (level "${o.level}" not recognised; valid levels are ${a.levels.join(", ")})`)})),t.throwExceptionIf(e,t.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((t=>{const r=e.categories[t],s=[];r.appenders.forEach((e=>{s.push(i.get(e)),n(`Creating category ${t}`),o.set(t,{appenders:s,level:a.getLevel(r.level),enableCallStack:r.enableCallStack||!1})}))}))},p=()=>{c()};p(),t.addListener(c);const l=e=>{if(n(`configForCategory: searching for config for ${e}`),o.has(e))return n(`configForCategory: ${e} exists in config, returning it`),o.get(e);let t;return e.indexOf(".")>0?(n(`configForCategory: ${e} has hierarchy, cloning from parents`),t={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),n("configForCategory: cloning default category"),t={...o.get("default")}),o.set(e,t),t};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{l(e).level=n},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,n)=>{l(e).enableCallStack=n},init:p})}(Hl)),Hl.exports}function Kl(){if(zl)return Rl;zl=1;const e=Ns();function n(e){return e.originalUrl||e.url}function t(e,n){for(let t=0;t<n.length;t++)e=e.replace(n[t].token,n[t].replacement);return e}return Rl=function(a,i){i="string"==typeof i||"function"==typeof i?{format:i}:i||{};const o=a;let r=e.getLevel(i.level,e.INFO);const s=i.format||':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"';return(a,c,p)=>{if(void 0!==a._logging)return p();if("function"!=typeof i.nolog){const e=function(e){let n=null;if(e instanceof RegExp&&(n=e),"string"==typeof e&&(n=new RegExp(e)),Array.isArray(e)){const t=e.map((e=>e.source?e.source:e));n=new RegExp(t.join("|"))}return n}(i.nolog);if(e&&e.test(a.originalUrl))return p()}if(o.isLevelEnabled(r)||"auto"===i.level){const p=new Date,{writeHead:l}=c;a._logging=!0,c.writeHead=(e,n)=>{c.writeHead=l,c.writeHead(e,n),c.__statusCode=e,c.__headers=n||{}};let u=!1;const d=()=>{if(u)return;if(u=!0,"function"==typeof i.nolog&&!0===i.nolog(a,c))return void(a._logging=!1);c.responseTime=new Date-p,c.statusCode&&"auto"===i.level&&(r=e.INFO,c.statusCode>=300&&(r=e.WARN),c.statusCode>=400&&(r=e.ERROR)),r=function(n,t,a){let i=t;if(a){const t=a.find((e=>{let t=!1;return t=e.from&&e.to?n>=e.from&&n<=e.to:-1!==e.codes.indexOf(n),t}));t&&(i=e.getLevel(t.level,i))}return i}(c.statusCode,r,i.statusRules);const l=function(e,t,a){const i=[];return i.push({token:":url",replacement:n(e)}),i.push({token:":protocol",replacement:e.protocol}),i.push({token:":hostname",replacement:e.hostname}),i.push({token:":method",replacement:e.method}),i.push({token:":status",replacement:t.__statusCode||t.statusCode}),i.push({token:":response-time",replacement:t.responseTime}),i.push({token:":date",replacement:(new Date).toUTCString()}),i.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),i.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),i.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),i.push({token:":user-agent",replacement:e.headers["user-agent"]}),i.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),i.push({token:/:req\[([^\]]+)]/g,replacement:(n,t)=>e.headers[t.toLowerCase()]}),i.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const n=e.concat();for(let e=0;e<n.length;++e)for(let t=e+1;t<n.length;++t)n[e].token==n[t].token&&n.splice(t--,1);return n})(a.concat(i))}(a,c,i.tokens||[]);if(i.context&&o.addContext("res",c),"function"==typeof s){const e=s(a,c,(e=>t(e,l)));e&&o.log(r,e)}else o.log(r,t(s,l));i.context&&o.removeContext("res")};c.on("end",d),c.on("finish",d),c.on("error",d),c.on("close",d)}return p()}}}function Vl(){if(Ul)return $l;Ul=1;const e=Ss()("log4js:recording"),n=[];function t(){return n.slice()}function a(){n.length=0}return $l={configure:function(){return function(t){e(`received logEvent, number of events now ${n.length+1}`),e("log event was ",t),n.push(t)}},replay:t,playback:t,reset:a,erase:a}}var Zl=function(){if(Gl)return Wl;Gl=1;const e=Ss()("log4js:main"),t=n,a=ks()({proto:!0}),i=Es(),o=Ps(),r=Ns(),s=Ml(),c=Jl(),p=function(){if(ql)return Bl;ql=1;const e=Ss()("log4js:logger"),n=zs(),t=Ns(),a=$s(),i=Jl(),o=Es(),r=/^(?:\s*)at (?:(.+) \()?(?:([^(]+?):(\d+):(\d+))\)?$/;function s(e,n=4){try{const t=e.stack.split("\n").slice(n);if(!t.length)return null;const a=r.exec(t[0]);if(a&&5===a.length){let e="",n="",i="";return a[1]&&""!==a[1]&&([n,i]=a[1].replace(/[[\]]/g,"").split(" as "),i=i||"",n.includes(".")&&([e,n]=n.split("."))),{fileName:a[2],lineNumber:parseInt(a[3],10),columnNumber:parseInt(a[4],10),callStack:t.join("\n"),className:e,functionName:n,functionAlias:i,callerName:a[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}class c{constructor(n){if(!n)throw new Error("No category provided.");this.category=n,this.context={},this.callStackSkipIndex=0,this.parseCallStack=s,e(`Logger created (${this.category}, ${this.level})`)}get level(){return t.getLevel(i.getLevelForCategory(this.category),t.OFF)}set level(e){i.setLevelForCategory(this.category,t.getLevel(e,this.level))}get useCallStack(){return i.getEnableCallStackForCategory(this.category)}set useCallStack(e){i.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...n){const a=t.getLevel(e);a?this.isLevelEnabled(a)&&this._log(a,n):o.validIdentifier(e)&&n.length>0?(this.log(t.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(t.INFO,`[${e}]`,...n)):this.log(t.INFO,e,...n)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(t,i){e(`sending log data (${t}) to appenders`);const o=i.find((e=>e instanceof Error));let r;if(this.useCallStack){try{o&&(r=this.parseCallStack(o,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const s=new n(this.category,t,i,this.context,r,o);a.send(s)}addContext(e,n){this.context[e]=n}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=s}}}function p(e){const n=t.getLevel(e),a=n.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),i=a[0].toUpperCase()+a.slice(1);c.prototype[`is${i}Enabled`]=function(){return this.isLevelEnabled(n)},c.prototype[a]=function(...e){this.log(n,...e)}}return t.levels.forEach(p),o.addListener((()=>{t.levels.forEach(p)})),Bl=c}(),l=$s(),u=Kl(),d=Vl();let f=!1;function m(n){if(!f)return;e("Received log event ",n);c.appendersForCategory(n.categoryName).forEach((e=>{e(n)}))}function h(n){f&&v();let o=n;return"string"==typeof o&&(o=function(n){e(`Loading configuration from ${n}`);try{return JSON.parse(t.readFileSync(n,"utf8"))}catch(e){throw new Error(`Problem reading config from file "${n}". Error was ${e.message}`,e)}}(n)),e(`Configuration is ${o}`),i.configure(a(o)),l.onMessage(m),f=!0,x}function v(n=()=>{}){if("function"!=typeof n)throw new TypeError("Invalid callback passed to shutdown");e("Shutdown called. Disabling all log writing."),f=!1;const t=Array.from(s.values());s.init(),c.init();const a=t.reduce(((e,n)=>n.shutdown?e+1:e),0);0===a&&(e("No appenders with shutdown functions found."),n());let i,o=0;function r(t){i=i||t,o+=1,e(`Appender shutdowns complete: ${o} / ${a}`),o>=a&&(e("All shutdown functions completed."),n(i))}e(`Found ${a} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(r)))}const x={getLogger:function(e){return f||h(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new p(e||"default")},configure:h,isConfigured:function(){return f},shutdown:v,connectLogger:u,levels:r,addLayout:o.addLayout,recording:function(){return d}};return Wl=x}(),Ql=J(Zl);var Yl=function(e){var n=Object.prototype.hasOwnProperty;function t(e,a){return Array.isArray(e)?function(e,n){for(var a,i="",o="",s=Array.isArray(n),c=0;c<e.length;c++)(a=t(e[c]))&&(s&&n[c]&&(a=r(a)),i=i+o+a,o=" ");return i}(e,a):e&&"object"==typeof e?function(e){var t="",a="";for(var i in e)i&&e[i]&&n.call(e,i)&&(t=t+a+i,a=" ");return t}(e):e||""}function a(e){if(!e)return"";if("object"==typeof e){var t="";for(var a in e)n.call(e,a)&&(t=t+a+":"+e[a]+";");return t}return e+""}function i(e,n,t,a){return!1!==n&&null!=n&&(n||"class"!==e&&"style"!==e)?!0===n?" "+(a?e:e+'="'+e+'"'):("function"==typeof n.toJSON&&(n=n.toJSON()),"string"==typeof n||(n=JSON.stringify(n),t||-1===n.indexOf('"'))?(t&&(n=r(n))," "+e+'="'+n+'"'):" "+e+"='"+n.replace(/'/g,"&#39;")+"'"):""}e.merge=function e(n,t){if(1===arguments.length){for(var i=n[0],o=1;o<n.length;o++)i=e(i,n[o]);return i}for(var r in t)if("class"===r){var s=n[r]||[];n[r]=(Array.isArray(s)?s:[s]).concat(t[r]||[])}else if("style"===r){s=(s=a(n[r]))&&";"!==s[s.length-1]?s+";":s;var c=a(t[r]);c=c&&";"!==c[c.length-1]?c+";":c,n[r]=s+c}else n[r]=t[r];return n},e.classes=t,e.style=a,e.attr=i,e.attrs=function(e,o){var r="";for(var s in e)if(n.call(e,s)){var c=e[s];if("class"===s){r=i(s,c=t(c),!1,o)+r;continue}"style"===s&&(c=a(c)),r+=i(s,c,!1,o)}return r};var o=/["&<>]/;function r(e){var n=""+e,t=o.exec(n);if(!t)return e;var a,i,r,s="";for(a=t.index,i=0;a<n.length;a++){switch(n.charCodeAt(a)){case 34:r="&quot;";break;case 38:r="&amp;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}i!==a&&(s+=n.substring(i,a)),i=a+1,s+=r}return i!==a?s+n.substring(i,a):s}return e.escape=r,e.rethrow=function e(n,t,a,i){if(!(n instanceof Error))throw n;if(!("undefined"==typeof window&&t||i))throw n.message+=" on line "+a,n;try{i=i||require("fs").readFileSync(t,"utf8")}catch(t){e(n,null,a)}var o=3,r=i.split("\n"),s=Math.max(a-o,0),c=Math.min(r.length,a+o);o=r.slice(s,c).map((function(e,n){var t=n+s+1;return(t==a?" > ":" ")+t+"| "+e})).join("\n");throw n.path=t,n.message=(t||"Pug")+":"+a+"\n"+o+"\n\n"+n.message,n},e}({});function Xl(e){var n,t,a="";try{var i={},o=e||{};(function(e,t){a+="<!DOCTYPE html>",a+="\n<html>",a+="\n <head>",a+="\n <title>",a+="API Documentation</title>",a+="\n <style>\n ",a+="body { font-family: Arial, sans-serif; margin: 20px; }",a+="\n ",a+="",a+="\n ",a+="h1 { color: #333; text-align: center; }",a+="\n ",a+="h2 { color: #333333 }",a+="\n ",a+="h3 { cursor: pointer; transition: color 0.3s; }",a+="\n ",a+="h3 { color: #007BFF; }",a+="\n ",a+="h3:hover { color: #0056b3; }",a+="\n ",a+="",a+="\n ",a+=".api-section { ",a+="\n ",a+=" margin: 20px 0; ",a+="\n ",a+=" border: 1px solid #e0e0e0; ",a+="\n ",a+=" border-radius: 8px; ",a+="\n ",a+=" padding: 10px; ",a+="\n ",a+=" background-color: #f9f9f9; ",a+="\n ",a+=" box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1); ",a+="\n ",a+="}",a+="\n ",a+="",a+="\n ",a+=".api-method { font-weight: bold; color: #333; }",a+="\n ",a+=".api-path { font-style: italic; color: #555; }",a+="\n ",a+="",a+="\n ",a+="pre { ",a+="\n ",a+=" background: #f4f4f4; ",a+="\n ",a+=" padding: 10px; ",a+="\n ",a+=" border-radius: 5px; ",a+="\n ",a+=" overflow-x: auto; ",a+="\n ",a+="}",a+="\n ",a+="",a+="\n ",a+=".collapse { display: none; }",a+="\n ",a+="\n </style>\n </head>",a+="\n <body>",a+="\n <h1>",a+="API Documentation</h1>",a+="\n \x3c!-- 添加 JavaScript 用于折叠 Sections--\x3e",a+="\n <script>\n ",a+="document.addEventListener('DOMContentLoaded', function() {",a+="\n ",a+=" const headings = document.querySelectorAll('.toggle');",a+="\n ",a+=" headings.forEach(heading => {",a+="\n ",a+=" heading.addEventListener('click', function() {",a+="\n ",a+=" // 找到 h3 后面的 collapse 元素",a+="\n ",a+=" let content = heading.nextElementSibling;",a+="\n ",a+=" if(!(content && content.classList.contains('collapse'))) {",a+="\n ",a+=" content = content.nextElementSibling;",a+="\n ",a+=" }",a+="\n ",a+=" if (content && content.classList.contains('collapse')) {",a+="\n ",a+=' content.style.display = (content.style.display === "block") ? "none" : "block";',a+="\n ",a+=" }",a+="\n ",a+=" });",a+="\n ",a+=" });",a+="\n ",a+="});",a+="\n ",a+="\n <\/script>",function(){var i=t;if("number"==typeof i.length)for(var o=0,r=i.length;o<r;o++){var s=i[o];a=(a+="\n <h2>")+Yl.escape(null==(n=s[0])?"":n)+"</h2>",function(){var t=s[1];if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Yl.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Yl.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}else{o=0;for(var i in t){o++;r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Yl.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Yl.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}}}.call(this)}else{r=0;for(var o in i){r++;s=i[o];a=(a+="\n <h2>")+Yl.escape(null==(n=s[0])?"":n)+"</h2>",function(){var t=s[1];if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Yl.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Yl.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}else{o=0;for(var i in t){o++;r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Yl.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Yl.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}}}.call(this)}}}.call(this),a+="\n </body>\n</html>"}).call(this,"JSON"in o?o.JSON:"undefined"!=typeof JSON?JSON:void 0,"apiData"in o?o.apiData:"undefined"!=typeof apiData?apiData:void 0)}catch(e){Yl.rethrow(e,t,undefined,i[void 0])}return a}const eu={DOCUMENTATION_DIR:s(process.cwd(),"doc")},nu=(e,n)=>{const t=q(e.wholePath),a=t.prototype,i=Object.getOwnPropertyNames(a).filter((e=>"function"==typeof a[e]&&"constructor"!==e)),o=e.path.substring(e.path.indexOf("doc")+3),r=i.map((e=>{if("function"==typeof a[e]){const n=a[e]();return n.path=o+n.path,n}return null})).filter((e=>!!e));let s="";if(r[0]?.path){const e=r[0].path.lastIndexOf("/");e>-1&&(s=r[0].path.substring(0,e))}return{configs:r,desc:t.desc,name:t.name,pathPrefix:n,apiPrePath:s}};(()=>{const e=process.env.NODE_ENV||"production",n=D();let a=r(n,"env");switch(function(e){try{return t(e).isDirectory()}catch(e){return e.code,!1}}(a)||(a=r(n,"..","env")),console.log("load env path: ",a),b.config({path:r(a,".common.env")}),e){case"development":b.config({path:r(a,".development.env")});break;case"test":b.config({path:r(a,".test.env")});break;case"production":b.config({path:r(a,".production.env")})}})();const tu=async e=>{const{koaInstance:n,authCheckCallback:t,catchErrorCallback:a,registerHighPriorityMiddleware:i,registerHook:o,log4:r=!1,runtimeLog:s=!0}=e,c=n||new p;var l;return c.context.log4=(e=>{if(!1!==e)return"boolean"==typeof e&&!0===e?Ql.configure({appenders:{console:{type:"console"},file:{type:"dateFile",filename:"logs/app.log",pattern:".yyyy-MM-dd",compress:!0,numBackups:7,alwaysIncludePattern:!0}},categories:{default:{appenders:["console","file"],level:"info"}}}):e(Ql)})(r),c.context.hook=o,c.context.runtimeLog=s,c.use((l=a,async(e,n)=>{try{await n()}catch(n){e.hook?.(e,"error"),l?l(n,e):L(500,{message:n.message})}})),c.use(U),i?.(c),c.use(W),e.corsMiddleware&&c.use(e.corsMiddleware),c.use(ji()),(e=>{const{controllerModule:n,validateModule:t}=B();console.log("load controller path: ",n),R(n,(n=>{if(!n.path.includes("controller"))return;const a=q(n.wholePath),i=a?.routesMap;i&&rs(t,n,i,((t,a)=>!t||e({filePath:n,ctx:a})))}))})(t),c.context.validated={params:{},get:{},post:{}},"development"!==process.env.NODE_ENV&&"true"!==process.env.DOC||G.get("/doc",(async e=>{const n=await(async()=>{const e=[],n=new Map;return R(eu.DOCUMENTATION_DIR,(n=>{const{pathPrefix:t}=z(n,"doc");e.push(nu(n,t))})),e.forEach((e=>{n.has(e.pathPrefix)||n.set(e.pathPrefix,[]),n.get(e.pathPrefix)?.push(e)})),Xl({apiData:Array.from(n.entries())})})();e.body=n})),G.get("/",(async e=>{e.body={code:200,message:"hello koa-ts-cli https://www.npmjs.com/package/koa-ts-core"}})),c.use(G.routes()),await(async e=>{const n=process.env.APP_PORT;if(n){const t=e.listen(Number(n));return void t.on("listening",(()=>os(t)))}const t=await as.getPortPromise({port:8e3,stopPort:9999});e.listen=(...n)=>{const a=0===n.length?is.apply(e,[t]):is.apply(e,n);return a.on("listening",(()=>os(a))),a}})(c),[c,G]};export{A as AuthRouter,M as BaseException,E as INDEX_ROUTE,_ as Router,F as contextStore,L as errorRsp,T as getCurrentContext,B as getSrcModulePaths,tu as initializeKoaApp,N as successRsp,I as unSuccessRsp};
39
+ */var Ei=function(){if(_a)return Ca;_a=1;const e=ki(),n=function(){if(Oa)return ja;Oa=1;var e=Array.prototype.slice;function n(e,t){if(!(this instanceof n))return new n(e,t);this.src=e,this._withAccess=t}function t(e,n){return void 0===e[n]&&void 0===e.__lookupGetter__(n)&&void 0===e.__lookupSetter__(n)}return ja=n,n.prototype.withAccess=function(e){return this._withAccess=!1!==e,this},n.prototype.pick=function(n){return Array.isArray(n)||(n=e.call(arguments)),n.length&&(this.keys=n),this},n.prototype.to=function(e){if(e=e||{},!this.src)return e;var n=this.keys||Object.keys(this.src);if(!this._withAccess){for(var a=0;a<n.length;a++)void 0===e[i=n[a]]&&(e[i]=this.src[i]);return e}for(a=0;a<n.length;a++){var i=n[a];if(t(e,i)){var o=this.src.__lookupGetter__(i),r=this.src.__lookupSetter__(i);o&&e.__defineGetter__(i,o),r&&e.__defineSetter__(i,r),o||r||(e[i]=this.src[i])}}return e},n.prototype.toCover=function(e){for(var n=this.keys||Object.keys(this.src),t=0;t<n.length;t++){var a=n[t];delete e[a];var i=this.src.__lookupGetter__(a),o=this.src.__lookupSetter__(a);i&&e.__defineGetter__(a,i),o&&e.__defineSetter__(a,o),i||o||(e[a]=this.src[a])}},n.prototype.override=n.prototype.toCover,n.prototype.and=function(e){var n={};return this.to(n),this.src=e,this.to(n),this.src=n,this},ja}(),t=se();function a(e,t){const a={};return n(e).to(a),a.limit=e[t+"Limit"],a}function i(e,n){n&&(Array.isArray(n)||(n=[n]),n.forEach((function(n){e.push(n)})))}function o(e,n){return e.includes(n)}return Ca=function(n){n=n||{};const{detectJSON:r}=n,{onerror:s}=n,c=n.enableTypes||["json","form"],p=o(c,"form"),l=o(c,"json"),u=o(c,"text"),d=o(c,"xml");n.detectJSON=void 0,n.onerror=void 0,n.returnRawBody=!0;const f=["application/json","application/json-patch+json","application/vnd.api+json","application/csp-report","application/scim+json"],m=["application/x-www-form-urlencoded"],h=["text/plain"],v=["text/xml","application/xml"],x=a(n,"json"),b=a(n,"form"),y=a(n,"text"),g=a(n,"xml"),w=n.extendTypes||{};return i(f,w.json),i(m,w.form),i(h,w.text),i(v,w.xml),async function(n,a){if(void 0!==n.request.body||n.disableBodyParser)return await a();try{const a=await async function(n){if(l&&(r&&r(n)||function(e,n){"string"==typeof e&&(e=e.replace(/;$/,""));return t.is(e,n)}(n.request.get("content-type"),f)))return await e.json(n,x);if(p&&n.request.is(m))return await e.form(n,b);if(u&&n.request.is(h))return await e.text(n,y)||"";if(d&&n.request.is(v))return await e.text(n,g)||"";return{}}(n);n.request.body="parsed"in a?a.parsed:{},void 0===n.request.rawBody&&(n.request.rawBody=a.raw)}catch(e){if(!s)throw e;s(e,n)}await a()}}}(),ji=J(Ei),Oi={};function Ci(e,...n){return(...t)=>e(...n,...t)}function _i(e){return function(...n){var t=n.pop();return e.call(this,n,t)}}var Ai="function"==typeof queueMicrotask&&queueMicrotask,Fi="function"==typeof setImmediate&&setImmediate,Ti="object"==typeof process&&"function"==typeof process.nextTick;function Pi(e){setTimeout(e,0)}function Ni(e){return(n,...t)=>e((()=>n(...t)))}var Ii=Ni(Ai?queueMicrotask:Fi?setImmediate:Ti?process.nextTick:Pi);function Li(e){return Bi(e)?function(...n){const t=n.pop();return Mi(e.apply(this,n),t)}:_i((function(n,t){var a;try{a=e.apply(this,n)}catch(e){return t(e)}if(a&&"function"==typeof a.then)return Mi(a,t);t(null,a)}))}function Mi(e,n){return e.then((e=>{Di(n,null,e)}),(e=>{Di(n,e&&(e instanceof Error||e.message)?e:new Error(e))}))}function Di(e,n,t){try{e(n,t)}catch(e){Ii((e=>{throw e}),e)}}function Bi(e){return"AsyncFunction"===e[Symbol.toStringTag]}function qi(e){if("function"!=typeof e)throw new Error("expected a function");return Bi(e)?Li(e):e}function Ri(e,n){if(n||(n=e.length),!n)throw new Error("arity is undefined");return function(...t){return"function"==typeof t[n-1]?e.apply(this,t):new Promise(((a,i)=>{t[n-1]=(e,...n)=>{if(e)return i(e);a(n.length>1?n:n[0])},e.apply(this,t)}))}}function zi(e){return function(n,...t){return Ri((function(a){var i=this;return e(n,((e,n)=>{qi(e).apply(i,t.concat(n))}),a)}))}}function $i(e,n,t,a){n=n||[];var i=[],o=0,r=qi(t);return e(n,((e,n,t)=>{var a=o++;r(e,((e,n)=>{i[a]=n,t(e)}))}),(e=>{a(e,i)}))}function Ui(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}const Wi={};function Gi(e){function n(...n){if(null!==e){var t=e;e=null,t.apply(this,n)}}return Object.assign(n,e),n}function Hi(e){if(Ui(e))return function(e){var n=-1,t=e.length;return function(){return++n<t?{value:e[n],key:n}:null}}(e);var n,t,a,i,o=function(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}(e);return o?function(e){var n=-1;return function(){var t=e.next();return t.done?null:(n++,{value:t.value,key:n})}}(o):(t=(n=e)?Object.keys(n):[],a=-1,i=t.length,function e(){var o=t[++a];return"__proto__"===o?e():a<i?{value:n[o],key:o}:null})}function Ji(e){return function(...n){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,n)}}function Ki(e,n,t,a){let i=!1,o=!1,r=!1,s=0,c=0;function p(){s>=n||r||i||(r=!0,e.next().then((({value:e,done:n})=>{if(!o&&!i){if(r=!1,n)return i=!0,void(s<=0&&a(null));s++,t(e,c,l),c++,p()}})).catch(u))}function l(e,n){if(s-=1,!o)return e?u(e):!1===e?(i=!0,void(o=!0)):n===Wi||i&&s<=0?(i=!0,a(null)):void p()}function u(e){o||(r=!1,i=!0,a(e))}p()}var Vi=e=>(n,t,a)=>{if(a=Gi(a),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!n)return a(null);if("AsyncGenerator"===n[Symbol.toStringTag])return Ki(n,e,t,a);if(function(e){return"function"==typeof e[Symbol.asyncIterator]}(n))return Ki(n[Symbol.asyncIterator](),e,t,a);var i=Hi(n),o=!1,r=!1,s=0,c=!1;function p(e,n){if(!r)if(s-=1,e)o=!0,a(e);else if(!1===e)o=!0,r=!0;else{if(n===Wi||o&&s<=0)return o=!0,a(null);c||l()}}function l(){for(c=!0;s<e&&!o;){var n=i();if(null===n)return o=!0,void(s<=0&&a(null));s+=1,t(n.value,n.key,Ji(p))}c=!1}l()};var Zi=Ri((function(e,n,t,a){return Vi(n)(e,qi(t),a)}),4);function Qi(e,n,t){t=Gi(t);var a=0,i=0,{length:o}=e,r=!1;function s(e,n){!1===e&&(r=!0),!0!==r&&(e?t(e):++i!==o&&n!==Wi||t(null))}for(0===o&&t(null);a<o;a++)n(e[a],a,Ji(s))}function Yi(e,n,t){return Zi(e,1/0,n,t)}var Xi=Ri((function(e,n,t){return(Ui(e)?Qi:Yi)(e,qi(n),t)}),3);var eo=Ri((function(e,n,t){return $i(Xi,e,n,t)}),3),no=zi(eo);var to=Ri((function(e,n,t){return Zi(e,1,n,t)}),3);var ao=Ri((function(e,n,t){return $i(to,e,n,t)}),3),io=zi(ao);const oo=Symbol("promiseCallback");function ro(){let e,n;function t(t,...a){if(t)return n(t);e(a.length>1?a:a[0])}return t[oo]=new Promise(((t,a)=>{e=t,n=a})),t}function so(e,n,t){"number"!=typeof n&&(t=n,n=null),t=Gi(t||ro());var a=Object.keys(e).length;if(!a)return t(null);n||(n=a);var i={},o=0,r=!1,s=!1,c=Object.create(null),p=[],l=[],u={};function d(e,n){p.push((()=>function(e,n){if(s)return;var a=Ji(((n,...a)=>{if(o--,!1!==n)if(a.length<2&&([a]=a),n){var p={};if(Object.keys(i).forEach((e=>{p[e]=i[e]})),p[e]=a,s=!0,c=Object.create(null),r)return;t(n,p)}else i[e]=a,(c[e]||[]).forEach((e=>e())),f();else r=!0}));o++;var p=qi(n[n.length-1]);n.length>1?p(i,a):p(a)}(e,n)))}function f(){if(!r){if(0===p.length&&0===o)return t(null,i);for(;p.length&&o<n;){p.shift()()}}}function m(n){var t=[];return Object.keys(e).forEach((a=>{const i=e[a];Array.isArray(i)&&i.indexOf(n)>=0&&t.push(a)})),t}return Object.keys(e).forEach((n=>{var t=e[n];if(!Array.isArray(t))return d(n,[t]),void l.push(n);var a=t.slice(0,t.length-1),i=a.length;if(0===i)return d(n,t),void l.push(n);u[n]=i,a.forEach((o=>{if(!e[o])throw new Error("async.auto task `"+n+"` has a non-existent dependency `"+o+"` in "+a.join(", "));!function(e,n){var t=c[e];t||(t=c[e]=[]);t.push(n)}(o,(()=>{0===--i&&d(n,t)}))}))})),function(){var e=0;for(;l.length;)e++,m(l.pop()).forEach((e=>{0==--u[e]&&l.push(e)}));if(e!==a)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),f(),t[oo]}var co=/^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/,po=/^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/,lo=/,/,uo=/(=.+)?(\s*)$/;function fo(e,n){var t={};return Object.keys(e).forEach((n=>{var a,i=e[n],o=Bi(i),r=!o&&1===i.length||o&&0===i.length;if(Array.isArray(i))a=[...i],i=a.pop(),t[n]=a.concat(a.length>0?s:i);else if(r)t[n]=i;else{if(a=function(e){const n=function(e){let n="",t=0,a=e.indexOf("*/");for(;t<e.length;)if("/"===e[t]&&"/"===e[t+1]){let n=e.indexOf("\n",t);t=-1===n?e.length:n}else if(-1!==a&&"/"===e[t]&&"*"===e[t+1]){let i=e.indexOf("*/",t);-1!==i?(t=i+2,a=e.indexOf("*/",t)):(n+=e[t],t++)}else n+=e[t],t++;return n}(e.toString());let t=n.match(co);if(t||(t=n.match(po)),!t)throw new Error("could not parse args in autoInject\nSource:\n"+n);let[,a]=t;return a.replace(/\s/g,"").split(lo).map((e=>e.replace(uo,"").trim()))}(i),0===i.length&&!o&&0===a.length)throw new Error("autoInject task functions require explicit parameters.");o||a.pop(),t[n]=a.concat(s)}function s(e,n){var t=a.map((n=>e[n]));t.push(n),qi(i)(...t)}})),so(t,n)}class mo{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,n){n.prev=e,n.next=e.next,e.next?e.next.prev=n:this.tail=n,e.next=n,this.length+=1}insertBefore(e,n){n.prev=e.prev,n.next=e,e.prev?e.prev.next=n:this.head=n,e.prev=n,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):ho(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):ho(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var n=this.head;n;){var{next:t}=n;e(n)&&this.removeLink(n),n=t}return this}}function ho(e,n){e.length=1,e.head=e.tail=n}function vo(e,n,t){if(null==n)n=1;else if(0===n)throw new RangeError("Concurrency must not be zero");var a=qi(e),i=0,o=[];const r={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function s(e,n){return e?n?void(r[e]=r[e].filter((e=>e!==n))):r[e]=[]:Object.keys(r).forEach((e=>r[e]=[]))}function c(e,...n){r[e].forEach((e=>e(...n)))}var p=!1;function l(e,n,t,a){if(null!=a&&"function"!=typeof a)throw new Error("task callback must be a function");var i,o;function r(e,...n){return e?t?o(e):i():n.length<=1?i(n[0]):void i(n)}h.started=!0;var s=h._createTaskItem(e,t?r:a||r);if(n?h._tasks.unshift(s):h._tasks.push(s),p||(p=!0,Ii((()=>{p=!1,h.process()}))),t||!a)return new Promise(((e,n)=>{i=e,o=n}))}function u(e){return function(n,...t){i-=1;for(var a=0,r=e.length;a<r;a++){var s=e[a],p=o.indexOf(s);0===p?o.shift():p>0&&o.splice(p,1),s.callback(n,...t),null!=n&&c("error",n,s.data)}i<=h.concurrency-h.buffer&&c("unsaturated"),h.idle()&&c("drain"),h.process()}}function d(e){return!(0!==e.length||!h.idle())&&(Ii((()=>c("drain"))),!0)}const f=e=>n=>{if(!n)return new Promise(((n,t)=>{!function(e,n){const t=(...a)=>{s(e,t),n(...a)};r[e].push(t)}(e,((e,a)=>{if(e)return t(e);n(a)}))}));s(e),function(e,n){r[e].push(n)}(e,n)};var m=!1,h={_tasks:new mo,_createTaskItem:(e,n)=>({data:e,callback:n}),*[Symbol.iterator](){yield*h._tasks[Symbol.iterator]()},concurrency:n,payload:t,buffer:n/4,started:!1,paused:!1,push(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!1,!1,n)))}return l(e,!1,!1,n)},pushAsync(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!1,!0,n)))}return l(e,!1,!0,n)},kill(){s(),h._tasks.empty()},unshift(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!0,!1,n)))}return l(e,!0,!1,n)},unshiftAsync(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!0,!0,n)))}return l(e,!0,!0,n)},remove(e){h._tasks.remove(e)},process(){if(!m){for(m=!0;!h.paused&&i<h.concurrency&&h._tasks.length;){var e=[],n=[],t=h._tasks.length;h.payload&&(t=Math.min(t,h.payload));for(var r=0;r<t;r++){var s=h._tasks.shift();e.push(s),o.push(s),n.push(s.data)}i+=1,0===h._tasks.length&&c("empty"),i===h.concurrency&&c("saturated");var p=Ji(u(e));a(n,p)}m=!1}},length:()=>h._tasks.length,running:()=>i,workersList:()=>o,idle:()=>h._tasks.length+i===0,pause(){h.paused=!0},resume(){!1!==h.paused&&(h.paused=!1,Ii(h.process))}};return Object.defineProperties(h,{saturated:{writable:!1,value:f("saturated")},unsaturated:{writable:!1,value:f("unsaturated")},empty:{writable:!1,value:f("empty")},drain:{writable:!1,value:f("drain")},error:{writable:!1,value:f("error")}}),h}function xo(e,n){return vo(e,1,n)}function bo(e,n,t){return vo(e,n,t)}var yo=Ri((function(e,n,t,a){a=Gi(a);var i=qi(t);return to(e,((e,t,a)=>{i(n,e,((e,t)=>{n=t,a(e)}))}),(e=>a(e,n)))}),4);function go(...e){var n=e.map(qi);return function(...e){var t=this,a=e[e.length-1];return"function"==typeof a?e.pop():a=ro(),yo(n,e,((e,n,a)=>{n.apply(t,e.concat(((e,...n)=>{a(e,n)})))}),((e,n)=>a(e,...n))),a[oo]}}function wo(...e){return go(...e.reverse())}var So=Ri((function(e,n,t,a){return $i(Vi(n),e,t,a)}),4);var ko=Ri((function(e,n,t,a){var i=qi(t);return So(e,n,((e,n)=>{i(e,((e,...t)=>e?n(e):n(e,t)))}),((e,n)=>{for(var t=[],i=0;i<n.length;i++)n[i]&&(t=t.concat(...n[i]));return a(e,t)}))}),4);var Eo=Ri((function(e,n,t){return ko(e,1/0,n,t)}),3);var jo=Ri((function(e,n,t){return ko(e,1,n,t)}),3);function Oo(...e){return function(...n){return n.pop()(null,...e)}}function Co(e,n){return(t,a,i,o)=>{var r,s=!1;const c=qi(i);t(a,((t,a,i)=>{c(t,((a,o)=>a||!1===a?i(a):e(o)&&!r?(s=!0,r=n(!0,t),i(null,Wi)):void i()))}),(e=>{if(e)return o(e);o(null,s?r:n(!1))}))}}var _o=Ri((function(e,n,t){return Co((e=>e),((e,n)=>n))(Xi,e,n,t)}),3);var Ao=Ri((function(e,n,t,a){return Co((e=>e),((e,n)=>n))(Vi(n),e,t,a)}),4);var Fo=Ri((function(e,n,t){return Co((e=>e),((e,n)=>n))(Vi(1),e,n,t)}),3);function To(e){return(n,...t)=>qi(n)(...t,((n,...t)=>{"object"==typeof console&&(n?console.error&&console.error(n):console[e]&&t.forEach((n=>console[e](n))))}))}var Po=To("dir");var No=Ri((function(e,n,t){t=Ji(t);var a,i=qi(e),o=qi(n);function r(e,...n){if(e)return t(e);!1!==e&&(a=n,o(...n,s))}function s(e,n){return e?t(e):!1!==e?n?void i(r):t(null,...a):void 0}return s(null,!0)}),3);function Io(e,n,t){const a=qi(n);return No(e,((...e)=>{const n=e.pop();a(...e,((e,t)=>n(e,!t)))}),t)}function Lo(e){return(n,t,a)=>e(n,a)}var Mo=Ri((function(e,n,t){return Xi(e,Lo(qi(n)),t)}),3);var Do=Ri((function(e,n,t,a){return Vi(n)(e,Lo(qi(t)),a)}),4);var Bo=Ri((function(e,n,t){return Do(e,1,n,t)}),3);function qo(e){return Bi(e)?e:function(...n){var t=n.pop(),a=!0;n.push(((...e)=>{a?Ii((()=>t(...e))):t(...e)})),e.apply(this,n),a=!1}}var Ro=Ri((function(e,n,t){return Co((e=>!e),(e=>!e))(Xi,e,n,t)}),3);var zo=Ri((function(e,n,t,a){return Co((e=>!e),(e=>!e))(Vi(n),e,t,a)}),4);var $o=Ri((function(e,n,t){return Co((e=>!e),(e=>!e))(to,e,n,t)}),3);function Uo(e,n,t,a){var i=new Array(n.length);e(n,((e,n,a)=>{t(e,((e,t)=>{i[n]=!!t,a(e)}))}),(e=>{if(e)return a(e);for(var t=[],o=0;o<n.length;o++)i[o]&&t.push(n[o]);a(null,t)}))}function Wo(e,n,t,a){var i=[];e(n,((e,n,a)=>{t(e,((t,o)=>{if(t)return a(t);o&&i.push({index:n,value:e}),a(t)}))}),(e=>{if(e)return a(e);a(null,i.sort(((e,n)=>e.index-n.index)).map((e=>e.value)))}))}function Go(e,n,t,a){return(Ui(n)?Uo:Wo)(e,n,qi(t),a)}var Ho=Ri((function(e,n,t){return Go(Xi,e,n,t)}),3);var Jo=Ri((function(e,n,t,a){return Go(Vi(n),e,t,a)}),4);var Ko=Ri((function(e,n,t){return Go(to,e,n,t)}),3);var Vo=Ri((function(e,n){var t=Ji(n),a=qi(qo(e));return function e(n){if(n)return t(n);!1!==n&&a(e)}()}),2);var Zo=Ri((function(e,n,t,a){var i=qi(t);return So(e,n,((e,n)=>{i(e,((t,a)=>t?n(t):n(t,{key:a,val:e})))}),((e,n)=>{for(var t={},{hasOwnProperty:i}=Object.prototype,o=0;o<n.length;o++)if(n[o]){var{key:r}=n[o],{val:s}=n[o];i.call(t,r)?t[r].push(s):t[r]=[s]}return a(e,t)}))}),4);function Qo(e,n,t){return Zo(e,1/0,n,t)}function Yo(e,n,t){return Zo(e,1,n,t)}var Xo=To("log");var er=Ri((function(e,n,t,a){a=Gi(a);var i={},o=qi(t);return Vi(n)(e,((e,n,t)=>{o(e,n,((e,a)=>{if(e)return t(e);i[n]=a,t(e)}))}),(e=>a(e,i)))}),4);function nr(e,n,t){return er(e,1/0,n,t)}function tr(e,n,t){return er(e,1,n,t)}function ar(e,n=e=>e){var t=Object.create(null),a=Object.create(null),i=qi(e),o=_i(((e,o)=>{var r=n(...e);r in t?Ii((()=>o(null,...t[r]))):r in a?a[r].push(o):(a[r]=[o],i(...e,((e,...n)=>{e||(t[r]=n);var i=a[r];delete a[r];for(var o=0,s=i.length;o<s;o++)i[o](e,...n)})))}));return o.memo=t,o.unmemoized=e,o}var ir=Ni(Ti?process.nextTick:Fi?setImmediate:Pi),or=Ri(((e,n,t)=>{var a=Ui(n)?[]:{};e(n,((e,n,t)=>{qi(e)(((e,...i)=>{i.length<2&&([i]=i),a[n]=i,t(e)}))}),(e=>t(e,a)))}),3);function rr(e,n){return or(Xi,e,n)}function sr(e,n,t){return or(Vi(n),e,t)}function cr(e,n){var t=qi(e);return vo(((e,n)=>{t(e[0],n)}),n,1)}class pr{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){let n;for(;e>0&&ur(this.heap[e],this.heap[n=lr(e)]);){let t=this.heap[e];this.heap[e]=this.heap[n],this.heap[n]=t,e=n}}percDown(e){let n;for(;(n=1+(e<<1))<this.heap.length&&(n+1<this.heap.length&&ur(this.heap[n+1],this.heap[n])&&(n+=1),!ur(this.heap[e],this.heap[n]));){let t=this.heap[e];this.heap[e]=this.heap[n],this.heap[n]=t,e=n}}push(e){e.pushCount=++this.pushCount,this.heap.push(e),this.percUp(this.heap.length-1)}unshift(e){return this.heap.push(e)}shift(){let[e]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),e}toArray(){return[...this]}*[Symbol.iterator](){for(let e=0;e<this.heap.length;e++)yield this.heap[e].data}remove(e){let n=0;for(let t=0;t<this.heap.length;t++)e(this.heap[t])||(this.heap[n]=this.heap[t],n++);this.heap.splice(n);for(let e=lr(this.heap.length-1);e>=0;e--)this.percDown(e);return this}}function lr(e){return(e+1>>1)-1}function ur(e,n){return e.priority!==n.priority?e.priority<n.priority:e.pushCount<n.pushCount}function dr(e,n){var t=cr(e,n),{push:a,pushAsync:i}=t;function o(e,n){return Array.isArray(e)?e.map((e=>({data:e,priority:n}))):{data:e,priority:n}}return t._tasks=new pr,t._createTaskItem=({data:e,priority:n},t)=>({data:e,priority:n,callback:t}),t.push=function(e,n=0,t){return a(o(e,n),t)},t.pushAsync=function(e,n=0,t){return i(o(e,n),t)},delete t.unshift,delete t.unshiftAsync,t}var fr=Ri((function(e,n){if(n=Gi(n),!Array.isArray(e))return n(new TypeError("First argument to race must be an array of functions"));if(!e.length)return n();for(var t=0,a=e.length;t<a;t++)qi(e[t])(n)}),2);function mr(e,n,t,a){var i=[...e].reverse();return yo(i,n,t,a)}function hr(e){var n=qi(e);return _i((function(e,t){return e.push(((e,...n)=>{let a={};if(e&&(a.error=e),n.length>0){var i=n;n.length<=1&&([i]=n),a.value=i}t(null,a)})),n.apply(this,e)}))}function vr(e){var n;return Array.isArray(e)?n=e.map(hr):(n={},Object.keys(e).forEach((t=>{n[t]=hr.call(this,e[t])}))),n}function xr(e,n,t,a){const i=qi(t);return Go(e,n,((e,n)=>{i(e,((e,t)=>{n(e,!t)}))}),a)}var br=Ri((function(e,n,t){return xr(Xi,e,n,t)}),3);var yr=Ri((function(e,n,t,a){return xr(Vi(n),e,t,a)}),4);var gr=Ri((function(e,n,t){return xr(to,e,n,t)}),3);function wr(e){return function(){return e}}function Sr(e,n,t){var a={times:5,intervalFunc:wr(0)};if(arguments.length<3&&"function"==typeof e?(t=n||ro(),n=e):(!function(e,n){if("object"==typeof n)e.times=+n.times||5,e.intervalFunc="function"==typeof n.interval?n.interval:wr(+n.interval||0),e.errorFilter=n.errorFilter;else{if("number"!=typeof n&&"string"!=typeof n)throw new Error("Invalid arguments for async.retry");e.times=+n||5}}(a,e),t=t||ro()),"function"!=typeof n)throw new Error("Invalid arguments for async.retry");var i=qi(n),o=1;return function e(){i(((n,...i)=>{!1!==n&&(n&&o++<a.times&&("function"!=typeof a.errorFilter||a.errorFilter(n))?setTimeout(e,a.intervalFunc(o-1)):t(n,...i))}))}(),t[oo]}function kr(e,n){n||(n=e,e=null);let t=e&&e.arity||n.length;Bi(n)&&(t+=1);var a=qi(n);return _i(((n,i)=>{function o(e){a(...n,e)}return(n.length<t-1||null==i)&&(n.push(i),i=ro()),e?Sr(e,o,i):Sr(o,i),i[oo]}))}function Er(e,n){return or(to,e,n)}var jr=Ri((function(e,n,t){return Co(Boolean,(e=>e))(Xi,e,n,t)}),3);var Or=Ri((function(e,n,t,a){return Co(Boolean,(e=>e))(Vi(n),e,t,a)}),4);var Cr=Ri((function(e,n,t){return Co(Boolean,(e=>e))(to,e,n,t)}),3);var _r=Ri((function(e,n,t){var a=qi(n);return eo(e,((e,n)=>{a(e,((t,a)=>{if(t)return n(t);n(t,{value:e,criteria:a})}))}),((e,n)=>{if(e)return t(e);t(null,n.sort(i).map((e=>e.value)))}));function i(e,n){var t=e.criteria,a=n.criteria;return t<a?-1:t>a?1:0}}),3);function Ar(e,n,t){var a=qi(e);return _i(((i,o)=>{var r,s=!1;i.push(((...e)=>{s||(o(...e),clearTimeout(r))})),r=setTimeout((function(){var n=e.name||"anonymous",a=new Error('Callback function "'+n+'" timed out.');a.code="ETIMEDOUT",t&&(a.info=t),s=!0,o(a)}),n),a(...i)}))}function Fr(e,n,t,a){var i=qi(t);return So(function(e){for(var n=Array(e);e--;)n[e]=e;return n}(e),n,i,a)}function Tr(e,n,t){return Fr(e,1/0,n,t)}function Pr(e,n,t){return Fr(e,1,n,t)}function Nr(e,n,t,a){arguments.length<=3&&"function"==typeof n&&(a=t,t=n,n=Array.isArray(e)?[]:{}),a=Gi(a||ro());var i=qi(t);return Xi(e,((e,t,a)=>{i(n,e,t,a)}),(e=>a(e,n))),a[oo]}var Ir=Ri((function(e,n){var t,a=null;return Bo(e,((e,n)=>{qi(e)(((e,...i)=>{if(!1===e)return n(e);i.length<2?[t]=i:t=i,a=e,n(e?null:{})}))}),(()=>n(a,t)))}));function Lr(e){return(...n)=>(e.unmemoized||e)(...n)}var Mr=Ri((function(e,n,t){t=Ji(t);var a=qi(n),i=qi(e),o=[];function r(e,...n){if(e)return t(e);o=n,!1!==e&&i(s)}function s(e,n){return e?t(e):!1!==e?n?void a(r):t(null,...o):void 0}return i(s)}),3);function Dr(e,n,t){const a=qi(e);return Mr((e=>a(((n,t)=>e(n,!t)))),n,t)}var Br,qr,Rr,zr,$r,Ur=Ri((function(e,n){if(n=Gi(n),!Array.isArray(e))return n(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return n();var t=0;function a(n){qi(e[t++])(...n,Ji(i))}function i(i,...o){if(!1!==i)return i||t===e.length?n(i,...o):void a(o)}a([])})),Wr={apply:Ci,applyEach:no,applyEachSeries:io,asyncify:Li,auto:so,autoInject:fo,cargo:xo,cargoQueue:bo,compose:wo,concat:Eo,concatLimit:ko,concatSeries:jo,constant:Oo,detect:_o,detectLimit:Ao,detectSeries:Fo,dir:Po,doUntil:Io,doWhilst:No,each:Mo,eachLimit:Do,eachOf:Xi,eachOfLimit:Zi,eachOfSeries:to,eachSeries:Bo,ensureAsync:qo,every:Ro,everyLimit:zo,everySeries:$o,filter:Ho,filterLimit:Jo,filterSeries:Ko,forever:Vo,groupBy:Qo,groupByLimit:Zo,groupBySeries:Yo,log:Xo,map:eo,mapLimit:So,mapSeries:ao,mapValues:nr,mapValuesLimit:er,mapValuesSeries:tr,memoize:ar,nextTick:ir,parallel:rr,parallelLimit:sr,priorityQueue:dr,queue:cr,race:fr,reduce:yo,reduceRight:mr,reflect:hr,reflectAll:vr,reject:br,rejectLimit:yr,rejectSeries:gr,retry:Sr,retryable:kr,seq:go,series:Er,setImmediate:Ii,some:jr,someLimit:Or,someSeries:Cr,sortBy:_r,timeout:Ar,times:Tr,timesLimit:Fr,timesSeries:Pr,transform:Nr,tryEach:Ir,unmemoize:Lr,until:Dr,waterfall:Ur,whilst:Mr,all:Ro,allLimit:zo,allSeries:$o,any:jr,anyLimit:Or,anySeries:Cr,find:_o,findLimit:Ao,findSeries:Fo,flatMap:Eo,flatMapLimit:ko,flatMapSeries:jo,forEach:Mo,forEachSeries:Bo,forEachLimit:Do,forEachOf:Xi,forEachOfSeries:to,forEachOfLimit:Zi,inject:yo,foldl:yo,foldr:mr,select:Ho,selectLimit:Jo,selectSeries:Ko,wrapSync:Li,during:Mr,doDuring:No},Gr=K(Object.freeze({__proto__:null,all:Ro,allLimit:zo,allSeries:$o,any:jr,anyLimit:Or,anySeries:Cr,apply:Ci,applyEach:no,applyEachSeries:io,asyncify:Li,auto:so,autoInject:fo,cargo:xo,cargoQueue:bo,compose:wo,concat:Eo,concatLimit:ko,concatSeries:jo,constant:Oo,default:Wr,detect:_o,detectLimit:Ao,detectSeries:Fo,dir:Po,doDuring:No,doUntil:Io,doWhilst:No,during:Mr,each:Mo,eachLimit:Do,eachOf:Xi,eachOfLimit:Zi,eachOfSeries:to,eachSeries:Bo,ensureAsync:qo,every:Ro,everyLimit:zo,everySeries:$o,filter:Ho,filterLimit:Jo,filterSeries:Ko,find:_o,findLimit:Ao,findSeries:Fo,flatMap:Eo,flatMapLimit:ko,flatMapSeries:jo,foldl:yo,foldr:mr,forEach:Mo,forEachLimit:Do,forEachOf:Xi,forEachOfLimit:Zi,forEachOfSeries:to,forEachSeries:Bo,forever:Vo,groupBy:Qo,groupByLimit:Zo,groupBySeries:Yo,inject:yo,log:Xo,map:eo,mapLimit:So,mapSeries:ao,mapValues:nr,mapValuesLimit:er,mapValuesSeries:tr,memoize:ar,nextTick:ir,parallel:rr,parallelLimit:sr,priorityQueue:dr,queue:cr,race:fr,reduce:yo,reduceRight:mr,reflect:hr,reflectAll:vr,reject:br,rejectLimit:yr,rejectSeries:gr,retry:Sr,retryable:kr,select:Ho,selectLimit:Jo,selectSeries:Ko,seq:go,series:Er,setImmediate:Ii,some:jr,someLimit:Or,someSeries:Cr,sortBy:_r,timeout:Ar,times:Tr,timesLimit:Fr,timesSeries:Pr,transform:Nr,tryEach:Ir,unmemoize:Lr,until:Dr,waterfall:Ur,whilst:Mr,wrapSync:Li})),Hr={exports:{}},Jr={exports:{}};function Kr(){if(qr)return Br;qr=1;var e=1e3,n=60*e,t=60*n,a=24*t,i=7*a,o=365.25*a;function r(e,n,t,a){var i=n>=1.5*t;return Math.round(e/t)+" "+a+(i?"s":"")}return Br=function(s,c){c=c||{};var p=typeof s;if("string"===p&&s.length>0)return function(r){if((r=String(r)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*a;case"hours":case"hour":case"hrs":case"hr":case"h":return c*t;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===p&&isFinite(s))return c.long?function(i){var o=Math.abs(i);if(o>=a)return r(i,o,a,"day");if(o>=t)return r(i,o,t,"hour");if(o>=n)return r(i,o,n,"minute");if(o>=e)return r(i,o,e,"second");return i+" ms"}(s):function(i){var o=Math.abs(i);if(o>=a)return Math.round(i/a)+"d";if(o>=t)return Math.round(i/t)+"h";if(o>=n)return Math.round(i/n)+"m";if(o>=e)return Math.round(i/e)+"s";return i+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},Br}function Vr(){if(zr)return Rr;return zr=1,Rr=function(e){function n(e){let a,i,o,r=null;function s(...e){if(!s.enabled)return;const t=s,i=Number(new Date),o=i-(a||i);t.diff=o,t.prev=a,t.curr=i,a=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let r=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((a,i)=>{if("%%"===a)return"%";r++;const o=n.formatters[i];if("function"==typeof o){const n=e[r];a=o.call(t,n),e.splice(r,1),r--}return a})),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=t,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(i!==n.namespaces&&(i=n.namespaces,o=n.enabled(e)),o),set:e=>{r=e}}),"function"==typeof n.init&&n.init(s),s}function t(e,t){const a=n(this.namespace+(void 0===t?":":t)+e);return a.log=this.log,a}function a(e,n){let t=0,a=0,i=-1,o=0;for(;t<e.length;)if(a<n.length&&(n[a]===e[t]||"*"===n[a]))"*"===n[a]?(i=a,o=t,a++):(t++,a++);else{if(-1===i)return!1;a=i+1,o++,t=o}for(;a<n.length&&"*"===n[a];)a++;return a===n.length}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names,...n.skips.map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];const t=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of t)"-"===e[0]?n.skips.push(e.slice(1)):n.names.push(e)},n.enabled=function(e){for(const t of n.skips)if(a(e,t))return!1;for(const t of n.names)if(a(e,t))return!0;return!1},n.humanize=Kr(),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((t=>{n[t]=e[t]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n},Rr}var Zr,Qr,Yr,Xr={exports:{}};function es(){return Zr||(Zr=1,function(e,n){const t=x,a=m;n.init=function(e){e.inspectOpts={};const t=Object.keys(n.inspectOpts);for(let a=0;a<t.length;a++)e.inspectOpts[t[a]]=n.inspectOpts[t[a]]},n.log=function(...e){return process.stderr.write(a.formatWithOptions(n.inspectOpts,...e)+"\n")},n.formatArgs=function(t){const{namespace:a,useColors:i}=this;if(i){const n=this.color,i="[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${a} `;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"")}else t[0]=function(){if(n.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+a+" "+t[0]},n.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},n.load=function(){return process.env.DEBUG},n.useColors=function(){return"colors"in n.inspectOpts?Boolean(n.inspectOpts.colors):t.isatty(process.stderr.fd)},n.destroy=a.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),n.colors=[6,2,3,4,5,1];try{const e=require("supports-color");e&&(e.stderr||e).level>=2&&(n.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}n.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,n)=>{const t=n.substring(6).toLowerCase().replace(/_([a-z])/g,((e,n)=>n.toUpperCase()));let a=process.env[n];return a=!!/^(yes|on|true|enabled)$/i.test(a)||!/^(no|off|false|disabled)$/i.test(a)&&("null"===a?null:Number(a)),e[t]=a,e}),{}),e.exports=Vr()(n);const{formatters:i}=e.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}}(Xr,Xr.exports)),Xr.exports}function ns(){return Qr||(Qr=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Hr.exports=($r||($r=1,function(e,n){n.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const t="color: "+this.color;n.splice(1,0,t,"color: inherit");let a=0,i=0;n[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(a++,"%c"===e&&(i=a))})),n.splice(i,0,t)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),e.exports=Vr()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Jr,Jr.exports)),Jr.exports):Hr.exports=es()),Hr.exports}var ts=(Yr||(Yr=1,function(e){const t=n,a=h,i=v,r=o,s=Gr,c=ns(),p=c("portfinder:testPort"),l=c("portfinder:getPort"),u=c("portfinder:defaultHosts"),d={testPort:function(n,t){function a(){p("done w/ testPort(): OK",n.host,"port",n.port),n.server.removeListener("error",o),n.server.close((function(){p("done w/ testPort(): Server closed",n.host,"port",n.port),t(null,n.port)}))}function o(i){if(p("done w/ testPort(): failed",n.host,"w/ port",n.port,"with error",i.code),n.server.removeListener("listening",a),"EADDRINUSE"!=i.code&&"EACCES"!=i.code)return t(i);const o=e.nextPort(n.port);if(o>e.highestPort)return t(new Error("No open ports available"));d.testPort({port:o,host:n.host,server:n.server},t)}t||(t=n,n={}),n.server=n.server||i.createServer((function(){})),p("entered testPort(): trying",n.host,"port",n.port),n.server.once("error",o),n.server.once("listening",a),n.host?n.server.listen(n.port,n.host):n.server.listen(n.port)}};e.basePort=8e3,e.setBasePort=function(n){e.basePort=n},e.highestPort=65535,e.setHighestPort=function(n){e.highestPort=n},e.basePath="/tmp/portfinder",e.setBasePath=function(n){e.basePath=n},d.getPort=function(n,t){if(n.port=Number(n.port)||Number(n.startPort)||Number(e.basePort),n.host=n.host||null,n.stopPort=Number(n.stopPort)||Number(e.highestPort),!n.startPort){if(n.startPort=n.port,n.startPort<0)return t(Error(`Provided options.port(${n.port}) is less than 0, which are cannot be bound.`));if(n.stopPort<n.startPort)return t(Error(`Provided options.stopPort(${n.stopPort}) is less than options.port(${n.startPort})`))}n.host&&-1===e._defaultHosts.indexOf(n.host)&&e._defaultHosts.push(n.host);const a=[];let i;return s.eachSeries(e._defaultHosts,(function(e,t){return l("in eachSeries() iteration callback: host is",e),d.testPort({host:e,port:n.port},(function(n,o){return n?(l("in eachSeries() iteration callback testPort() callback","with an err:",n.code),i=e,t(n)):(l("in eachSeries() iteration callback testPort() callback","with a success for port",o),a.push(o),t())}))}),(function(o){if(o){if(l("in eachSeries() result callback: err is",o),"EADDRNOTAVAIL"===o.code||"EINVAL"===o.code){if(n.host===i){const e="Provided host "+n.host+" could NOT be bound. Please provide a different host address or hostname";return t(Error(e))}{const a=e._defaultHosts.indexOf(i);return e._defaultHosts.splice(a,1),d.getPort(n,t)}}return t(o)}if(a.sort((function(e,n){return e-n})),l("in eachSeries() result callback: openPorts is",a),a[0]===a[a.length-1]){if(a[0]<=n.stopPort)return t(null,a[0]);{const e="No open ports found in between "+n.startPort+" and "+n.stopPort;return t(Error(e))}}return d.getPort({port:a.pop(),host:n.host,startPort:n.startPort,stopPort:n.stopPort},t)}))},e.getPort=function(e,n){if("function"==typeof e&&(n=e,e={}),e=e||{},!n)return new Promise((function(n,t){d.getPort(e,(function(e,a){if(e)return t(e);n(a)}))}));d.getPort(e,n)},e.getPortPromise=e.getPort,d.getPorts=function(n,t,a){let i=null;s.timesSeries(n,(function(n,a){i&&(t.port=e.nextPort(i)),d.getPort(t,(function(e,n){e?a(e):(i=n,a(null,n))}))}),a)},e.getPorts=function(e,n,t){if("function"==typeof n&&(t=n,n={}),n=n||{},!t)return new Promise((function(t,a){d.getPorts(e,n,(function(e,n){if(e)return a(e);t(n)}))}));d.getPorts(e,n,t)},e.getPortsPromise=e.getPorts,d.getSocket=function(n,a){function i(){t.stat(n.path,(function(t){t?"ENOENT"==t.code?a(null,n.path):a(t):(n.path=e.nextSocket(n.path),d.getSocket(n,a))}))}return n.mod=n.mod||parseInt(755,8),n.path=n.path||e.basePath+".sock",n.exists?i():function(){const e=r.dirname(n.path);t.stat(e,(function(o,r){if(o||!r.isDirectory())return function(e){t.mkdir(e,{mode:n.mod,recursive:!0},(function(e){if(e)return a(e);n.exists=!0,i()}))}(e);n.exists=!0,i()}))}()},e.getSocket=function(e,n){if("function"==typeof e&&(n=e,e={}),e=e||{},!n)return new Promise((function(n,t){d.getSocket(e,(function(e,a){if(e)return t(e);n(a)}))}));d.getSocket(e,n)},e.getSocketPromise=e.getSocket,e.nextPort=function(e){return e+1},e.nextSocket=function(e){const n=r.dirname(e),t=r.basename(e,".sock").match(/^([a-zA-z]+)(\d*)$/i),a=t[1];let i=parseInt(t[2]);return isNaN(i)&&(i=0),i+=1,r.join(n,a+i+".sock")},e._defaultHosts=function(){let e={};try{e=a.networkInterfaces()}catch(e){if("uv_interface_addresses"!==e.syscall)throw e}const n=Object.keys(e),t=["0.0.0.0"];for(let a=0;a<n.length;a++){const i=e[n[a]];for(let e=0;e<i.length;e++){const n=i[e];t.push(n.address)}}return t.push(null),u("exports._defaultHosts is: %o",t),t}()}(Oi)),Oi),as=J(ts);const is=p.prototype.listen,os=e=>{const n=e.address();if(n){((e,n)=>{const t=null!==n?`http://${e}:${n}`:e;console.log(`app listen ${t}`)})("object"==typeof n?(e=>"::"===e?"0.0.0.0":e)(n.address):n,"object"==typeof n?n.port:null)}},rs=(e,n,t,a)=>{const{pathPrefix:i,moduleName:o,name:r}=z(n,"controller"),s=`${i}/${o}`;if(!t)return;const c=q(`${e}${`${i}/${r}`}`);t.forEach((e=>{const{method:n,path:t,handler:o,functionName:r,authRequired:p,middlewares:l}=e;var u;c&&"function"==typeof c[r]&&l.push((u=c[r].bind(c),async(e,n)=>{const t=u(e);t instanceof Promise&&await t,await n()}));const d=(f=p,m=o,async(e,n)=>{let t=a(f,e);return t instanceof Promise&&(t=await t),t?m(e,n):e.throw(403,"无权限")});var f,m;const h=[...l,d],v=ss(t,s,r,h,n);e.path=v,e.apiPrePath=i}))},ss=(e,n,t,a,i)=>{const o=`${n}${e}`;if(t===E){const e=`${n}/index`;G[i](e,...a)}return G[i](o,...a),o};var cs,ps,ls,us={exports:{}},ds={exports:{}};function fs(){if(ps)return cs;return ps=1,cs=function(e){function n(e){let a,i,o,r=null;function s(...e){if(!s.enabled)return;const t=s,i=Number(new Date),o=i-(a||i);t.diff=o,t.prev=a,t.curr=i,a=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let r=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((a,i)=>{if("%%"===a)return"%";r++;const o=n.formatters[i];if("function"==typeof o){const n=e[r];a=o.call(t,n),e.splice(r,1),r--}return a})),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=t,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(i!==n.namespaces&&(i=n.namespaces,o=n.enabled(e)),o),set:e=>{r=e}}),"function"==typeof n.init&&n.init(s),s}function t(e,t){const a=n(this.namespace+(void 0===t?":":t)+e);return a.log=this.log,a}function a(e,n){let t=0,a=0,i=-1,o=0;for(;t<e.length;)if(a<n.length&&(n[a]===e[t]||"*"===n[a]))"*"===n[a]?(i=a,o=t,a++):(t++,a++);else{if(-1===i)return!1;a=i+1,o++,t=o}for(;a<n.length&&"*"===n[a];)a++;return a===n.length}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names,...n.skips.map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];const t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of t)"-"===e[0]?n.skips.push(e.slice(1)):n.names.push(e)},n.enabled=function(e){for(const t of n.skips)if(a(e,t))return!1;for(const t of n.names)if(a(e,t))return!0;return!1},n.humanize=Kr(),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((t=>{n[t]=e[t]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n},cs}var ms,hs,vs,xs,bs,ys,gs={exports:{}};function ws(){return ms||(ms=1,function(e,n){const t=x,a=m;n.init=function(e){e.inspectOpts={};const t=Object.keys(n.inspectOpts);for(let a=0;a<t.length;a++)e.inspectOpts[t[a]]=n.inspectOpts[t[a]]},n.log=function(...e){return process.stderr.write(a.formatWithOptions(n.inspectOpts,...e)+"\n")},n.formatArgs=function(t){const{namespace:a,useColors:i}=this;if(i){const n=this.color,i="[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${a} `;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"")}else t[0]=function(){if(n.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+a+" "+t[0]},n.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},n.load=function(){return process.env.DEBUG},n.useColors=function(){return"colors"in n.inspectOpts?Boolean(n.inspectOpts.colors):t.isatty(process.stderr.fd)},n.destroy=a.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),n.colors=[6,2,3,4,5,1];try{const e=require("supports-color");e&&(e.stderr||e).level>=2&&(n.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}n.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,n)=>{const t=n.substring(6).toLowerCase().replace(/_([a-z])/g,((e,n)=>n.toUpperCase()));let a=process.env[n];return a=!!/^(yes|on|true|enabled)$/i.test(a)||!/^(no|off|false|disabled)$/i.test(a)&&("null"===a?null:Number(a)),e[t]=a,e}),{}),e.exports=fs()(n);const{formatters:i}=e.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}}(gs,gs.exports)),gs.exports}function Ss(){return hs||(hs=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?us.exports=(ls||(ls=1,function(e,n){n.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const t="color: "+this.color;n.splice(1,0,t,"color: inherit");let a=0,i=0;n[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(a++,"%c"===e&&(i=a))})),n.splice(i,0,t)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")||n.storage.getItem("DEBUG")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),e.exports=fs()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(ds,ds.exports)),ds.exports):us.exports=ws()),us.exports}function ks(){if(xs)return vs;function e(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}return xs=1,vs=function(n){if((n=n||{}).circles)return function(n){const t=[],a=[],i=new Map;if(i.set(Date,(e=>new Date(e))),i.set(Map,((e,n)=>new Map(r(Array.from(e),n)))),i.set(Set,((e,n)=>new Set(r(Array.from(e),n)))),n.constructorHandlers)for(const e of n.constructorHandlers)i.set(e[0],e[1]);let o=null;return n.proto?c:s;function r(n,r){const s=Object.keys(n),c=new Array(s.length);for(let p=0;p<s.length;p++){const l=s[p],u=n[l];if("object"!=typeof u||null===u)c[l]=u;else if(u.constructor!==Object&&(o=i.get(u.constructor)))c[l]=o(u,r);else if(ArrayBuffer.isView(u))c[l]=e(u);else{const e=t.indexOf(u);c[l]=-1!==e?a[e]:r(u)}}return c}function s(n){if("object"!=typeof n||null===n)return n;if(Array.isArray(n))return r(n,s);if(n.constructor!==Object&&(o=i.get(n.constructor)))return o(n,s);const c={};t.push(n),a.push(c);for(const r in n){if(!1===Object.hasOwnProperty.call(n,r))continue;const p=n[r];if("object"!=typeof p||null===p)c[r]=p;else if(p.constructor!==Object&&(o=i.get(p.constructor)))c[r]=o(p,s);else if(ArrayBuffer.isView(p))c[r]=e(p);else{const e=t.indexOf(p);c[r]=-1!==e?a[e]:s(p)}}return t.pop(),a.pop(),c}function c(n){if("object"!=typeof n||null===n)return n;if(Array.isArray(n))return r(n,c);if(n.constructor!==Object&&(o=i.get(n.constructor)))return o(n,c);const s={};t.push(n),a.push(s);for(const r in n){const p=n[r];if("object"!=typeof p||null===p)s[r]=p;else if(p.constructor!==Object&&(o=i.get(p.constructor)))s[r]=o(p,c);else if(ArrayBuffer.isView(p))s[r]=e(p);else{const e=t.indexOf(p);s[r]=-1!==e?a[e]:c(p)}}return t.pop(),a.pop(),s}}(n);const t=new Map;if(t.set(Date,(e=>new Date(e))),t.set(Map,((e,n)=>new Map(i(Array.from(e),n)))),t.set(Set,((e,n)=>new Set(i(Array.from(e),n)))),n.constructorHandlers)for(const e of n.constructorHandlers)t.set(e[0],e[1]);let a=null;return n.proto?function n(o){if("object"!=typeof o||null===o)return o;if(Array.isArray(o))return i(o,n);if(o.constructor!==Object&&(a=t.get(o.constructor)))return a(o,n);const r={};for(const i in o){const s=o[i];"object"!=typeof s||null===s?r[i]=s:s.constructor!==Object&&(a=t.get(s.constructor))?r[i]=a(s,n):ArrayBuffer.isView(s)?r[i]=e(s):r[i]=n(s)}return r}:function n(o){if("object"!=typeof o||null===o)return o;if(Array.isArray(o))return i(o,n);if(o.constructor!==Object&&(a=t.get(o.constructor)))return a(o,n);const r={};for(const i in o){if(!1===Object.hasOwnProperty.call(o,i))continue;const s=o[i];"object"!=typeof s||null===s?r[i]=s:s.constructor!==Object&&(a=t.get(s.constructor))?r[i]=a(s,n):ArrayBuffer.isView(s)?r[i]=e(s):r[i]=n(s)}return r};function i(n,i){const o=Object.keys(n),r=new Array(o.length);for(let s=0;s<o.length;s++){const c=o[s],p=n[c];"object"!=typeof p||null===p?r[c]=p:p.constructor!==Object&&(a=t.get(p.constructor))?r[c]=a(p,i):ArrayBuffer.isView(p)?r[c]=e(p):r[c]=i(p)}return r}},vs}function Es(){if(ys)return bs;ys=1;const e=m,n=Ss()("log4js:configuration"),t=[],a=[],i=e=>!e,o=e=>e&&"object"==typeof e&&!Array.isArray(e),r=(n,t,a)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${e.inspect(n,{depth:5})}) - ${a}`)}))};return bs={configure:e=>{n("New configuration to be validated: ",e),r(e,i(o(e)),"must be an object."),n(`Calling pre-processing listeners (${t.length})`),t.forEach((n=>n(e))),n("Configuration pre-processing finished."),n(`Calling configuration listeners (${a.length})`),a.forEach((n=>n(e))),n("Configuration finished.")},addListener:e=>{a.push(e),n(`Added listener, now ${a.length} listeners`)},addPreProcessingListener:e=>{t.push(e),n(`Added pre-processing listener, now ${t.length} listeners`)},throwExceptionIf:r,anObject:o,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:i}}var js,Os,Cs,_s,As,Fs={exports:{}};function Ts(){return js||(js=1,function(e){function n(e,n){for(var t=e.toString();t.length<n;)t="0"+t;return t}function t(e){return n(e,2)}function a(a,i){"string"!=typeof a&&(i=a,a=e.exports.ISO8601_FORMAT),i||(i=e.exports.now());var o,r,s,c,p=t(i.getDate()),l=t(i.getMonth()+1),u=t(i.getFullYear()),d=t(u.substring(2,4)),f=a.indexOf("yyyy")>-1?u:d,m=t(i.getHours()),h=t(i.getMinutes()),v=t(i.getSeconds()),x=n(i.getMilliseconds(),3),b=(o=i.getTimezoneOffset(),r=Math.abs(o),s=String(Math.floor(r/60)),c=String(r%60),s=("0"+s).slice(-2),c=("0"+c).slice(-2),0===o?"Z":(o<0?"+":"-")+s+":"+c);return a.replace(/dd/g,p).replace(/MM/g,l).replace(/y{1,4}/g,f).replace(/hh/g,m).replace(/mm/g,h).replace(/ss/g,v).replace(/SSS/g,x).replace(/O/g,b)}function i(e,n,t,a){e["set"+(a?"":"UTC")+n](t)}e.exports=a,e.exports.asString=a,e.exports.parse=function(n,t,a){if(!n)throw new Error("pattern must be supplied");return function(n,t,a){var o=n.indexOf("O")<0,r=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,n){i(e,"FullYear",n,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,n){i(e,"Month",n-1,o),e.getMonth()!==n-1&&(r=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,n){r&&i(e,"Month",e.getMonth()-1,o),i(e,"Date",n,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,n){i(e,"Hours",n,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,n){i(e,"Minutes",n,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,n){i(e,"Seconds",n,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,n){i(e,"Milliseconds",n,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,n){n="Z"===n?0:n.replace(":","");var t=Math.abs(n),a=(n>0?-1:1)*(t%100+60*Math.floor(t/100));e.setUTCMinutes(e.getUTCMinutes()+a)}}],c=s.reduce((function(e,n){return n.pattern.test(e.regexp)?(n.index=e.regexp.match(n.pattern).index,e.regexp=e.regexp.replace(n.pattern,"("+n.regexp+")")):n.index=-1,e}),{regexp:n,index:[]}),p=s.filter((function(e){return e.index>-1}));p.sort((function(e,n){return e.index-n.index}));var l=new RegExp(c.regexp).exec(t);if(l){var u=a||e.exports.now();return p.forEach((function(e,n){e.fn(u,l[n+1])})),u}throw new Error("String '"+t+"' could not be parsed as '"+n+"'")}(n,t,a)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(Fs)),Fs.exports}function Ps(){if(Cs)return Os;Cs=1;const e=Ts(),n=h,t=m,a=o,i=y,r=Ss()("log4js:layouts"),s={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function c(e){return e?`[${s[e][0]}m`:""}function p(e){return e?`[${s[e][1]}m`:""}function l(n,a){return i=t.format("[%s] [%s] %s - ",e.asString(n.startTime),n.level.toString(),n.categoryName),c(o=a)+i+p(o);var i,o}function u(e){return l(e)+t.format(...e.data)}function d(e){return l(e,e.level.colour)+t.format(...e.data)}function f(e){return t.format(...e.data)}function v(e){return e.data[0]}function x(o,s){const l=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function u(e){return e&&e.pid?e.pid.toString():process.pid.toString()}o=o||"%r %p %c - %m%n";const d={c:function(e,n){let t=e.categoryName;if(n){const e=parseInt(n,10),a=t.split(".");e<a.length&&(t=a.slice(a.length-e).join("."))}return t},d:function(n,t){let a=e.ISO8601_FORMAT;if(t)switch(a=t,a){case"ISO8601":case"ISO8601_FORMAT":a=e.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":a=e.ISO8601_WITH_TZ_OFFSET_FORMAT;break;case"ABSOLUTE":process.emitWarning("Pattern %d{ABSOLUTE} is deprecated in favor of %d{ABSOLUTETIME}. Please use %d{ABSOLUTETIME} instead.","DeprecationWarning","log4js-node-DEP0003"),r("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":a=e.ABSOLUTETIME_FORMAT;break;case"DATE":process.emitWarning("Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.","DeprecationWarning","log4js-node-DEP0004"),r("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":a=e.DATETIME_FORMAT}return e.asString(a,n.startTime)},h:function(){return n.hostname().toString()},m:function(e,n){let a=e.data;if(n){const[e,t]=n.split(",");a=a.slice(e,t)}return t.format(...a)},n:function(){return n.EOL},p:function(e){return e.level.toString()},r:function(n){return e.asString("hh:mm:ss",n.startTime)},"[":function(e){return c(e.level.colour)},"]":function(e){return p(e.level.colour)},y:function(){return u()},z:u,"%":function(){return"%"},x:function(e,n){return void 0!==s[n]?"function"==typeof s[n]?s[n](e):s[n]:null},X:function(e,n){const t=e.context[n];return void 0!==t?"function"==typeof t?t(e):t:null},f:function(e,n){let t=e.fileName||"";if(t=function(e){const n="file://";return e.startsWith(n)&&("function"==typeof i.fileURLToPath?e=i.fileURLToPath(e):(e=a.normalize(e.replace(new RegExp(`^${n}`),"")),"win32"===process.platform&&(e=e.startsWith("\\")?e.slice(1):a.sep+a.sep+e))),e}(t),n){const e=parseInt(n,10),i=t.split(a.sep);i.length>e&&(t=i.slice(-e).join(a.sep))}return t},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function f(e,n,t){return d[e](n,t)}function m(e,n,t){let a=e;return a=function(e,n){let t;return e?(t=parseInt(e.slice(1),10),t>0?n.slice(0,t):n.slice(t)):n}(n,a),a=function(e,n){let t;if(e)if("-"===e.charAt(0))for(t=parseInt(e.slice(1),10);n.length<t;)n+=" ";else for(t=parseInt(e,10);n.length<t;)n=` ${n}`;return n}(t,a),a}return function(e){let n,t="",a=o;for(;null!==(n=l.exec(a));){const i=n[1],o=n[2],r=n[3],s=n[5],c=n[6];if(c)t+=c.toString();else{t+=m(f(r,e,s),o,i)}a=a.slice(n.index+n[0].length)}return t}}const b={messagePassThrough:()=>f,basic:()=>u,colored:()=>d,coloured:()=>d,pattern:e=>x(e&&e.pattern,e&&e.tokens),dummy:()=>v};return Os={basicLayout:u,messagePassThroughLayout:f,patternLayout:x,colouredLayout:d,coloredLayout:d,dummyLayout:v,addLayout(e,n){b[e]=n},layout:(e,n)=>b[e]&&b[e](n)}}function Ns(){if(As)return _s;As=1;const e=Es(),n=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class t{constructor(e,n,t){this.level=e,this.levelStr=n,this.colour=t}toString(){return this.levelStr}static getLevel(e,n){return e?e instanceof t?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),t[e.toString().toUpperCase()]||n):n}static addLevels(e){if(e){Object.keys(e).forEach((n=>{const a=n.toUpperCase();t[a]=new t(e[n].value,a,e[n].colour);const i=t.levels.findIndex((e=>e.levelStr===a));i>-1?t.levels[i]=t[a]:t.levels.push(t[a])})),t.levels.sort(((e,n)=>e.level-n.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level===e.level}}return t.levels=[],t.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),e.addListener((t=>{const a=t.levels;if(a){e.throwExceptionIf(t,e.not(e.anObject(a)),"levels must be an object");Object.keys(a).forEach((i=>{e.throwExceptionIf(t,e.not(e.validIdentifier(i)),`level name "${i}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),e.throwExceptionIf(t,e.not(e.anObject(a[i])),`level "${i}" must be an object`),e.throwExceptionIf(t,e.not(a[i].value),`level "${i}" must have a 'value' property`),e.throwExceptionIf(t,e.not(e.anInteger(a[i].value)),`level "${i}".value must have an integer value`),e.throwExceptionIf(t,e.not(a[i].colour),`level "${i}" must have a 'colour' property`),e.throwExceptionIf(t,e.not(n.indexOf(a[i].colour)>-1),`level "${i}".colour must be one of ${n.join(", ")}`)}))}})),e.addListener((e=>{t.addLevels(e.levels)})),_s=t}var Is,Ls,Ms,Ds,Bs,qs={exports:{}},Rs={};function zs(){if(Ms)return Ls;Ms=1;const e=function(){if(Is)return Rs;Is=1;const{parse:e,stringify:n}=JSON,{keys:t}=Object,a=String,i="string",o={},r="object",s=(e,n)=>n,c=e=>e instanceof a?a(e):e,p=(e,n)=>typeof n===i?new a(n):n,l=(e,n,i,s)=>{const c=[];for(let p=t(i),{length:l}=p,u=0;u<l;u++){const t=p[u],l=i[t];if(l instanceof a){const a=e[l];typeof a!==r||n.has(a)?i[t]=s.call(i,t,a):(n.add(a),i[t]=o,c.push({k:t,a:[e,n,a,s]}))}else i[t]!==o&&(i[t]=s.call(i,t,l))}for(let{length:e}=c,n=0;n<e;n++){const{k:e,a:t}=c[n];i[e]=s.call(i,e,l.apply(null,t))}return i},u=(e,n,t)=>{const i=a(n.push(t)-1);return e.set(t,i),i},d=(n,t)=>{const a=e(n,p).map(c),i=a[0],o=t||s,u=typeof i===r&&i?l(a,new Set,i,o):i;return o.call({"":u},"",u)};Rs.parse=d;const f=(e,t,a)=>{const o=t&&typeof t===r?(e,n)=>""===e||-1<t.indexOf(e)?n:void 0:t||s,c=new Map,p=[],l=[];let d=+u(c,p,o.call({"":e},"",e)),f=!d;for(;d<p.length;)f=!0,l[d]=n(p[d++],m,a);return"["+l.join(",")+"]";function m(e,n){if(f)return f=!f,n;const t=o.call(this,e,n);switch(typeof t){case r:if(null===t)return t;case i:return c.get(t)||u(c,p,t)}return t}};return Rs.stringify=f,Rs.toJSON=n=>e(f(n)),Rs.fromJSON=e=>d(n(e)),Rs}(),n=Ns();const t=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const n=this.deMap[e];this.serMap[n]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};class a{constructor(e,n,t,a,i,o){if(this.startTime=new Date,this.categoryName=e,this.data=t,this.level=n,this.context=Object.assign({},a),this.pid=process.pid,this.error=o,void 0!==i){if(!i||"object"!=typeof i||Array.isArray(i))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==i[e]&&(this[e]=i[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return e.stringify(this,((e,n)=>(n instanceof Error&&(n=Object.assign({message:n.message,stack:n.stack},n)),t.serialise(n))))}static deserialise(i){let o;try{const r=e.parse(i,((e,n)=>{if(n&&n.message&&n.stack){const e=new Error(n);Object.keys(n).forEach((t=>{e[t]=n[t]})),n=e}return t.deserialise(n)}));this._getLocationKeys().forEach((e=>{void 0!==r[e]&&(r.location||(r.location={}),r.location[e]=r[e])})),o=new a(r.categoryName,n.getLevel(r.level.levelStr),r.data,r.context,r.location,r.error),o.startTime=new Date(r.startTime),o.pid=r.pid,r.cluster&&(o.cluster=r.cluster)}catch(e){o=new a("log4js",n.ERROR,["Unable to parse log:",i,"because: ",e])}return o}}return Ls=a}function $s(){if(Bs)return Ds;Bs=1;const e=Ss()("log4js:clustering"),n=zs(),t=Es();let a=!1,i=null;try{i=require("cluster")}catch(n){e("cluster module not present"),a=!0}const o=[];let r=!1,s="NODE_APP_INSTANCE";const c=()=>r&&"0"===process.env[s],p=()=>a||i&&i.isMaster||c(),l=e=>{o.forEach((n=>n(e)))},u=(t,a)=>{if(e("cluster message received from worker ",t,": ",a),t.topic&&t.data&&(a=t,t=void 0),a&&a.topic&&"log4js:message"===a.topic){e("received message: ",a.data);const t=n.deserialise(a.data);l(t)}};return a||t.addListener((n=>{o.length=0,({pm2:r,disableClustering:a,pm2InstanceVar:s="NODE_APP_INSTANCE"}=n),e(`clustering disabled ? ${a}`),e(`cluster.isMaster ? ${i&&i.isMaster}`),e(`pm2 enabled ? ${r}`),e(`pm2InstanceVar = ${s}`),e(`process.env[${s}] = ${process.env[s]}`),r&&process.removeListener("message",u),i&&i.removeListener&&i.removeListener("message",u),a||n.disableClustering?e("Not listening for cluster messages, because clustering disabled."):c()?(e("listening for PM2 broadcast messages"),process.on("message",u)):i&&i.isMaster?(e("listening for cluster messages"),i.on("message",u)):e("not listening for messages, because we are not a master process")})),Ds={onlyOnMaster:(e,n)=>p()?e():n,isMaster:p,send:e=>{p()?l(e):(r||(e.cluster={workerId:i.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{o.push(e)}}}var Us,Ws={};function Gs(){if(Us)return Ws;function e(e){if("number"==typeof e&&Number.isInteger(e))return e;const n={K:1024,M:1048576,G:1073741824},t=Object.keys(n),a=e.slice(-1).toLocaleUpperCase(),i=e.slice(0,-1).trim();if(t.indexOf(a)<0||!Number.isInteger(Number(i)))throw Error(`maxLogSize: "${e}" is invalid`);return i*n[a]}function n(n){return function(e,n){const t=Object.assign({},n);return Object.keys(e).forEach((a=>{t[a]&&(t[a]=e[a](n[a]))})),t}({maxLogSize:e},n)}Us=1;const t={dateFile:n,file:n,fileSync:n};return Ws.modifyConfig=e=>t[e.type]?t[e.type](e):e,Ws}var Hs,Js={};function Ks(){if(Hs)return Js;Hs=1;const e=console.log.bind(console);return Js.configure=function(n,t){let a=t.colouredLayout;return n.layout&&(a=t.layout(n.layout.type,n.layout)),function(n,t){return a=>{e(n(a,t))}}(a,n.timezoneOffset)},Js}var Vs,Zs={};function Qs(){if(Vs)return Zs;return Vs=1,Zs.configure=function(e,n){let t=n.colouredLayout;return e.layout&&(t=n.layout(e.layout.type,e.layout)),function(e,n){return t=>{process.stdout.write(`${e(t,n)}\n`)}}(t,e.timezoneOffset)},Zs}var Ys,Xs={};function ec(){if(Ys)return Xs;return Ys=1,Xs.configure=function(e,n){let t=n.colouredLayout;return e.layout&&(t=n.layout(e.layout.type,e.layout)),function(e,n){return t=>{process.stderr.write(`${e(t,n)}\n`)}}(t,e.timezoneOffset)},Xs}var nc,tc={};var ac,ic={};function oc(){if(ac)return ic;ac=1;const e=Ss()("log4js:categoryFilter");return ic.configure=function(n,t,a){const i=a(n.appender);return function(n,t){return"string"==typeof n&&(n=[n]),a=>{e(`Checking ${a.categoryName} against ${n}`),-1===n.indexOf(a.categoryName)&&(e("Not excluded, sending to appender"),t(a))}}(n.exclude,i)},ic}var rc,sc={};function cc(){if(rc)return sc;rc=1;const e=Ss()("log4js:noLogFilter");return sc.configure=function(n,t,a){const i=a(n.appender);return function(n,t){return a=>{e(`Checking data: ${a.data} against filters: ${n}`),"string"==typeof n&&(n=[n]),n=n.filter((e=>null!=e&&""!==e));const i=new RegExp(n.join("|"),"i");(0===n.length||a.data.findIndex((e=>i.test(e)))<0)&&(e("Not excluded, sending to appender"),t(a))}}(n.exclude,i)},sc}var pc,lc,uc,dc,fc,mc,hc,vc,xc,bc,yc,gc,wc,Sc,kc,Ec,jc,Oc,Cc,_c,Ac,Fc,Tc,Pc,Nc,Ic,Lc,Mc,Dc,Bc,qc,Rc,zc,$c,Uc,Wc,Gc,Hc,Jc,Kc,Vc,Zc,Qc,Yc,Xc,ep,np,tp,ap,ip,op,rp,sp,cp,pp,lp,up,dp,fp,mp,hp,vp,xp,bp,yp,gp,wp,Sp,kp,Ep,jp,Op,Cp,_p,Ap,Fp,Tp,Pp,Np,Ip,Lp,Mp,Dp,Bp,qp,Rp,zp,$p,Up,Wp,Gp={},Hp={exports:{}},Jp={},Kp={};function Vp(){return pc||(pc=1,Kp.fromCallback=function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((n,t)=>{arguments[arguments.length]=(e,a)=>{if(e)return t(e);n(a)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},Kp.fromPromise=function(e){return Object.defineProperty((function(){const n=arguments[arguments.length-1];if("function"!=typeof n)return e.apply(this,arguments);e.apply(this,arguments).then((e=>n(null,e)),n)}),"name",{value:e.name})}),Kp}function Zp(){if(uc)return lc;uc=1;var e=g,n=process.cwd,t=null,a=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return t||(t=n.call(process)),t};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var i=process.chdir;process.chdir=function(e){t=null,i.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,i)}return lc=function(n){e.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(n){n.lchmod=function(t,a,i){n.open(t,e.O_WRONLY|e.O_SYMLINK,a,(function(e,t){e?i&&i(e):n.fchmod(t,a,(function(e){n.close(t,(function(n){i&&i(e||n)}))}))}))},n.lchmodSync=function(t,a){var i,o=n.openSync(t,e.O_WRONLY|e.O_SYMLINK,a),r=!0;try{i=n.fchmodSync(o,a),r=!1}finally{if(r)try{n.closeSync(o)}catch(e){}else n.closeSync(o)}return i}}(n);n.lutimes||function(n){e.hasOwnProperty("O_SYMLINK")&&n.futimes?(n.lutimes=function(t,a,i,o){n.open(t,e.O_SYMLINK,(function(e,t){e?o&&o(e):n.futimes(t,a,i,(function(e){n.close(t,(function(n){o&&o(e||n)}))}))}))},n.lutimesSync=function(t,a,i){var o,r=n.openSync(t,e.O_SYMLINK),s=!0;try{o=n.futimesSync(r,a,i),s=!1}finally{if(s)try{n.closeSync(r)}catch(e){}else n.closeSync(r)}return o}):n.futimes&&(n.lutimes=function(e,n,t,a){a&&process.nextTick(a)},n.lutimesSync=function(){})}(n);n.chown=o(n.chown),n.fchown=o(n.fchown),n.lchown=o(n.lchown),n.chmod=t(n.chmod),n.fchmod=t(n.fchmod),n.lchmod=t(n.lchmod),n.chownSync=r(n.chownSync),n.fchownSync=r(n.fchownSync),n.lchownSync=r(n.lchownSync),n.chmodSync=i(n.chmodSync),n.fchmodSync=i(n.fchmodSync),n.lchmodSync=i(n.lchmodSync),n.stat=s(n.stat),n.fstat=s(n.fstat),n.lstat=s(n.lstat),n.statSync=c(n.statSync),n.fstatSync=c(n.fstatSync),n.lstatSync=c(n.lstatSync),n.chmod&&!n.lchmod&&(n.lchmod=function(e,n,t){t&&process.nextTick(t)},n.lchmodSync=function(){});n.chown&&!n.lchown&&(n.lchown=function(e,n,t,a){a&&process.nextTick(a)},n.lchownSync=function(){});"win32"===a&&(n.rename="function"!=typeof n.rename?n.rename:function(e){function t(t,a,i){var o=Date.now(),r=0;e(t,a,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){n.stat(a,(function(n,o){n&&"ENOENT"===n.code?e(t,a,s):i(c)}))}),r),void(r<100&&(r+=10));i&&i(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(n.rename));function t(e){return e?function(t,a,i){return e.call(n,t,a,(function(e){p(e)&&(e=null),i&&i.apply(this,arguments)}))}:e}function i(e){return e?function(t,a){try{return e.call(n,t,a)}catch(e){if(!p(e))throw e}}:e}function o(e){return e?function(t,a,i,o){return e.call(n,t,a,i,(function(e){p(e)&&(e=null),o&&o.apply(this,arguments)}))}:e}function r(e){return e?function(t,a,i){try{return e.call(n,t,a,i)}catch(e){if(!p(e))throw e}}:e}function s(e){return e?function(t,a,i){function o(e,n){n&&(n.uid<0&&(n.uid+=4294967296),n.gid<0&&(n.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof a&&(i=a,a=null),a?e.call(n,t,a,o):e.call(n,t,o)}:e}function c(e){return e?function(t,a){var i=a?e.call(n,t,a):e.call(n,t);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:e}function p(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}n.read="function"!=typeof n.read?n.read:function(e){function t(t,a,i,o,r,s){var c;if(s&&"function"==typeof s){var p=0;c=function(l,u,d){if(l&&"EAGAIN"===l.code&&p<10)return p++,e.call(n,t,a,i,o,r,c);s.apply(this,arguments)}}return e.call(n,t,a,i,o,r,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(n.read),n.readSync="function"!=typeof n.readSync?n.readSync:(l=n.readSync,function(e,t,a,i,o){for(var r=0;;)try{return l.call(n,e,t,a,i,o)}catch(e){if("EAGAIN"===e.code&&r<10){r++;continue}throw e}});var l},lc}function Qp(){if(xc)return vc;xc=1;var e,t,a=n,i=Zp(),o=function(){if(fc)return dc;fc=1;var e=d.Stream;return dc=function(n){return{ReadStream:function t(a,i){if(!(this instanceof t))return new t(a,i);e.call(this);var o=this;this.path=a,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,i=i||{};for(var r=Object.keys(i),s=0,c=r.length;s<c;s++){var p=r[s];this[p]=i[p]}if(this.encoding&&this.setEncoding(this.encoding),void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}null===this.fd?n.open(this.path,this.flags,this.mode,(function(e,n){if(e)return o.emit("error",e),void(o.readable=!1);o.fd=n,o.emit("open",n),o._read()})):process.nextTick((function(){o._read()}))},WriteStream:function t(a,i){if(!(this instanceof t))return new t(a,i);e.call(this),this.path=a,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),r=0,s=o.length;r<s;r++){var c=o[r];this[c]=i[c]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=n.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}},dc}(),r=function(){if(hc)return mc;hc=1,mc=function(n){if(null===n||"object"!=typeof n)return n;if(n instanceof Object)var t={__proto__:e(n)};else t=Object.create(null);return Object.getOwnPropertyNames(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t};var e=Object.getPrototypeOf||function(e){return e.__proto__};return mc}(),s=m;function c(n,t){Object.defineProperty(n,e,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(e=Symbol.for("graceful-fs.queue"),t=Symbol.for("graceful-fs.previous")):(e="___graceful-fs.queue",t="___graceful-fs.previous");var p,l=function(){};if(s.debuglog?l=s.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(l=function(){var e=s.format.apply(s,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!a[e]){var u=H[e]||[];c(a,u),a.close=function(e){function n(n,t){return e.call(a,n,(function(e){e||v(),"function"==typeof t&&t.apply(this,arguments)}))}return Object.defineProperty(n,t,{value:e}),n}(a.close),a.closeSync=function(e){function n(n){e.apply(a,arguments),v()}return Object.defineProperty(n,t,{value:e}),n}(a.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){l(a[e]),w.equal(a[e].length,0)}))}function f(e){i(e),e.gracefulify=f,e.createReadStream=function(n,t){return new e.ReadStream(n,t)},e.createWriteStream=function(n,t){return new e.WriteStream(n,t)};var n=e.readFile;e.readFile=function(e,t,a){"function"==typeof t&&(a=t,t=null);return function e(t,a,i,o){return n(t,a,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof i&&i.apply(this,arguments):h([e,[t,a,i],n,o||Date.now(),Date.now()])}))}(e,t,a)};var t=e.writeFile;e.writeFile=function(e,n,a,i){"function"==typeof a&&(i=a,a=null);return function e(n,a,i,o,r){return t(n,a,i,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof o&&o.apply(this,arguments):h([e,[n,a,i,o],t,r||Date.now(),Date.now()])}))}(e,n,a,i)};var a=e.appendFile;a&&(e.appendFile=function(e,n,t,i){"function"==typeof t&&(i=t,t=null);return function e(n,t,i,o,r){return a(n,t,i,(function(a){!a||"EMFILE"!==a.code&&"ENFILE"!==a.code?"function"==typeof o&&o.apply(this,arguments):h([e,[n,t,i,o],a,r||Date.now(),Date.now()])}))}(e,n,t,i)});var r=e.copyFile;r&&(e.copyFile=function(e,n,t,a){"function"==typeof t&&(a=t,t=0);return function e(n,t,a,i,o){return r(n,t,a,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof i&&i.apply(this,arguments):h([e,[n,t,a,i],r,o||Date.now(),Date.now()])}))}(e,n,t,a)});var s=e.readdir;e.readdir=function(e,n,t){"function"==typeof n&&(t=n,n=null);var a=c.test(process.version)?function(e,n,t,a){return s(e,i(e,n,t,a))}:function(e,n,t,a){return s(e,n,i(e,n,t,a))};return a(e,n,t);function i(e,n,t,i){return function(o,r){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(r&&r.sort&&r.sort(),"function"==typeof t&&t.call(this,o,r)):h([a,[e,n,t],o,i||Date.now(),Date.now()])}}};var c=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var p=o(e);v=p.ReadStream,x=p.WriteStream}var l=e.ReadStream;l&&(v.prototype=Object.create(l.prototype),v.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(n,t){n?(e.autoClose&&e.destroy(),e.emit("error",n)):(e.fd=t,e.emit("open",t),e.read())}))});var u=e.WriteStream;u&&(x.prototype=Object.create(u.prototype),x.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(n,t){n?(e.destroy(),e.emit("error",n)):(e.fd=t,e.emit("open",t))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return v},set:function(e){v=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0});var d=v;Object.defineProperty(e,"FileReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var m=x;function v(e,n){return this instanceof v?(l.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function x(e,n){return this instanceof x?(u.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return m},set:function(e){m=e},enumerable:!0,configurable:!0});var b=e.open;function y(e,n,t,a){return"function"==typeof t&&(a=t,t=null),function e(n,t,a,i,o){return b(n,t,a,(function(r,s){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof i&&i.apply(this,arguments):h([e,[n,t,a,i],r,o||Date.now(),Date.now()])}))}(e,n,t,a)}return e.open=y,e}function h(n){l("ENQUEUE",n[0].name,n[1]),a[e].push(n),x()}function v(){for(var n=Date.now(),t=0;t<a[e].length;++t)a[e][t].length>2&&(a[e][t][3]=n,a[e][t][4]=n);x()}function x(){if(clearTimeout(p),p=void 0,0!==a[e].length){var n=a[e].shift(),t=n[0],i=n[1],o=n[2],r=n[3],s=n[4];if(void 0===r)l("RETRY",t.name,i),t.apply(null,i);else if(Date.now()-r>=6e4){l("TIMEOUT",t.name,i);var c=i.pop();"function"==typeof c&&c.call(null,o)}else{var u=Date.now()-s,d=Math.max(s-r,1);u>=Math.min(1.2*d,100)?(l("RETRY",t.name,i),t.apply(null,i.concat([r]))):a[e].push(n)}void 0===p&&(p=setTimeout(x,0))}}return H[e]||c(H,a[e]),vc=f(r(a)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!a.__patched&&(vc=f(a),a.__patched=!0),vc}function Yp(){return bc||(bc=1,function(e){const n=Vp().fromCallback,t=Qp(),a=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof t[e]));Object.keys(t).forEach((n=>{"promises"!==n&&(e[n]=t[n])})),a.forEach((a=>{e[a]=n(t[a])})),e.exists=function(e,n){return"function"==typeof n?t.exists(e,n):new Promise((n=>t.exists(e,n)))},e.read=function(e,n,a,i,o,r){return"function"==typeof r?t.read(e,n,a,i,o,r):new Promise(((r,s)=>{t.read(e,n,a,i,o,((e,n,t)=>{if(e)return s(e);r({bytesRead:n,buffer:t})}))}))},e.write=function(e,n,...a){return"function"==typeof a[a.length-1]?t.write(e,n,...a):new Promise(((i,o)=>{t.write(e,n,...a,((e,n,t)=>{if(e)return o(e);i({bytesWritten:n,buffer:t})}))}))},"function"==typeof t.realpath.native&&(e.realpath.native=n(t.realpath.native))}(Jp)),Jp}function Xp(){if(gc)return yc;gc=1;const e=o;function n(n){return(n=e.normalize(e.resolve(n)).split(e.sep)).length>0?n[0]:null}const t=/[<>:"|?*]/;return yc={getRootPath:n,invalidWin32Path:function(e){const a=n(e);return e=e.replace(a,""),t.test(e)}}}function el(){if(Oc)return jc;Oc=1;const e=(0,Vp().fromCallback)(function(){if(Sc)return wc;Sc=1;const e=Qp(),n=o,t=Xp().invalidWin32Path,a=parseInt("0777",8);return wc=function i(o,r,s,c){if("function"==typeof r?(s=r,r={}):r&&"object"==typeof r||(r={mode:r}),"win32"===process.platform&&t(o)){const e=new Error(o+" contains invalid WIN32 path characters.");return e.code="EINVAL",s(e)}let p=r.mode;const l=r.fs||e;void 0===p&&(p=a&~process.umask()),c||(c=null),s=s||function(){},o=n.resolve(o),l.mkdir(o,p,(e=>{if(!e)return s(null,c=c||o);if("ENOENT"===e.code){if(n.dirname(o)===o)return s(e);i(n.dirname(o),r,((e,n)=>{e?s(e,n):i(o,r,s,n)}))}else l.stat(o,((n,t)=>{n||!t.isDirectory()?s(e,c):s(null,c)}))}))},wc}()),n=function(){if(Ec)return kc;Ec=1;const e=Qp(),n=o,t=Xp().invalidWin32Path,a=parseInt("0777",8);return kc=function i(o,r,s){r&&"object"==typeof r||(r={mode:r});let c=r.mode;const p=r.fs||e;if("win32"===process.platform&&t(o)){const e=new Error(o+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===c&&(c=a&~process.umask()),s||(s=null),o=n.resolve(o);try{p.mkdirSync(o,c),s=s||o}catch(e){if("ENOENT"===e.code){if(n.dirname(o)===o)throw e;s=i(n.dirname(o),r,s),i(o,r,s)}else{let n;try{n=p.statSync(o)}catch(n){throw e}if(!n.isDirectory())throw e}}return s},kc}();return jc={mkdirs:e,mkdirsSync:n,mkdirp:e,mkdirpSync:n,ensureDir:e,ensureDirSync:n}}function nl(){if(_c)return Cc;_c=1;const e=Qp(),n=h,t=o;return Cc={hasMillisRes:function(a){let i=t.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));i=t.join(n.tmpdir(),i);const o=new Date(1435410243862);e.writeFile(i,"https://github.com/jprichardson/node-fs-extra/pull/141",(n=>{if(n)return a(n);e.open(i,"r+",((n,t)=>{if(n)return a(n);e.futimes(t,o,o,(n=>{if(n)return a(n);e.close(t,(n=>{if(n)return a(n);e.stat(i,((e,n)=>{if(e)return a(e);a(null,n.mtime>1435410243e3)}))}))}))}))}))},hasMillisResSync:function(){let a=t.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));a=t.join(n.tmpdir(),a);const i=new Date(1435410243862);e.writeFileSync(a,"https://github.com/jprichardson/node-fs-extra/pull/141");const o=e.openSync(a,"r+");return e.futimesSync(o,i,i),e.closeSync(o),e.statSync(a).mtime>1435410243e3},timeRemoveMillis:function(e){if("number"==typeof e)return 1e3*Math.floor(e/1e3);if(e instanceof Date)return new Date(1e3*Math.floor(e.getTime()/1e3));throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")},utimesMillis:function(n,t,a,i){e.open(n,"r+",((n,o)=>{if(n)return i(n);e.futimes(o,t,a,(n=>{e.close(o,(e=>{i&&i(n||e)}))}))}))},utimesMillisSync:function(n,t,a){const i=e.openSync(n,"r+");return e.futimesSync(i,t,a),e.closeSync(i)}}}function tl(){if(Fc)return Ac;Fc=1;const e=Qp(),n=o,t=process.versions.node.split("."),a=Number.parseInt(t[0],10),i=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);function s(){if(a>10)return!0;if(10===a){if(i>5)return!0;if(5===i&&r>=0)return!0}return!1}function c(e,t){const a=n.resolve(e).split(n.sep).filter((e=>e)),i=n.resolve(t).split(n.sep).filter((e=>e));return a.reduce(((e,n,t)=>e&&i[t]===n),!0)}function p(e,n,t){return`Cannot ${t} '${e}' to a subdirectory of itself, '${n}'.`}return Ac={checkPaths:function(n,t,a,i){!function(n,t,a){s()?e.stat(n,{bigint:!0},((n,i)=>{if(n)return a(n);e.stat(t,{bigint:!0},((e,n)=>e?"ENOENT"===e.code?a(null,{srcStat:i,destStat:null}):a(e):a(null,{srcStat:i,destStat:n})))})):e.stat(n,((n,i)=>{if(n)return a(n);e.stat(t,((e,n)=>e?"ENOENT"===e.code?a(null,{srcStat:i,destStat:null}):a(e):a(null,{srcStat:i,destStat:n})))}))}(n,t,((e,o)=>{if(e)return i(e);const{srcStat:r,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===r.ino&&s.dev===r.dev?i(new Error("Source and destination must not be the same.")):r.isDirectory()&&c(n,t)?i(new Error(p(n,t,a))):i(null,{srcStat:r,destStat:s})}))},checkPathsSync:function(n,t,a){const{srcStat:i,destStat:o}=function(n,t){let a,i;a=s()?e.statSync(n,{bigint:!0}):e.statSync(n);try{i=s()?e.statSync(t,{bigint:!0}):e.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:a,destStat:null};throw e}return{srcStat:a,destStat:i}}(n,t);if(o&&o.ino&&o.dev&&o.ino===i.ino&&o.dev===i.dev)throw new Error("Source and destination must not be the same.");if(i.isDirectory()&&c(n,t))throw new Error(p(n,t,a));return{srcStat:i,destStat:o}},checkParentPaths:function t(a,i,o,r,c){const l=n.resolve(n.dirname(a)),u=n.resolve(n.dirname(o));if(u===l||u===n.parse(u).root)return c();s()?e.stat(u,{bigint:!0},((e,n)=>e?"ENOENT"===e.code?c():c(e):n.ino&&n.dev&&n.ino===i.ino&&n.dev===i.dev?c(new Error(p(a,o,r))):t(a,i,u,r,c))):e.stat(u,((e,n)=>e?"ENOENT"===e.code?c():c(e):n.ino&&n.dev&&n.ino===i.ino&&n.dev===i.dev?c(new Error(p(a,o,r))):t(a,i,u,r,c)))},checkParentPathsSync:function t(a,i,o,r){const c=n.resolve(n.dirname(a)),l=n.resolve(n.dirname(o));if(l===c||l===n.parse(l).root)return;let u;try{u=s()?e.statSync(l,{bigint:!0}):e.statSync(l)}catch(e){if("ENOENT"===e.code)return;throw e}if(u.ino&&u.dev&&u.ino===i.ino&&u.dev===i.dev)throw new Error(p(a,o,r));return t(a,i,l,r)},isSrcSubdir:c},Ac}function al(){if(Ic)return Nc;Ic=1;const e=Qp(),n=o,t=el().mkdirsSync,a=nl().utimesMillisSync,i=tl();function r(t,a,o,r){if(!r.filter||r.filter(a,o))return function(t,a,o,r){const p=r.dereference?e.statSync:e.lstatSync,l=p(a);if(l.isDirectory())return function(n,t,a,i,o){if(!t)return function(n,t,a,i){return e.mkdirSync(a),c(t,a,i),e.chmodSync(a,n.mode)}(n,a,i,o);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${i}' with directory '${a}'.`);return c(a,i,o)}(l,t,a,o,r);if(l.isFile()||l.isCharacterDevice()||l.isBlockDevice())return function(n,t,a,i,o){return t?function(n,t,a,i){if(i.overwrite)return e.unlinkSync(a),s(n,t,a,i);if(i.errorOnExist)throw new Error(`'${a}' already exists`)}(n,a,i,o):s(n,a,i,o)}(l,t,a,o,r);if(l.isSymbolicLink())return function(t,a,o,r){let s=e.readlinkSync(a);r.dereference&&(s=n.resolve(process.cwd(),s));if(t){let t;try{t=e.readlinkSync(o)}catch(n){if("EINVAL"===n.code||"UNKNOWN"===n.code)return e.symlinkSync(s,o);throw n}if(r.dereference&&(t=n.resolve(process.cwd(),t)),i.isSrcSubdir(s,t))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${t}'.`);if(e.statSync(o).isDirectory()&&i.isSrcSubdir(t,s))throw new Error(`Cannot overwrite '${t}' with '${s}'.`);return function(n,t){return e.unlinkSync(t),e.symlinkSync(n,t)}(s,o)}return e.symlinkSync(s,o)}(t,a,o,r)}(t,a,o,r)}function s(n,t,i,o){return"function"==typeof e.copyFileSync?(e.copyFileSync(t,i),e.chmodSync(i,n.mode),o.preserveTimestamps?a(i,n.atime,n.mtime):void 0):function(n,t,a,i){const o=65536,r=(Pc?Tc:(Pc=1,Tc=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(n){return new Buffer(e)}return new Buffer(e)}))(o),s=e.openSync(t,"r"),c=e.openSync(a,"w",n.mode);let p=0;for(;p<n.size;){const n=e.readSync(s,r,0,o,p);e.writeSync(c,r,0,n),p+=n}i.preserveTimestamps&&e.futimesSync(c,n.atime,n.mtime);e.closeSync(s),e.closeSync(c)}(n,t,i,o)}function c(t,a,o){e.readdirSync(t).forEach((e=>function(e,t,a,o){const s=n.join(t,e),c=n.join(a,e),{destStat:p}=i.checkPathsSync(s,c,"copy");return r(p,s,c,o)}(e,t,a,o)))}return Nc=function(a,o,s){"function"==typeof s&&(s={filter:s}),(s=s||{}).clobber=!("clobber"in s)||!!s.clobber,s.overwrite="overwrite"in s?!!s.overwrite:s.clobber,s.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:c,destStat:p}=i.checkPathsSync(a,o,"copy");return i.checkParentPathsSync(a,c,o,"copy"),function(a,i,o,s){if(s.filter&&!s.filter(i,o))return;const c=n.dirname(o);e.existsSync(c)||t(c);return r(a,i,o,s)}(p,a,o,s)},Nc}function il(){return Mc?Lc:(Mc=1,Lc={copySync:al()})}function ol(){if(Bc)return Dc;Bc=1;const e=Vp().fromPromise,n=Yp();return Dc={pathExists:e((function(e){return n.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:n.existsSync}}function rl(){if(Rc)return qc;Rc=1;const e=Qp(),n=o,t=el().mkdirs,a=ol().pathExists,i=nl().utimesMillis,r=tl();function s(e,i,o,r,s){const c=n.dirname(o);a(c,((n,a)=>n?s(n):a?p(e,i,o,r,s):void t(c,(n=>n?s(n):p(e,i,o,r,s)))))}function c(e,n,t,a,i,o){Promise.resolve(i.filter(t,a)).then((r=>r?e(n,t,a,i,o):o()),(e=>o(e)))}function p(e,n,t,a,i){return a.filter?c(l,e,n,t,a,i):l(e,n,t,a,i)}function l(n,t,a,i,o){(i.dereference?e.stat:e.lstat)(t,((r,s)=>r?o(r):s.isDirectory()?function(n,t,a,i,o,r){if(!t)return function(n,t,a,i,o){e.mkdir(a,(r=>{if(r)return o(r);f(t,a,i,(t=>t?o(t):e.chmod(a,n.mode,o)))}))}(n,a,i,o,r);if(t&&!t.isDirectory())return r(new Error(`Cannot overwrite non-directory '${i}' with directory '${a}'.`));return f(a,i,o,r)}(s,n,t,a,i,o):s.isFile()||s.isCharacterDevice()||s.isBlockDevice()?function(n,t,a,i,o,r){return t?function(n,t,a,i,o){if(!i.overwrite)return i.errorOnExist?o(new Error(`'${a}' already exists`)):o();e.unlink(a,(e=>e?o(e):u(n,t,a,i,o)))}(n,a,i,o,r):u(n,a,i,o,r)}(s,n,t,a,i,o):s.isSymbolicLink()?h(n,t,a,i,o):void 0))}function u(n,t,a,i,o){return"function"==typeof e.copyFile?e.copyFile(t,a,(e=>e?o(e):d(n,a,i,o))):function(n,t,a,i,o){const r=e.createReadStream(t);r.on("error",(e=>o(e))).once("open",(()=>{const t=e.createWriteStream(a,{mode:n.mode});t.on("error",(e=>o(e))).on("open",(()=>r.pipe(t))).once("close",(()=>d(n,a,i,o)))}))}(n,t,a,i,o)}function d(n,t,a,o){e.chmod(t,n.mode,(e=>e?o(e):a.preserveTimestamps?i(t,n.atime,n.mtime,o):o()))}function f(n,t,a,i){e.readdir(n,((e,o)=>e?i(e):m(o,n,t,a,i)))}function m(e,t,a,i,o){const s=e.pop();return s?function(e,t,a,i,o,s){const c=n.join(a,t),l=n.join(i,t);r.checkPaths(c,l,"copy",((n,t)=>{if(n)return s(n);const{destStat:r}=t;p(r,c,l,o,(n=>n?s(n):m(e,a,i,o,s)))}))}(e,s,t,a,i,o):o()}function h(t,a,i,o,s){e.readlink(a,((a,c)=>a?s(a):(o.dereference&&(c=n.resolve(process.cwd(),c)),t?void e.readlink(i,((a,p)=>a?"EINVAL"===a.code||"UNKNOWN"===a.code?e.symlink(c,i,s):s(a):(o.dereference&&(p=n.resolve(process.cwd(),p)),r.isSrcSubdir(c,p)?s(new Error(`Cannot copy '${c}' to a subdirectory of itself, '${p}'.`)):t.isDirectory()&&r.isSrcSubdir(p,c)?s(new Error(`Cannot overwrite '${p}' with '${c}'.`)):function(n,t,a){e.unlink(t,(i=>i?a(i):e.symlink(n,t,a)))}(c,i,s)))):e.symlink(c,i,s))))}return qc=function(e,n,t,a){"function"!=typeof t||a?"function"==typeof t&&(t={filter:t}):(a=t,t={}),a=a||function(){},(t=t||{}).clobber=!("clobber"in t)||!!t.clobber,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),r.checkPaths(e,n,"copy",((i,o)=>{if(i)return a(i);const{srcStat:p,destStat:l}=o;r.checkParentPaths(e,p,n,"copy",(i=>i?a(i):t.filter?c(s,l,e,n,t,a):s(l,e,n,t,a)))}))},qc}function sl(){if($c)return zc;$c=1;const e=Vp().fromCallback;return zc={copy:e(rl())}}function cl(){if(Wc)return Uc;Wc=1;const e=Qp(),n=o,t=w,a="win32"===process.platform;function i(n){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{n[t]=n[t]||e[t],n[t+="Sync"]=n[t]||e[t]})),n.maxBusyTries=n.maxBusyTries||3}function r(e,n,a){let o=0;"function"==typeof n&&(a=n,n={}),t(e,"rimraf: missing path"),t.strictEqual(typeof e,"string","rimraf: path should be a string"),t.strictEqual(typeof a,"function","rimraf: callback function required"),t(n,"rimraf: invalid options argument provided"),t.strictEqual(typeof n,"object","rimraf: options should be object"),i(n),s(e,n,(function t(i){if(i){if(("EBUSY"===i.code||"ENOTEMPTY"===i.code||"EPERM"===i.code)&&o<n.maxBusyTries){o++;return setTimeout((()=>s(e,n,t)),100*o)}"ENOENT"===i.code&&(i=null)}a(i)}))}function s(e,n,i){t(e),t(n),t("function"==typeof i),n.lstat(e,((t,o)=>t&&"ENOENT"===t.code?i(null):t&&"EPERM"===t.code&&a?c(e,n,t,i):o&&o.isDirectory()?l(e,n,t,i):void n.unlink(e,(t=>{if(t){if("ENOENT"===t.code)return i(null);if("EPERM"===t.code)return a?c(e,n,t,i):l(e,n,t,i);if("EISDIR"===t.code)return l(e,n,t,i)}return i(t)}))))}function c(e,n,a,i){t(e),t(n),t("function"==typeof i),a&&t(a instanceof Error),n.chmod(e,438,(t=>{t?i("ENOENT"===t.code?null:a):n.stat(e,((t,o)=>{t?i("ENOENT"===t.code?null:a):o.isDirectory()?l(e,n,a,i):n.unlink(e,i)}))}))}function p(e,n,a){let i;t(e),t(n),a&&t(a instanceof Error);try{n.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw a}try{i=n.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw a}i.isDirectory()?d(e,n,a):n.unlinkSync(e)}function l(e,a,i,o){t(e),t(a),i&&t(i instanceof Error),t("function"==typeof o),a.rmdir(e,(s=>{!s||"ENOTEMPTY"!==s.code&&"EEXIST"!==s.code&&"EPERM"!==s.code?s&&"ENOTDIR"===s.code?o(i):o(s):function(e,a,i){t(e),t(a),t("function"==typeof i),a.readdir(e,((t,o)=>{if(t)return i(t);let s,c=o.length;if(0===c)return a.rmdir(e,i);o.forEach((t=>{r(n.join(e,t),a,(n=>{if(!s)return n?i(s=n):void(0==--c&&a.rmdir(e,i))}))}))}))}(e,a,o)}))}function u(e,n){let o;i(n=n||{}),t(e,"rimraf: missing path"),t.strictEqual(typeof e,"string","rimraf: path should be a string"),t(n,"rimraf: missing options"),t.strictEqual(typeof n,"object","rimraf: options should be object");try{o=n.lstatSync(e)}catch(t){if("ENOENT"===t.code)return;"EPERM"===t.code&&a&&p(e,n,t)}try{o&&o.isDirectory()?d(e,n,null):n.unlinkSync(e)}catch(t){if("ENOENT"===t.code)return;if("EPERM"===t.code)return a?p(e,n,t):d(e,n,t);if("EISDIR"!==t.code)throw t;d(e,n,t)}}function d(e,i,o){t(e),t(i),o&&t(o instanceof Error);try{i.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw o;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,i){if(t(e),t(i),i.readdirSync(e).forEach((t=>u(n.join(e,t),i))),!a){return i.rmdirSync(e,i)}{const n=Date.now();do{try{return i.rmdirSync(e,i)}catch(e){}}while(Date.now()-n<500)}}(e,i);else if("ENOENT"!==r.code)throw r}}return Uc=r,r.sync=u,Uc}function pl(){if(Hc)return Gc;Hc=1;const e=Vp().fromCallback,n=cl();return Gc={remove:e(n),removeSync:n.sync}}function ll(){if(Zc)return Vc;Zc=1;const e=Vp().fromCallback,n=o,t=Qp(),a=el(),i=ol().pathExists;return Vc={createFile:e((function(e,o){function r(){t.writeFile(e,"",(e=>{if(e)return o(e);o()}))}t.stat(e,((t,s)=>{if(!t&&s.isFile())return o();const c=n.dirname(e);i(c,((e,n)=>e?o(e):n?r():void a.mkdirs(c,(e=>{if(e)return o(e);r()}))))}))})),createFileSync:function(e){let i;try{i=t.statSync(e)}catch(e){}if(i&&i.isFile())return;const o=n.dirname(e);t.existsSync(o)||a.mkdirsSync(o),t.writeFileSync(e,"")}},Vc}function ul(){if(Yc)return Qc;Yc=1;const e=Vp().fromCallback,n=o,t=Qp(),a=el(),i=ol().pathExists;return Qc={createLink:e((function(e,o,r){function s(e,n){t.link(e,n,(e=>{if(e)return r(e);r(null)}))}i(o,((c,p)=>c?r(c):p?r(null):void t.lstat(e,(t=>{if(t)return t.message=t.message.replace("lstat","ensureLink"),r(t);const c=n.dirname(o);i(c,((n,t)=>n?r(n):t?s(e,o):void a.mkdirs(c,(n=>{if(n)return r(n);s(e,o)}))))}))))})),createLinkSync:function(e,i){if(t.existsSync(i))return;try{t.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const o=n.dirname(i);return t.existsSync(o)||a.mkdirsSync(o),t.linkSync(e,i)}},Qc}function dl(){if(ip)return ap;ip=1;const e=Vp().fromCallback,n=o,t=Qp(),a=el(),i=a.mkdirs,r=a.mkdirsSync,s=function(){if(ep)return Xc;ep=1;const e=o,n=Qp(),t=ol().pathExists;return Xc={symlinkPaths:function(a,i,o){if(e.isAbsolute(a))return n.lstat(a,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),o(e)):o(null,{toCwd:a,toDst:a})));{const r=e.dirname(i),s=e.join(r,a);return t(s,((t,i)=>t?o(t):i?o(null,{toCwd:s,toDst:a}):n.lstat(a,(n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),o(n)):o(null,{toCwd:a,toDst:e.relative(r,a)})))))}},symlinkPathsSync:function(t,a){let i;if(e.isAbsolute(t)){if(i=n.existsSync(t),!i)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}{const o=e.dirname(a),r=e.join(o,t);if(i=n.existsSync(r),i)return{toCwd:r,toDst:t};if(i=n.existsSync(t),!i)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:e.relative(o,t)}}}}}(),c=s.symlinkPaths,p=s.symlinkPathsSync,l=function(){if(tp)return np;tp=1;const e=Qp();return np={symlinkType:function(n,t,a){if(a="function"==typeof t?t:a,t="function"!=typeof t&&t)return a(null,t);e.lstat(n,((e,n)=>{if(e)return a(null,"file");t=n&&n.isDirectory()?"dir":"file",a(null,t)}))},symlinkTypeSync:function(n,t){let a;if(t)return t;try{a=e.lstatSync(n)}catch(e){return"file"}return a&&a.isDirectory()?"dir":"file"}},np}(),u=l.symlinkType,d=l.symlinkTypeSync,f=ol().pathExists;return ap={createSymlink:e((function(e,a,o,r){r="function"==typeof o?o:r,o="function"!=typeof o&&o,f(a,((s,p)=>s?r(s):p?r(null):void c(e,a,((s,c)=>{if(s)return r(s);e=c.toDst,u(c.toCwd,o,((o,s)=>{if(o)return r(o);const c=n.dirname(a);f(c,((n,o)=>n?r(n):o?t.symlink(e,a,s,r):void i(c,(n=>{if(n)return r(n);t.symlink(e,a,s,r)}))))}))}))))})),createSymlinkSync:function(e,a,i){if(t.existsSync(a))return;const o=p(e,a);e=o.toDst,i=d(o.toCwd,i);const s=n.dirname(a);return t.existsSync(s)||r(s),t.symlinkSync(e,a,i)}},ap}function fl(){if(lp)return pp;lp=1;const e=Vp().fromCallback,t=function(){if(cp)return sp;var e;cp=1;try{e=Qp()}catch(t){e=n}function t(e,n){var t,a="\n";return"object"==typeof n&&null!==n&&(n.spaces&&(t=n.spaces),n.EOL&&(a=n.EOL)),JSON.stringify(e,n?n.replacer:null,t).replace(/\n/g,a)+a}function a(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}var i={readFile:function(n,t,i){null==i&&(i=t,t={}),"string"==typeof t&&(t={encoding:t});var o=(t=t||{}).fs||e,r=!0;"throws"in t&&(r=t.throws),o.readFile(n,t,(function(e,o){if(e)return i(e);var s;o=a(o);try{s=JSON.parse(o,t?t.reviver:null)}catch(e){return r?(e.message=n+": "+e.message,i(e)):i(null,null)}i(null,s)}))},readFileSync:function(n,t){"string"==typeof(t=t||{})&&(t={encoding:t});var i=t.fs||e,o=!0;"throws"in t&&(o=t.throws);try{var r=i.readFileSync(n,t);return r=a(r),JSON.parse(r,t.reviver)}catch(e){if(o)throw e.message=n+": "+e.message,e;return null}},writeFile:function(n,a,i,o){null==o&&(o=i,i={});var r=(i=i||{}).fs||e,s="";try{s=t(a,i)}catch(e){return void(o&&o(e,null))}r.writeFile(n,s,i,o)},writeFileSync:function(n,a,i){var o=(i=i||{}).fs||e,r=t(a,i);return o.writeFileSync(n,r,i)}};return sp=i}();return pp={readJson:e(t.readFile),readJsonSync:t.readFileSync,writeJson:e(t.writeFile),writeJsonSync:t.writeFileSync}}function ml(){if(vp)return hp;vp=1;const e=Vp().fromCallback,n=fl();return n.outputJson=e(function(){if(dp)return up;dp=1;const e=o,n=el(),t=ol().pathExists,a=fl();return up=function(i,o,r,s){"function"==typeof r&&(s=r,r={});const c=e.dirname(i);t(c,((e,t)=>e?s(e):t?a.writeJson(i,o,r,s):void n.mkdirs(c,(e=>{if(e)return s(e);a.writeJson(i,o,r,s)}))))},up}()),n.outputJsonSync=function(){if(mp)return fp;mp=1;const e=Qp(),n=o,t=el(),a=fl();return fp=function(i,o,r){const s=n.dirname(i);e.existsSync(s)||t.mkdirsSync(s),a.writeJsonSync(i,o,r)},fp}(),n.outputJSON=n.outputJson,n.outputJSONSync=n.outputJsonSync,n.writeJSON=n.writeJson,n.writeJSONSync=n.writeJsonSync,n.readJSON=n.readJson,n.readJSONSync=n.readJsonSync,hp=n}function hl(){if(bp)return xp;bp=1;const e=Qp(),n=o,t=il().copySync,a=pl().removeSync,i=el().mkdirpSync,r=tl();function s(n,i,o){try{e.renameSync(n,i)}catch(e){if("EXDEV"!==e.code)throw e;return function(e,n,i){const o={overwrite:i,errorOnExist:!0};return t(e,n,o),a(e)}(n,i,o)}}return xp=function(t,o,c){const p=(c=c||{}).overwrite||c.clobber||!1,{srcStat:l}=r.checkPathsSync(t,o,"move");return r.checkParentPathsSync(t,l,o,"move"),i(n.dirname(o)),function(n,t,i){if(i)return a(t),s(n,t,i);if(e.existsSync(t))throw new Error("dest already exists.");return s(n,t,i)}(t,o,p)},xp}function vl(){if(Sp)return wp;Sp=1;const e=Qp(),n=o,t=sl().copy,a=pl().remove,i=el().mkdirp,r=ol().pathExists,s=tl();function c(n,i,o,r){e.rename(n,i,(e=>e?"EXDEV"!==e.code?r(e):function(e,n,i,o){const r={overwrite:i,errorOnExist:!0};t(e,n,r,(n=>n?o(n):a(e,o)))}(n,i,o,r):r()))}return wp=function(e,t,o,p){"function"==typeof o&&(p=o,o={});const l=o.overwrite||o.clobber||!1;s.checkPaths(e,t,"move",((o,u)=>{if(o)return p(o);const{srcStat:d}=u;s.checkParentPaths(e,d,t,"move",(o=>{if(o)return p(o);i(n.dirname(t),(n=>n?p(n):function(e,n,t,i){if(t)return a(n,(a=>a?i(a):c(e,n,t,i)));r(n,((a,o)=>a?i(a):o?i(new Error("dest already exists.")):c(e,n,t,i)))}(e,t,l,p)))}))}))},wp}function xl(){return Cp||(Cp=1,function(e){e.exports=Object.assign({},Yp(),il(),sl(),function(){if(Kc)return Jc;Kc=1;const e=Vp().fromCallback,n=Qp(),t=o,a=el(),i=pl(),r=e((function(e,o){o=o||function(){},n.readdir(e,((n,r)=>{if(n)return a.mkdirs(e,o);r=r.map((n=>t.join(e,n))),function e(){const n=r.pop();if(!n)return o();i.remove(n,(n=>{if(n)return o(n);e()}))}()}))}));function s(e){let o;try{o=n.readdirSync(e)}catch(n){return a.mkdirsSync(e)}o.forEach((n=>{n=t.join(e,n),i.removeSync(n)}))}return Jc={emptyDirSync:s,emptydirSync:s,emptyDir:r,emptydir:r}}(),function(){if(rp)return op;rp=1;const e=ll(),n=ul(),t=dl();return op={createFile:e.createFile,createFileSync:e.createFileSync,ensureFile:e.createFile,ensureFileSync:e.createFileSync,createLink:n.createLink,createLinkSync:n.createLinkSync,ensureLink:n.createLink,ensureLinkSync:n.createLinkSync,createSymlink:t.createSymlink,createSymlinkSync:t.createSymlinkSync,ensureSymlink:t.createSymlink,ensureSymlinkSync:t.createSymlinkSync}}(),ml(),el(),gp?yp:(gp=1,yp={moveSync:hl()}),function(){if(Ep)return kp;Ep=1;const e=Vp().fromCallback;return kp={move:e(vl())}}(),function(){if(Op)return jp;Op=1;const e=Vp().fromCallback,n=Qp(),t=o,a=el(),i=ol().pathExists;return jp={outputFile:e((function(e,o,r,s){"function"==typeof r&&(s=r,r="utf8");const c=t.dirname(e);i(c,((t,i)=>t?s(t):i?n.writeFile(e,o,r,s):void a.mkdirs(c,(t=>{if(t)return s(t);n.writeFile(e,o,r,s)}))))})),outputFileSync:function(e,...i){const o=t.dirname(e);if(n.existsSync(o))return n.writeFileSync(e,...i);a.mkdirsSync(o),n.writeFileSync(e,...i)}},jp}(),ol(),pl());const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Hp)),Hp.exports}function bl(){if(Tp)return Fp;Tp=1;const e=Ss()("streamroller:fileNameFormatter"),n=o;return Fp=({file:t,keepFileExt:a,needsIndex:i,alwaysIncludeDate:o,compress:r,fileNameSep:s})=>{let c=s||".";const p=n.join(t.dir,t.name),l=e=>e+t.ext,u=(e,n,t)=>!i&&t||!n?e:e+c+n,d=(e,n,t)=>(n>0||o)&&t?e+c+t:e,f=(e,n)=>n&&r?e+".gz":e,m=a?[d,u,l,f]:[l,d,u,f];return({date:n,index:t})=>(e(`_formatFileName: date=${n}, index=${t}`),m.reduce(((e,a)=>a(e,t,n)),p))},Fp}function yl(){if(Np)return Pp;Np=1;const e=Ss()("streamroller:fileNameParser"),n=Ts();return Pp=({file:t,keepFileExt:a,pattern:i,fileNameSep:o})=>{let r=o||".";const s="__NOT_MATCHING__";let c=[(n,t)=>n.endsWith(".gz")?(e("it is gzipped"),t.isCompressed=!0,n.slice(0,-3)):n,a?n=>n.startsWith(t.name)&&n.endsWith(t.ext)?(e("it starts and ends with the right things"),n.slice(t.name.length+1,-1*t.ext.length)):s:n=>n.startsWith(t.base)?(e("it starts with the right things"),n.slice(t.base.length+1)):s,i?(t,a)=>{const o=t.split(r);let s=o[o.length-1];e("items: ",o,", indexStr: ",s);let c=t;void 0!==s&&s.match(/^\d+$/)?(c=t.slice(0,-1*(s.length+1)),e(`dateStr is ${c}`),i&&!c&&(c=s,s="0")):s="0";try{const e=n.parse(i,c,new Date(0,0));return n.asString(i,e)!==c?t:(a.index=parseInt(s,10),a.date=c,a.timestamp=e.getTime(),"")}catch(n){return e(`Problem parsing ${c} as ${i}, error was: `,n),t}}:(n,t)=>n.match(/^\d+$/)?(e("it has an index"),t.index=parseInt(n,10),""):n];return e=>{let n={filename:e,index:0,isCompressed:!1};return c.reduce(((e,t)=>t(e,n)),e)?null:n}},Pp}function gl(){if(Lp)return Ip;Lp=1;const e=Ss()("streamroller:moveAndMaybeCompressFile"),n=xl(),t=f;return Ip=async(a,i,o)=>{if(o=function(n){const t={mode:parseInt("0600",8),compress:!1},a=Object.assign({},t,n);return e(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(a)}`),a}(o),a!==i){if(await n.pathExists(a))if(e(`moveAndMaybeCompressFile: moving file from ${a} to ${i} ${o.compress?"with":"without"} compress`),o.compress)await new Promise(((r,s)=>{let c=!1;const p=n.createWriteStream(i,{mode:o.mode,flags:"wx"}).on("open",(()=>{c=!0;const i=n.createReadStream(a).on("open",(()=>{i.pipe(t.createGzip()).pipe(p)})).on("error",(n=>{e(`moveAndMaybeCompressFile: error reading ${a}`,n),p.destroy(n)}))})).on("finish",(()=>{e(`moveAndMaybeCompressFile: finished compressing ${i}, deleting ${a}`),n.unlink(a).then(r).catch((t=>{e(`moveAndMaybeCompressFile: error deleting ${a}, truncating instead`,t),n.truncate(a).then(r).catch((n=>{e(`moveAndMaybeCompressFile: error truncating ${a}`,n),s(n)}))}))})).on("error",(t=>{c?(e(`moveAndMaybeCompressFile: error writing ${i}, deleting`,t),n.unlink(i).then((()=>{s(t)})).catch((n=>{e(`moveAndMaybeCompressFile: error deleting ${i}`,n),s(n)}))):(e(`moveAndMaybeCompressFile: error creating ${i}`,t),s(t))}))})).catch((()=>{}));else{e(`moveAndMaybeCompressFile: renaming ${a} to ${i}`);try{await n.move(a,i,{overwrite:!0})}catch(t){if(e(`moveAndMaybeCompressFile: error renaming ${a} to ${i}`,t),"ENOENT"!==t.code){e("moveAndMaybeCompressFile: trying copy+truncate instead");try{await n.copy(a,i,{overwrite:!0}),await n.truncate(a)}catch(n){e("moveAndMaybeCompressFile: error copy+truncate",n)}}}}}else e("moveAndMaybeCompressFile: source and target are the same, not doing anything")},Ip}function wl(){if(Dp)return Mp;Dp=1;const e=Ss()("streamroller:RollingFileWriteStream"),n=xl(),t=o,a=h,i=Ap?_p:(Ap=1,_p=()=>new Date),r=Ts(),{Writable:s}=d,c=bl(),p=yl(),l=gl();return Mp=class extends s{constructor(n,o){if(e(`constructor: creating RollingFileWriteStream. path=${n}`),"string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(t.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${t.sep}`)&&(n=n.replace("~",a.homedir())),super(o),this.options=this._parseOption(o),this.fileObject=t.parse(n),""===this.fileObject.dir&&(this.fileObject=t.parse(t.join(process.cwd(),n))),this.fileFormatter=c({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize<Number.MAX_SAFE_INTEGER,compress:this.options.compress,keepFileExt:this.options.keepFileExt,fileNameSep:this.options.fileNameSep}),this.fileNameParser=p({file:this.fileObject,keepFileExt:this.options.keepFileExt,pattern:this.options.pattern,fileNameSep:this.options.fileNameSep}),this.state={currentSize:0},this.options.pattern&&(this.state.currentDate=r(this.options.pattern,i())),this.filename=this.fileFormatter({index:0,date:this.state.currentDate}),["a","a+","as","as+"].includes(this.options.flags)&&this._setExistingSizeAndDate(),e(`constructor: create new file ${this.filename}, state=${JSON.stringify(this.state)}`),this._renewWriteStream()}_setExistingSizeAndDate(){try{const e=n.statSync(this.filename);this.state.currentSize=e.size,this.options.pattern&&(this.state.currentDate=r(this.options.pattern,e.mtime))}catch(e){return}}_parseOption(n){const t={maxSize:0,numToKeep:Number.MAX_SAFE_INTEGER,encoding:"utf8",mode:parseInt("0600",8),flags:"a",compress:!1,keepFileExt:!1,alwaysIncludePattern:!1},a=Object.assign({},t,n);if(a.maxSize){if(a.maxSize<=0)throw new Error(`options.maxSize (${a.maxSize}) should be > 0`)}else delete a.maxSize;if(a.numBackups||0===a.numBackups){if(a.numBackups<0)throw new Error(`options.numBackups (${a.numBackups}) should be >= 0`);if(a.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${a.numBackups}) should be < Number.MAX_SAFE_INTEGER`);a.numToKeep=a.numBackups+1}else if(a.numToKeep<=0)throw new Error(`options.numToKeep (${a.numToKeep}) should be > 0`);return e(`_parseOption: creating stream with option=${JSON.stringify(a)}`),a}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(n,t,a){this._shouldRoll().then((()=>{e(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${n}`),this.currentFileStream.write(n,t,(e=>{this.state.currentSize+=n.length,a(e)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(e(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==r(this.options.pattern,i())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return e("_roll: closing the current stream"),new Promise(((e,n)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(n)}))}))}async _moveOldFiles(){const n=await this._getExistingFiles();for(let t=(this.state.currentDate?n.filter((e=>e.date===this.state.currentDate)):n).length;t>=0;t--){e(`_moveOldFiles: i = ${t}`);const n=this.fileFormatter({date:this.state.currentDate,index:t}),a=this.fileFormatter({date:this.state.currentDate,index:t+1}),i={compress:this.options.compress&&0===t,mode:this.options.mode};await l(n,a,i)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?r(this.options.pattern,i()):null,e(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,n)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(n)}))}))}async _getExistingFiles(){const t=await n.readdir(this.fileObject.dir).catch((()=>[]));e(`_getExistingFiles: files=${t}`);const a=t.map((e=>this.fileNameParser(e))).filter((e=>e)),o=e=>(e.timestamp?e.timestamp:i().getTime())-e.index;return a.sort(((e,n)=>o(e)-o(n))),a}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),a=e=>{try{return n.mkdirSync(e,{recursive:!0})}catch(i){if("ENOENT"===i.code)return a(t.dirname(e)),a(e);if("EEXIST"!==i.code&&"EROFS"!==i.code)throw i;try{if(n.statSync(e).isDirectory())return e;throw i}catch(e){throw i}}};a(this.fileObject.dir);const i={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var o,r;n.appendFileSync(e,"",(o={...i},r="flags",o["flag"]=o[r],delete o[r],o)),this.currentFileStream=n.createWriteStream(e,i),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const a=await this._getExistingFiles();if(e(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${a.length}`),e("_clean: existing files are: ",a),this._tooManyFiles(a.length)){const o=a.slice(0,a.length-this.options.numToKeep).map((e=>t.format({dir:this.fileObject.dir,base:e.filename})));await(i=o,e(`deleteFiles: files to delete: ${i}`),Promise.all(i.map((t=>n.unlink(t).catch((n=>{e(`deleteFiles: error when unlinking ${t}, ignoring. Error was ${n}`)}))))))}var i}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}},Mp}function Sl(){if(qp)return Bp;qp=1;const e=wl();return Bp=class extends e{constructor(e,n,t,a){a||(a={}),n&&(a.maxSize=n),a.numBackups||0===a.numBackups||(t||0===t||(t=1),a.numBackups=t),super(e,a),this.backups=a.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}}}function kl(){if(zp)return Rp;zp=1;const e=wl();return Rp=class extends e{constructor(e,n,t){n&&"object"==typeof n&&(t=n,n=null),t||(t={}),n||(n="yyyy-MM-dd"),t.pattern=n,t.numBackups||0===t.numBackups?t.daysToKeep=t.numBackups:(t.daysToKeep||0===t.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):t.daysToKeep=1,t.numBackups=t.daysToKeep),super(e,t),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}}function El(){return Up?$p:(Up=1,$p={RollingFileWriteStream:wl(),RollingFileStream:Sl(),DateRollingFileStream:kl()})}function jl(){if(Wp)return Gp;Wp=1;const e=Ss()("log4js:file"),n=o,t=El(),a=h,i=a.EOL;let r=!1;const s=new Set;function c(){s.forEach((e=>{e.sighupHandler()}))}return Gp.configure=function(o,p){let l=p.basicLayout;return o.layout&&(l=p.layout(o.layout.type,o.layout)),o.mode=o.mode||384,function(o,p,l,u,d,f){if("string"!=typeof o||0===o.length)throw new Error(`Invalid filename: ${o}`);if(o.endsWith(n.sep))throw new Error(`Filename is a directory: ${o}`);function m(e,n,a,i){const o=new t.RollingFileStream(e,n,a,i);return o.on("error",(n=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,n)})),o.on("drain",(()=>{process.emit("log4js:pause",!1)})),o}0===o.indexOf(`~${n.sep}`)&&(o=o.replace("~",a.homedir())),o=n.normalize(o),e("Creating file appender (",o,", ",l,", ",u=u||0===u?u:5,", ",d,", ",f,")");let h=m(o,l,u,d);const v=function(e){if(h.writable){if(!0===d.removeColor){const n=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(n,""):e))}h.write(p(e,f)+i,"utf8")||process.emit("log4js:pause",!0)}};return v.reopen=function(){h.end((()=>{h=m(o,l,u,d)}))},v.sighupHandler=function(){e("SIGHUP handler called."),v.reopen()},v.shutdown=function(e){s.delete(v),0===s.size&&r&&(process.removeListener("SIGHUP",c),r=!1),h.end("","utf-8",e)},s.add(v),r||(process.on("SIGHUP",c),r=!0),v}(o.filename,l,o.maxLogSize,o.backups,o,o.timezoneOffset)},Gp}var Ol,Cl={};function _l(){if(Ol)return Cl;Ol=1;const e=El(),n=h.EOL;function t(t,a,i,o,r){o.maxSize=o.maxLogSize;const s=function(n,t,a){const i=new e.DateRollingFileStream(n,t,a);return i.on("error",(e=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",n,e)})),i.on("drain",(()=>{process.emit("log4js:pause",!1)})),i}(t,a,o),c=function(e){s.writable&&(s.write(i(e,r)+n,"utf8")||process.emit("log4js:pause",!0))};return c.shutdown=function(e){s.end("","utf-8",e)},c}return Cl.configure=function(e,n){let a=n.basicLayout;return e.layout&&(a=n.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,t(e.filename,e.pattern,a,e,e.timezoneOffset)},Cl}var Al,Fl={};function Tl(){if(Al)return Fl;Al=1;const e=Ss()("log4js:fileSync"),t=o,a=n,i=h,r=i.EOL;function s(e,n){const i=e=>{try{return a.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return i(t.dirname(e)),i(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(a.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};i(t.dirname(e)),a.appendFileSync(e,"",{mode:n.mode,flag:n.flags})}class c{constructor(n,t,i,o){if(e("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=n,this.size=t,this.backups=i,this.options=o,this.currentSize=0,this.currentSize=function(e){let n=0;try{n=a.statSync(e).size}catch(n){s(e,o)}return n}(this.filename)}shouldRoll(){return e("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(n){const i=this,o=new RegExp(`^${t.basename(n)}`);function r(e){return o.test(e)}function s(e){return parseInt(e.slice(`${t.basename(n)}.`.length),10)||0}function c(e,n){return s(e)-s(n)}function p(o){const r=s(o);if(e(`Index of ${o} is ${r}`),0===i.backups)a.truncateSync(n,0);else if(r<i.backups){try{a.unlinkSync(`${n}.${r+1}`)}catch(e){}e(`Renaming ${o} -> ${n}.${r+1}`),a.renameSync(t.join(t.dirname(n),o),`${n}.${r+1}`)}}e("Rolling, rolling, rolling"),e("Renaming the old files"),a.readdirSync(t.dirname(n)).filter(r).sort(c).reverse().forEach(p)}write(n,t){const i=this;e("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),e("writing the chunk to the file"),i.currentSize+=n.length,a.appendFileSync(i.filename,n)}}return Fl.configure=function(n,o){let p=o.basicLayout;n.layout&&(p=o.layout(n.layout.type,n.layout));const l={flags:n.flags||"a",encoding:n.encoding||"utf8",mode:n.mode||384};return function(n,o,p,l,u,d){if("string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(t.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${t.sep}`)&&(n=n.replace("~",i.homedir())),n=t.normalize(n),e("Creating fileSync appender (",n,", ",p,", ",l=l||0===l?l:5,", ",u,", ",d,")");const f=function(e,n,t){let i;var o;return n?i=new c(e,n,t,u):(s(o=e,u),i={write(e){a.appendFileSync(o,e)}}),i}(n,p,l);return e=>{f.write(o(e,d)+r)}}(n.filename,p,n.maxLogSize,n.backups,l,n.timezoneOffset)},Fl}var Pl,Nl,Il={};function Ll(){if(Pl)return Il;Pl=1;const e=Ss()("log4js:tcp"),n=v;return Il.configure=function(t,a){e(`configure with config = ${t}`);let i=function(e){return e.serialise()};return t.layout&&(i=a.layout(t.layout.type,t.layout)),function(t,a){let i=!1;const o=[];let r,s=3,c="__LOG4JS__";function p(n){e("Writing log event to socket"),i=r.write(`${a(n)}${c}`,"utf8")}function l(){let n;for(e("emptying buffer");n=o.shift();)p(n)}function u(n){i?p(n):(e("buffering log event because it cannot write at the moment"),o.push(n))}return function a(){e(`appender creating socket to ${t.host||"localhost"}:${t.port||5e3}`),c=`${t.endMsg||"__LOG4JS__"}`,r=n.createConnection(t.port||5e3,t.host||"localhost"),r.on("connect",(()=>{e("socket connected"),l(),i=!0})),r.on("drain",(()=>{e("drain event received, emptying buffer"),i=!0,l()})),r.on("timeout",r.end.bind(r)),r.on("error",(n=>{e("connection error",n),i=!1,l()})),r.on("close",a)}(),u.shutdown=function(n){e("shutdown called"),o.length&&s?(e("buffer has items, waiting 100ms to empty"),s-=1,setTimeout((()=>{u.shutdown(n)}),100)):(r.removeAllListeners("close"),r.end(n))},u}(t,i)},Il}function Ml(){if(Nl)return qs.exports;Nl=1;const e=o,n=Ss()("log4js:appenders"),t=Es(),a=$s(),i=Ns(),r=Ps(),s=Gs(),c=new Map;c.set("console",Ks()),c.set("stdout",Qs()),c.set("stderr",ec()),c.set("logLevelFilter",(nc||(nc=1,tc.configure=function(e,n,t,a){const i=t(e.appender);return function(e,n,t,a){const i=a.getLevel(e),o=a.getLevel(n,a.FATAL);return e=>{const n=e.level;i.isLessThanOrEqualTo(n)&&o.isGreaterThanOrEqualTo(n)&&t(e)}}(e.level,e.maxLevel,i,a)}),tc)),c.set("categoryFilter",oc()),c.set("noLogFilter",cc()),c.set("file",jl()),c.set("dateFile",_l()),c.set("fileSync",Tl()),c.set("tcp",Ll());const p=new Map,l=(e,a)=>{let i;try{const t=`${e}.cjs`;i=require.resolve(t),n("Loading module from ",t)}catch(t){i=e,n("Loading module from ",e)}try{return function(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(i)}catch(n){return void t.throwExceptionIf(a,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},u=new Set,d=(e,t)=>{if(p.has(e))return p.get(e);if(!t.appenders[e])return!1;if(u.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);u.add(e),n(`Creating appender ${e}`);const a=f(e,t);return u.delete(e),p.set(e,a),a},f=(o,p)=>{const u=p.appenders[o],f=u.type.configure?u.type:((n,t)=>c.get(n)||l(`./${n}`,t)||l(n,t)||require.main&&require.main.filename&&l(e.join(e.dirname(require.main.filename),n),t)||l(e.join(process.cwd(),n),t))(u.type,p);return t.throwExceptionIf(p,t.not(f),`appender "${o}" is not valid (type "${u.type}" could not be found)`),f.appender&&(process.emitWarning(`Appender ${u.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),n("[log4js-node-DEP0001]",`DEPRECATION: Appender ${u.type} exports an appender function.`)),f.shutdown&&(process.emitWarning(`Appender ${u.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),n("[log4js-node-DEP0002]",`DEPRECATION: Appender ${u.type} exports a shutdown function.`)),n(`${o}: clustering.isMaster ? ${a.isMaster()}`),n(`${o}: appenderModule is ${m.inspect(f)}`),a.onlyOnMaster((()=>(n(`calling appenderModule.configure for ${o} / ${u.type}`),f.configure(s.modifyConfig(u),r,(e=>d(e,p)),i))),(()=>{}))},h=e=>{if(p.clear(),u.clear(),!e)return;const n=[];Object.values(e.categories).forEach((e=>{n.push(...e.appenders)})),Object.keys(e.appenders).forEach((t=>{(n.includes(t)||"tcp-server"===e.appenders[t].type||"multiprocess"===e.appenders[t].type)&&d(t,e)}))},v=()=>{h()};return v(),t.addListener((e=>{t.throwExceptionIf(e,t.not(t.anObject(e.appenders)),'must have a property "appenders" of type object.');const n=Object.keys(e.appenders);t.throwExceptionIf(e,t.not(n.length),"must define at least one appender."),n.forEach((n=>{t.throwExceptionIf(e,t.not(e.appenders[n].type),`appender "${n}" is not valid (must be an object with property "type")`)}))})),t.addListener(h),qs.exports=p,qs.exports.init=v,qs.exports}var Dl,Bl,ql,Rl,zl,$l,Ul,Wl,Gl,Hl={exports:{}};function Jl(){return Dl||(Dl=1,function(e){const n=Ss()("log4js:categories"),t=Es(),a=Ns(),i=Ml(),o=new Map;function r(e,n,t){if(!1===n.inherit)return;const a=t.lastIndexOf(".");if(a<0)return;const i=t.slice(0,a);let o=e.categories[i];o||(o={inherit:!0,appenders:[]}),r(e,o,i),!e.categories[i]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[i]=o),n.appenders=n.appenders||[],n.level=n.level||o.level,o.appenders.forEach((e=>{n.appenders.includes(e)||n.appenders.push(e)})),n.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((n=>{const t=e.categories[n];r(e,t,n)}))}t.addPreProcessingListener((e=>s(e))),t.addListener((e=>{t.throwExceptionIf(e,t.not(t.anObject(e.categories)),'must have a property "categories" of type object.');const n=Object.keys(e.categories);t.throwExceptionIf(e,t.not(n.length),"must define at least one category."),n.forEach((n=>{const o=e.categories[n];t.throwExceptionIf(e,[t.not(o.appenders),t.not(o.level)],`category "${n}" is not valid (must be an object with properties "appenders" and "level")`),t.throwExceptionIf(e,t.not(Array.isArray(o.appenders)),`category "${n}" is not valid (appenders must be an array of appender names)`),t.throwExceptionIf(e,t.not(o.appenders.length),`category "${n}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&t.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${n}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((a=>{t.throwExceptionIf(e,t.not(i.get(a)),`category "${n}" is not valid (appender "${a}" is not defined)`)})),t.throwExceptionIf(e,t.not(a.getLevel(o.level)),`category "${n}" is not valid (level "${o.level}" not recognised; valid levels are ${a.levels.join(", ")})`)})),t.throwExceptionIf(e,t.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((t=>{const r=e.categories[t],s=[];r.appenders.forEach((e=>{s.push(i.get(e)),n(`Creating category ${t}`),o.set(t,{appenders:s,level:a.getLevel(r.level),enableCallStack:r.enableCallStack||!1})}))}))},p=()=>{c()};p(),t.addListener(c);const l=e=>{if(n(`configForCategory: searching for config for ${e}`),o.has(e))return n(`configForCategory: ${e} exists in config, returning it`),o.get(e);let t;return e.indexOf(".")>0?(n(`configForCategory: ${e} has hierarchy, cloning from parents`),t={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),n("configForCategory: cloning default category"),t={...o.get("default")}),o.set(e,t),t};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{l(e).level=n},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,n)=>{l(e).enableCallStack=n},init:p})}(Hl)),Hl.exports}function Kl(){if(zl)return Rl;zl=1;const e=Ns();function n(e){return e.originalUrl||e.url}function t(e,n){for(let t=0;t<n.length;t++)e=e.replace(n[t].token,n[t].replacement);return e}return Rl=function(a,i){i="string"==typeof i||"function"==typeof i?{format:i}:i||{};const o=a;let r=e.getLevel(i.level,e.INFO);const s=i.format||':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"';return(a,c,p)=>{if(void 0!==a._logging)return p();if("function"!=typeof i.nolog){const e=function(e){let n=null;if(e instanceof RegExp&&(n=e),"string"==typeof e&&(n=new RegExp(e)),Array.isArray(e)){const t=e.map((e=>e.source?e.source:e));n=new RegExp(t.join("|"))}return n}(i.nolog);if(e&&e.test(a.originalUrl))return p()}if(o.isLevelEnabled(r)||"auto"===i.level){const p=new Date,{writeHead:l}=c;a._logging=!0,c.writeHead=(e,n)=>{c.writeHead=l,c.writeHead(e,n),c.__statusCode=e,c.__headers=n||{}};let u=!1;const d=()=>{if(u)return;if(u=!0,"function"==typeof i.nolog&&!0===i.nolog(a,c))return void(a._logging=!1);c.responseTime=new Date-p,c.statusCode&&"auto"===i.level&&(r=e.INFO,c.statusCode>=300&&(r=e.WARN),c.statusCode>=400&&(r=e.ERROR)),r=function(n,t,a){let i=t;if(a){const t=a.find((e=>{let t=!1;return t=e.from&&e.to?n>=e.from&&n<=e.to:-1!==e.codes.indexOf(n),t}));t&&(i=e.getLevel(t.level,i))}return i}(c.statusCode,r,i.statusRules);const l=function(e,t,a){const i=[];return i.push({token:":url",replacement:n(e)}),i.push({token:":protocol",replacement:e.protocol}),i.push({token:":hostname",replacement:e.hostname}),i.push({token:":method",replacement:e.method}),i.push({token:":status",replacement:t.__statusCode||t.statusCode}),i.push({token:":response-time",replacement:t.responseTime}),i.push({token:":date",replacement:(new Date).toUTCString()}),i.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),i.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),i.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),i.push({token:":user-agent",replacement:e.headers["user-agent"]}),i.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),i.push({token:/:req\[([^\]]+)]/g,replacement:(n,t)=>e.headers[t.toLowerCase()]}),i.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const n=e.concat();for(let e=0;e<n.length;++e)for(let t=e+1;t<n.length;++t)n[e].token==n[t].token&&n.splice(t--,1);return n})(a.concat(i))}(a,c,i.tokens||[]);if(i.context&&o.addContext("res",c),"function"==typeof s){const e=s(a,c,(e=>t(e,l)));e&&o.log(r,e)}else o.log(r,t(s,l));i.context&&o.removeContext("res")};c.on("end",d),c.on("finish",d),c.on("error",d),c.on("close",d)}return p()}}}function Vl(){if(Ul)return $l;Ul=1;const e=Ss()("log4js:recording"),n=[];function t(){return n.slice()}function a(){n.length=0}return $l={configure:function(){return function(t){e(`received logEvent, number of events now ${n.length+1}`),e("log event was ",t),n.push(t)}},replay:t,playback:t,reset:a,erase:a}}var Zl=function(){if(Gl)return Wl;Gl=1;const e=Ss()("log4js:main"),t=n,a=ks()({proto:!0}),i=Es(),o=Ps(),r=Ns(),s=Ml(),c=Jl(),p=function(){if(ql)return Bl;ql=1;const e=Ss()("log4js:logger"),n=zs(),t=Ns(),a=$s(),i=Jl(),o=Es(),r=/^(?:\s*)at (?:(.+) \()?(?:([^(]+?):(\d+):(\d+))\)?$/;function s(e,n=4){try{const t=e.stack.split("\n").slice(n);if(!t.length)return null;const a=r.exec(t[0]);if(a&&5===a.length){let e="",n="",i="";return a[1]&&""!==a[1]&&([n,i]=a[1].replace(/[[\]]/g,"").split(" as "),i=i||"",n.includes(".")&&([e,n]=n.split("."))),{fileName:a[2],lineNumber:parseInt(a[3],10),columnNumber:parseInt(a[4],10),callStack:t.join("\n"),className:e,functionName:n,functionAlias:i,callerName:a[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}class c{constructor(n){if(!n)throw new Error("No category provided.");this.category=n,this.context={},this.callStackSkipIndex=0,this.parseCallStack=s,e(`Logger created (${this.category}, ${this.level})`)}get level(){return t.getLevel(i.getLevelForCategory(this.category),t.OFF)}set level(e){i.setLevelForCategory(this.category,t.getLevel(e,this.level))}get useCallStack(){return i.getEnableCallStackForCategory(this.category)}set useCallStack(e){i.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...n){const a=t.getLevel(e);a?this.isLevelEnabled(a)&&this._log(a,n):o.validIdentifier(e)&&n.length>0?(this.log(t.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(t.INFO,`[${e}]`,...n)):this.log(t.INFO,e,...n)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(t,i){e(`sending log data (${t}) to appenders`);const o=i.find((e=>e instanceof Error));let r;if(this.useCallStack){try{o&&(r=this.parseCallStack(o,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const s=new n(this.category,t,i,this.context,r,o);a.send(s)}addContext(e,n){this.context[e]=n}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=s}}}function p(e){const n=t.getLevel(e),a=n.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),i=a[0].toUpperCase()+a.slice(1);c.prototype[`is${i}Enabled`]=function(){return this.isLevelEnabled(n)},c.prototype[a]=function(...e){this.log(n,...e)}}return t.levels.forEach(p),o.addListener((()=>{t.levels.forEach(p)})),Bl=c}(),l=$s(),u=Kl(),d=Vl();let f=!1;function m(n){if(!f)return;e("Received log event ",n);c.appendersForCategory(n.categoryName).forEach((e=>{e(n)}))}function h(n){f&&v();let o=n;return"string"==typeof o&&(o=function(n){e(`Loading configuration from ${n}`);try{return JSON.parse(t.readFileSync(n,"utf8"))}catch(e){throw new Error(`Problem reading config from file "${n}". Error was ${e.message}`,e)}}(n)),e(`Configuration is ${o}`),i.configure(a(o)),l.onMessage(m),f=!0,x}function v(n=()=>{}){if("function"!=typeof n)throw new TypeError("Invalid callback passed to shutdown");e("Shutdown called. Disabling all log writing."),f=!1;const t=Array.from(s.values());s.init(),c.init();const a=t.reduce(((e,n)=>n.shutdown?e+1:e),0);0===a&&(e("No appenders with shutdown functions found."),n());let i,o=0;function r(t){i=i||t,o+=1,e(`Appender shutdowns complete: ${o} / ${a}`),o>=a&&(e("All shutdown functions completed."),n(i))}e(`Found ${a} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(r)))}const x={getLogger:function(e){return f||h(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new p(e||"default")},configure:h,isConfigured:function(){return f},shutdown:v,connectLogger:u,levels:r,addLayout:o.addLayout,recording:function(){return d}};return Wl=x}(),Ql=J(Zl);var Yl=function(e){var n=Object.prototype.hasOwnProperty;function t(e,a){return Array.isArray(e)?function(e,n){for(var a,i="",o="",s=Array.isArray(n),c=0;c<e.length;c++)(a=t(e[c]))&&(s&&n[c]&&(a=r(a)),i=i+o+a,o=" ");return i}(e,a):e&&"object"==typeof e?function(e){var t="",a="";for(var i in e)i&&e[i]&&n.call(e,i)&&(t=t+a+i,a=" ");return t}(e):e||""}function a(e){if(!e)return"";if("object"==typeof e){var t="";for(var a in e)n.call(e,a)&&(t=t+a+":"+e[a]+";");return t}return e+""}function i(e,n,t,a){return!1!==n&&null!=n&&(n||"class"!==e&&"style"!==e)?!0===n?" "+(a?e:e+'="'+e+'"'):("function"==typeof n.toJSON&&(n=n.toJSON()),"string"==typeof n||(n=JSON.stringify(n),t||-1===n.indexOf('"'))?(t&&(n=r(n))," "+e+'="'+n+'"'):" "+e+"='"+n.replace(/'/g,"&#39;")+"'"):""}e.merge=function e(n,t){if(1===arguments.length){for(var i=n[0],o=1;o<n.length;o++)i=e(i,n[o]);return i}for(var r in t)if("class"===r){var s=n[r]||[];n[r]=(Array.isArray(s)?s:[s]).concat(t[r]||[])}else if("style"===r){s=(s=a(n[r]))&&";"!==s[s.length-1]?s+";":s;var c=a(t[r]);c=c&&";"!==c[c.length-1]?c+";":c,n[r]=s+c}else n[r]=t[r];return n},e.classes=t,e.style=a,e.attr=i,e.attrs=function(e,o){var r="";for(var s in e)if(n.call(e,s)){var c=e[s];if("class"===s){r=i(s,c=t(c),!1,o)+r;continue}"style"===s&&(c=a(c)),r+=i(s,c,!1,o)}return r};var o=/["&<>]/;function r(e){var n=""+e,t=o.exec(n);if(!t)return e;var a,i,r,s="";for(a=t.index,i=0;a<n.length;a++){switch(n.charCodeAt(a)){case 34:r="&quot;";break;case 38:r="&amp;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}i!==a&&(s+=n.substring(i,a)),i=a+1,s+=r}return i!==a?s+n.substring(i,a):s}return e.escape=r,e.rethrow=function e(n,t,a,i){if(!(n instanceof Error))throw n;if(!("undefined"==typeof window&&t||i))throw n.message+=" on line "+a,n;try{i=i||require("fs").readFileSync(t,"utf8")}catch(t){e(n,null,a)}var o=3,r=i.split("\n"),s=Math.max(a-o,0),c=Math.min(r.length,a+o);o=r.slice(s,c).map((function(e,n){var t=n+s+1;return(t==a?" > ":" ")+t+"| "+e})).join("\n");throw n.path=t,n.message=(t||"Pug")+":"+a+"\n"+o+"\n\n"+n.message,n},e}({});function Xl(e){var n,t,a="";try{var i={},o=e||{};(function(e,t){a+="<!DOCTYPE html>",a+="\n<html>",a+="\n <head>",a+="\n <title>",a+="API Documentation</title>",a+="\n <style>\n ",a+="body { font-family: Arial, sans-serif; margin: 20px; }",a+="\n ",a+="",a+="\n ",a+="h1 { color: #333; text-align: center; }",a+="\n ",a+="h2 { color: #333333 }",a+="\n ",a+="h3 { cursor: pointer; transition: color 0.3s; }",a+="\n ",a+="h3 { color: #007BFF; }",a+="\n ",a+="h3:hover { color: #0056b3; }",a+="\n ",a+="",a+="\n ",a+=".api-section { ",a+="\n ",a+=" margin: 20px 0; ",a+="\n ",a+=" border: 1px solid #e0e0e0; ",a+="\n ",a+=" border-radius: 8px; ",a+="\n ",a+=" padding: 10px; ",a+="\n ",a+=" background-color: #f9f9f9; ",a+="\n ",a+=" box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1); ",a+="\n ",a+="}",a+="\n ",a+="",a+="\n ",a+=".api-method { font-weight: bold; color: #333; }",a+="\n ",a+=".api-path { font-style: italic; color: #555; }",a+="\n ",a+="",a+="\n ",a+="pre { ",a+="\n ",a+=" background: #f4f4f4; ",a+="\n ",a+=" padding: 10px; ",a+="\n ",a+=" border-radius: 5px; ",a+="\n ",a+=" overflow-x: auto; ",a+="\n ",a+="}",a+="\n ",a+="",a+="\n ",a+=".collapse { display: none; }",a+="\n ",a+="\n </style>\n </head>",a+="\n <body>",a+="\n <h1>",a+="API Documentation</h1>",a+="\n \x3c!-- 添加 JavaScript 用于折叠 Sections--\x3e",a+="\n <script>\n ",a+="document.addEventListener('DOMContentLoaded', function() {",a+="\n ",a+=" const headings = document.querySelectorAll('.toggle');",a+="\n ",a+=" headings.forEach(heading => {",a+="\n ",a+=" heading.addEventListener('click', function() {",a+="\n ",a+=" // 找到 h3 后面的 collapse 元素",a+="\n ",a+=" let content = heading.nextElementSibling;",a+="\n ",a+=" if(!(content && content.classList.contains('collapse'))) {",a+="\n ",a+=" content = content.nextElementSibling;",a+="\n ",a+=" }",a+="\n ",a+=" if (content && content.classList.contains('collapse')) {",a+="\n ",a+=' content.style.display = (content.style.display === "block") ? "none" : "block";',a+="\n ",a+=" }",a+="\n ",a+=" });",a+="\n ",a+=" });",a+="\n ",a+="});",a+="\n ",a+="\n <\/script>",function(){var i=t;if("number"==typeof i.length)for(var o=0,r=i.length;o<r;o++){var s=i[o];a=(a+="\n <h2>")+Yl.escape(null==(n=s[0])?"":n)+"</h2>",function(){var t=s[1];if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Yl.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Yl.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}else{o=0;for(var i in t){o++;r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Yl.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Yl.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}}}.call(this)}else{r=0;for(var o in i){r++;s=i[o];a=(a+="\n <h2>")+Yl.escape(null==(n=s[0])?"":n)+"</h2>",function(){var t=s[1];if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Yl.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Yl.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}else{o=0;for(var i in t){o++;r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Yl.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Yl.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Yl.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Yl.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Yl.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}}}.call(this)}}}.call(this),a+="\n </body>\n</html>"}).call(this,"JSON"in o?o.JSON:"undefined"!=typeof JSON?JSON:void 0,"apiData"in o?o.apiData:"undefined"!=typeof apiData?apiData:void 0)}catch(e){Yl.rethrow(e,t,undefined,i[void 0])}return a}const eu={DOCUMENTATION_DIR:s(process.cwd(),"doc")},nu=(e,n)=>{const t=q(e.wholePath),a=t.prototype,i=Object.getOwnPropertyNames(a).filter((e=>"function"==typeof a[e]&&"constructor"!==e)),o=e.path.substring(e.path.indexOf("doc")+3),r=i.map((e=>{if("function"==typeof a[e]){const n=a[e]();return n.path=o+n.path,n}return null})).filter((e=>!!e));let s="";if(r[0]?.path){const e=r[0].path.lastIndexOf("/");e>-1&&(s=r[0].path.substring(0,e))}return{configs:r,desc:t.desc,name:t.name,pathPrefix:n,apiPrePath:s}},tu=async(e,n)=>{e.extra={get:e.query,post:e.request.body??{}},await n()};(()=>{const e=process.env.NODE_ENV||"production",n=D();let a=r(n,"env");switch(function(e){try{return t(e).isDirectory()}catch(e){return e.code,!1}}(a)||(a=r(n,"..","env")),console.log("load env path: ",a),b.config({path:r(a,".common.env")}),e){case"development":b.config({path:r(a,".development.env")});break;case"test":b.config({path:r(a,".test.env")});break;case"production":b.config({path:r(a,".production.env")})}})();const au=async e=>{const{koaInstance:n,authCheckCallback:t,catchErrorCallback:a,registerHighPriorityMiddleware:i,registerHook:o,log4:r=!1,runtimeLog:s=!0}=e,c=n||new p;var l;return c.context.log4=(e=>{if(!1!==e)return"boolean"==typeof e&&!0===e?Ql.configure({appenders:{console:{type:"console"},file:{type:"dateFile",filename:"logs/app.log",pattern:".yyyy-MM-dd",compress:!0,numBackups:7,alwaysIncludePattern:!0}},categories:{default:{appenders:["console","file"],level:"info"}}}):e(Ql)})(r),c.context.hook=o,c.context.runtimeLog=s,c.use((l=a,async(e,n)=>{try{await n()}catch(n){e.hook?.(e,"error"),l?l(n,e):L(500,{message:n.message})}})),c.use(U),i?.(c),c.use(W),e.corsMiddleware&&c.use(e.corsMiddleware),c.use(ji()),c.use(tu),(e=>{const{controllerModule:n,validateModule:t}=B();console.log("load controller path: ",n),R(n,(n=>{if(!n.path.includes("controller"))return;const a=q(n.wholePath),i=a?.routesMap;i&&rs(t,n,i,((t,a)=>!t||e({filePath:n,ctx:a})))}))})(t),c.context.validated={params:{},get:{},post:{}},"development"!==process.env.NODE_ENV&&"true"!==process.env.DOC||G.get("/doc",(async e=>{const n=await(async()=>{const e=[],n=new Map;return R(eu.DOCUMENTATION_DIR,(n=>{const{pathPrefix:t}=z(n,"doc");e.push(nu(n,t))})),e.forEach((e=>{n.has(e.pathPrefix)||n.set(e.pathPrefix,[]),n.get(e.pathPrefix)?.push(e)})),Xl({apiData:Array.from(n.entries())})})();e.body=n})),G.get("/",(async e=>{e.body={code:200,message:"hello koa-ts-cli https://www.npmjs.com/package/koa-ts-core"}})),c.use(G.routes()),await(async e=>{const n=process.env.APP_PORT;if(n){const t=e.listen(Number(n));return void t.on("listening",(()=>os(t)))}const t=await as.getPortPromise({port:8e3,stopPort:9999});e.listen=(...n)=>{const a=0===n.length?is.apply(e,[t]):is.apply(e,n);return a.on("listening",(()=>os(a))),a}})(c),[c,G]};export{A as AuthRouter,M as BaseException,E as INDEX_ROUTE,_ as Router,F as contextStore,L as errorRsp,T as getCurrentContext,B as getSrcModulePaths,au as initializeKoaApp,N as successRsp,I as unSuccessRsp};