koa-ts-core 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/global.d.ts +7 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/package.json +1 -1
package/dist/global.d.ts
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
* copy-to - index.js
|
|
37
37
|
* Copyright(c) 2014 dead_horse <dead_horse@qq.com>
|
|
38
38
|
* MIT Licensed
|
|
39
|
-
*/var es=function(){if(ir)return ar;ir=1;const e=Xr(),n=function(){if(tr)return nr;tr=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 nr=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},nr}(),t=qt();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 ar=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()}}}(),ns=q(es);const ts=async(e,n)=>{e.extra={get:e.query,post:e.request.body??{}},await n()};var as,is,os,rs={exports:{}},ss={exports:{}};function cs(){if(is)return as;return is=1,as=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=st(),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},as}var ps,ls,us,ds,fs,ms,hs={exports:{}};function vs(){return ps||(ps=1,function(e,n){const t=s,a=c;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} [0m`;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"[0m")}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=cs()(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)}}(hs,hs.exports)),hs.exports}function xs(){return ls||(ls=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?rs.exports=(os||(os=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=cs()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(ss,ss.exports)),ss.exports):rs.exports=vs()),rs.exports}function bs(){if(ds)return us;function e(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}return ds=1,us=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}},us}function ys(){if(ms)return fs;ms=1;const e=c,n=xs()("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 fs={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 gs,ws,Ss,ks,Es,js={exports:{}};function Os(){return gs||(gs=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"}(js)),js.exports}function Cs(){if(Ss)return ws;Ss=1;const e=Os(),n=o,a=c,i=t,r=m,s=xs()("log4js:layouts"),p={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 l(e){return e?`[${p[e][0]}m`:""}function u(e){return e?`[${p[e][1]}m`:""}function d(n,t){return i=a.format("[%s] [%s] %s - ",e.asString(n.startTime),n.level.toString(),n.categoryName),l(o=t)+i+u(o);var i,o}function f(e){return d(e)+a.format(...e.data)}function h(e){return d(e,e.level.colour)+a.format(...e.data)}function v(e){return a.format(...e.data)}function x(e){return e.data[0]}function b(t,o){const c=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function p(e){return e&&e.pid?e.pid.toString():process.pid.toString()}t=t||"%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"),s("[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"),s("[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 t=e.data;if(n){const[e,a]=n.split(",");t=t.slice(e,a)}return a.format(...t)},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 l(e.level.colour)},"]":function(e){return u(e.level.colour)},y:function(){return p()},z:p,"%":function(){return"%"},x:function(e,n){return void 0!==o[n]?"function"==typeof o[n]?o[n](e):o[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 r.fileURLToPath?e=r.fileURLToPath(e):(e=i.normalize(e.replace(new RegExp(`^${n}`),"")),"win32"===process.platform&&(e=e.startsWith("\\")?e.slice(1):i.sep+i.sep+e))),e}(t),n){const e=parseInt(n,10),a=t.split(i.sep);a.length>e&&(t=a.slice(-e).join(i.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,a="",i=t;for(;null!==(n=c.exec(i));){const t=n[1],o=n[2],r=n[3],s=n[5],c=n[6];if(c)a+=c.toString();else{a+=m(f(r,e,s),o,t)}i=i.slice(n.index+n[0].length)}return a}}const y={messagePassThrough:()=>v,basic:()=>f,colored:()=>h,coloured:()=>h,pattern:e=>b(e&&e.pattern,e&&e.tokens),dummy:()=>x};return ws={basicLayout:f,messagePassThroughLayout:v,patternLayout:b,colouredLayout:h,coloredLayout:h,dummyLayout:x,addLayout(e,n){y[e]=n},layout:(e,n)=>y[e]&&y[e](n)}}function _s(){if(Es)return ks;Es=1;const e=ys(),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)})),ks=t}var As,Fs,Ts,Ps,Ns,Is={exports:{}},Ls={};function Ms(){if(Ts)return Fs;Ts=1;const e=function(){if(As)return Ls;As=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)};Ls.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 Ls.stringify=f,Ls.toJSON=n=>e(f(n)),Ls.fromJSON=e=>d(n(e)),Ls}(),n=_s();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 Fs=a}function qs(){if(Ns)return Ps;Ns=1;const e=xs()("log4js:clustering"),n=Ms(),t=ys();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")})),Ps={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 Ds,Bs={};function Rs(){if(Ds)return Bs;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)}Ds=1;const t={dateFile:n,file:n,fileSync:n};return Bs.modifyConfig=e=>t[e.type]?t[e.type](e):e,Bs}var zs,$s={};function Us(){if(zs)return $s;zs=1;const e=console.log.bind(console);return $s.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)},$s}var Ws,Gs={};function Hs(){if(Ws)return Gs;return Ws=1,Gs.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)},Gs}var Js,Ks={};function Vs(){if(Js)return Ks;return Js=1,Ks.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)},Ks}var Zs,Qs={};var Ys,Xs={};function ec(){if(Ys)return Xs;Ys=1;const e=xs()("log4js:categoryFilter");return Xs.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)},Xs}var nc,tc={};function ac(){if(nc)return tc;nc=1;const e=xs()("log4js:noLogFilter");return tc.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)},tc}var ic,oc,rc,sc,cc,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,qc,Dc,Bc,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,qp,Dp,Bp,Rp={},zp={exports:{}},$p={},Up={};function Wp(){return ic||(ic=1,Up.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})},Up.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})}),Up}function Gp(){if(rc)return oc;rc=1;var e=h,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 oc=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},oc}function Hp(){if(dc)return uc;dc=1;var e,t,a=n,i=Gp(),o=function(){if(cc)return sc;cc=1;var e=d.Stream;return sc=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())}}},sc}(),r=function(){if(lc)return pc;lc=1,pc=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 pc}(),s=c;function p(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 l,u=function(){};if(s.debuglog?u=s.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(u=function(){var e=s.format.apply(s,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!a[e]){var f=M[e]||[];p(a,f),a.close=function(e){function n(n,t){return e.call(a,n,(function(e){e||x(),"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),x()}return Object.defineProperty(n,t,{value:e}),n}(a.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){u(a[e]),v.equal(a[e].length,0)}))}function m(e){i(e),e.gracefulify=m,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 f=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 f},set:function(e){f=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){u("ENQUEUE",n[0].name,n[1]),a[e].push(n),b()}function x(){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);b()}function b(){if(clearTimeout(l),l=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)u("RETRY",t.name,i),t.apply(null,i);else if(Date.now()-r>=6e4){u("TIMEOUT",t.name,i);var c=i.pop();"function"==typeof c&&c.call(null,o)}else{var p=Date.now()-s,d=Math.max(s-r,1);p>=Math.min(1.2*d,100)?(u("RETRY",t.name,i),t.apply(null,i.concat([r]))):a[e].push(n)}void 0===l&&(l=setTimeout(b,0))}}return M[e]||p(M,a[e]),uc=m(r(a)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!a.__patched&&(uc=m(a),a.__patched=!0),uc}function Jp(){return fc||(fc=1,function(e){const n=Wp().fromCallback,t=Hp(),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))}($p)),$p}function Kp(){if(hc)return mc;hc=1;const e=t;function n(n){return(n=e.normalize(e.resolve(n)).split(e.sep)).length>0?n[0]:null}const a=/[<>:"|?*]/;return mc={getRootPath:n,invalidWin32Path:function(e){const t=n(e);return e=e.replace(t,""),a.test(e)}}}function Vp(){if(wc)return gc;wc=1;const e=(0,Wp().fromCallback)(function(){if(xc)return vc;xc=1;const e=Hp(),n=t,a=Kp().invalidWin32Path,i=parseInt("0777",8);return vc=function t(o,r,s,c){if("function"==typeof r?(s=r,r={}):r&&"object"==typeof r||(r={mode:r}),"win32"===process.platform&&a(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=i&~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);t(n.dirname(o),r,((e,n)=>{e?s(e,n):t(o,r,s,n)}))}else l.stat(o,((n,t)=>{n||!t.isDirectory()?s(e,c):s(null,c)}))}))},vc}()),n=function(){if(yc)return bc;yc=1;const e=Hp(),n=t,a=Kp().invalidWin32Path,i=parseInt("0777",8);return bc=function t(o,r,s){r&&"object"==typeof r||(r={mode:r});let c=r.mode;const p=r.fs||e;if("win32"===process.platform&&a(o)){const e=new Error(o+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===c&&(c=i&~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=t(n.dirname(o),r,s),t(o,r,s)}else{let n;try{n=p.statSync(o)}catch(n){throw e}if(!n.isDirectory())throw e}}return s},bc}();return gc={mkdirs:e,mkdirsSync:n,mkdirp:e,mkdirpSync:n,ensureDir:e,ensureDirSync:n}}function Zp(){if(kc)return Sc;kc=1;const e=Hp(),n=o,a=t;return Sc={hasMillisRes:function(t){let i=a.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));i=a.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 t(n);e.open(i,"r+",((n,a)=>{if(n)return t(n);e.futimes(a,o,o,(n=>{if(n)return t(n);e.close(a,(n=>{if(n)return t(n);e.stat(i,((e,n)=>{if(e)return t(e);t(null,n.mtime>1435410243e3)}))}))}))}))}))},hasMillisResSync:function(){let t=a.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));t=a.join(n.tmpdir(),t);const i=new Date(1435410243862);e.writeFileSync(t,"https://github.com/jprichardson/node-fs-extra/pull/141");const o=e.openSync(t,"r+");return e.futimesSync(o,i,i),e.closeSync(o),e.statSync(t).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 Qp(){if(jc)return Ec;jc=1;const e=Hp(),n=t,a=process.versions.node.split("."),i=Number.parseInt(a[0],10),o=Number.parseInt(a[1],10),r=Number.parseInt(a[2],10);function s(){if(i>10)return!0;if(10===i){if(o>5)return!0;if(5===o&&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 Ec={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},Ec}function Yp(){if(Ac)return _c;Ac=1;const e=Hp(),n=t,a=Vp().mkdirsSync,i=Zp().utimesMillisSync,o=Qp();function r(t,a,i,r){if(!r.filter||r.filter(a,i))return function(t,a,i,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,i,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,i,r);if(l.isSymbolicLink())return function(t,a,i,r){let s=e.readlinkSync(a);r.dereference&&(s=n.resolve(process.cwd(),s));if(t){let t;try{t=e.readlinkSync(i)}catch(n){if("EINVAL"===n.code||"UNKNOWN"===n.code)return e.symlinkSync(s,i);throw n}if(r.dereference&&(t=n.resolve(process.cwd(),t)),o.isSrcSubdir(s,t))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${t}'.`);if(e.statSync(i).isDirectory()&&o.isSrcSubdir(t,s))throw new Error(`Cannot overwrite '${t}' with '${s}'.`);return function(n,t){return e.unlinkSync(t),e.symlinkSync(n,t)}(s,i)}return e.symlinkSync(s,i)}(t,a,i,r)}(t,a,i,r)}function s(n,t,a,o){return"function"==typeof e.copyFileSync?(e.copyFileSync(t,a),e.chmodSync(a,n.mode),o.preserveTimestamps?i(a,n.atime,n.mtime):void 0):function(n,t,a,i){const o=65536,r=(Cc?Oc:(Cc=1,Oc=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,a,o)}function c(t,a,i){e.readdirSync(t).forEach((e=>function(e,t,a,i){const s=n.join(t,e),c=n.join(a,e),{destStat:p}=o.checkPathsSync(s,c,"copy");return r(p,s,c,i)}(e,t,a,i)))}return _c=function(t,i,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}=o.checkPathsSync(t,i,"copy");return o.checkParentPathsSync(t,c,i,"copy"),function(t,i,o,s){if(s.filter&&!s.filter(i,o))return;const c=n.dirname(o);e.existsSync(c)||a(c);return r(t,i,o,s)}(p,t,i,s)},_c}function Xp(){return Tc?Fc:(Tc=1,Fc={copySync:Yp()})}function el(){if(Nc)return Pc;Nc=1;const e=Wp().fromPromise,n=Jp();return Pc={pathExists:e((function(e){return n.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:n.existsSync}}function nl(){if(Lc)return Ic;Lc=1;const e=Hp(),n=t,a=Vp().mkdirs,i=el().pathExists,o=Zp().utimesMillis,r=Qp();function s(e,t,o,r,s){const c=n.dirname(o);i(c,((n,i)=>n?s(n):i?p(e,t,o,r,s):void a(c,(n=>n?s(n):p(e,t,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,i){e.chmod(t,n.mode,(e=>e?i(e):a.preserveTimestamps?o(t,n.atime,n.mtime,i):i()))}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 Ic=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)))}))},Ic}function tl(){if(qc)return Mc;qc=1;const e=Wp().fromCallback;return Mc={copy:e(nl())}}function al(){if(Bc)return Dc;Bc=1;const e=Hp(),n=t,a=v,i="win32"===process.platform;function o(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,t){let i=0;"function"==typeof n&&(t=n,n={}),a(e,"rimraf: missing path"),a.strictEqual(typeof e,"string","rimraf: path should be a string"),a.strictEqual(typeof t,"function","rimraf: callback function required"),a(n,"rimraf: invalid options argument provided"),a.strictEqual(typeof n,"object","rimraf: options should be object"),o(n),s(e,n,(function a(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&i<n.maxBusyTries){i++;return setTimeout((()=>s(e,n,a)),100*i)}"ENOENT"===o.code&&(o=null)}t(o)}))}function s(e,n,t){a(e),a(n),a("function"==typeof t),n.lstat(e,((a,o)=>a&&"ENOENT"===a.code?t(null):a&&"EPERM"===a.code&&i?c(e,n,a,t):o&&o.isDirectory()?l(e,n,a,t):void n.unlink(e,(a=>{if(a){if("ENOENT"===a.code)return t(null);if("EPERM"===a.code)return i?c(e,n,a,t):l(e,n,a,t);if("EISDIR"===a.code)return l(e,n,a,t)}return t(a)}))))}function c(e,n,t,i){a(e),a(n),a("function"==typeof i),t&&a(t instanceof Error),n.chmod(e,438,(a=>{a?i("ENOENT"===a.code?null:t):n.stat(e,((a,o)=>{a?i("ENOENT"===a.code?null:t):o.isDirectory()?l(e,n,t,i):n.unlink(e,i)}))}))}function p(e,n,t){let i;a(e),a(n),t&&a(t instanceof Error);try{n.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw t}try{i=n.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw t}i.isDirectory()?d(e,n,t):n.unlinkSync(e)}function l(e,t,i,o){a(e),a(t),i&&a(i instanceof Error),a("function"==typeof o),t.rmdir(e,(s=>{!s||"ENOTEMPTY"!==s.code&&"EEXIST"!==s.code&&"EPERM"!==s.code?s&&"ENOTDIR"===s.code?o(i):o(s):function(e,t,i){a(e),a(t),a("function"==typeof i),t.readdir(e,((a,o)=>{if(a)return i(a);let s,c=o.length;if(0===c)return t.rmdir(e,i);o.forEach((a=>{r(n.join(e,a),t,(n=>{if(!s)return n?i(s=n):void(0==--c&&t.rmdir(e,i))}))}))}))}(e,t,o)}))}function u(e,n){let t;o(n=n||{}),a(e,"rimraf: missing path"),a.strictEqual(typeof e,"string","rimraf: path should be a string"),a(n,"rimraf: missing options"),a.strictEqual(typeof n,"object","rimraf: options should be object");try{t=n.lstatSync(e)}catch(t){if("ENOENT"===t.code)return;"EPERM"===t.code&&i&&p(e,n,t)}try{t&&t.isDirectory()?d(e,n,null):n.unlinkSync(e)}catch(t){if("ENOENT"===t.code)return;if("EPERM"===t.code)return i?p(e,n,t):d(e,n,t);if("EISDIR"!==t.code)throw t;d(e,n,t)}}function d(e,t,o){a(e),a(t),o&&a(o instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw o;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(a(e),a(t),t.readdirSync(e).forEach((a=>u(n.join(e,a),t))),!i){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}return Dc=r,r.sync=u,Dc}function il(){if(zc)return Rc;zc=1;const e=Wp().fromCallback,n=al();return Rc={remove:e(n),removeSync:n.sync}}function ol(){if(Gc)return Wc;Gc=1;const e=Wp().fromCallback,n=t,a=Hp(),i=Vp(),o=el().pathExists;return Wc={createFile:e((function(e,t){function r(){a.writeFile(e,"",(e=>{if(e)return t(e);t()}))}a.stat(e,((a,s)=>{if(!a&&s.isFile())return t();const c=n.dirname(e);o(c,((e,n)=>e?t(e):n?r():void i.mkdirs(c,(e=>{if(e)return t(e);r()}))))}))})),createFileSync:function(e){let t;try{t=a.statSync(e)}catch(e){}if(t&&t.isFile())return;const o=n.dirname(e);a.existsSync(o)||i.mkdirsSync(o),a.writeFileSync(e,"")}},Wc}function rl(){if(Jc)return Hc;Jc=1;const e=Wp().fromCallback,n=t,a=Hp(),i=Vp(),o=el().pathExists;return Hc={createLink:e((function(e,t,r){function s(e,n){a.link(e,n,(e=>{if(e)return r(e);r(null)}))}o(t,((c,p)=>c?r(c):p?r(null):void a.lstat(e,(a=>{if(a)return a.message=a.message.replace("lstat","ensureLink"),r(a);const c=n.dirname(t);o(c,((n,a)=>n?r(n):a?s(e,t):void i.mkdirs(c,(n=>{if(n)return r(n);s(e,t)}))))}))))})),createLinkSync:function(e,t){if(a.existsSync(t))return;try{a.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const o=n.dirname(t);return a.existsSync(o)||i.mkdirsSync(o),a.linkSync(e,t)}},Hc}function sl(){if(Xc)return Yc;Xc=1;const e=Wp().fromCallback,n=t,a=Hp(),i=Vp(),o=i.mkdirs,r=i.mkdirsSync,s=function(){if(Vc)return Kc;Vc=1;const e=t,n=Hp(),a=el().pathExists;return Kc={symlinkPaths:function(t,i,o){if(e.isAbsolute(t))return n.lstat(t,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),o(e)):o(null,{toCwd:t,toDst:t})));{const r=e.dirname(i),s=e.join(r,t);return a(s,((a,i)=>a?o(a):i?o(null,{toCwd:s,toDst:t}):n.lstat(t,(n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),o(n)):o(null,{toCwd:t,toDst:e.relative(r,t)})))))}},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(Qc)return Zc;Qc=1;const e=Hp();return Zc={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"}},Zc}(),u=l.symlinkType,d=l.symlinkTypeSync,f=el().pathExists;return Yc={createSymlink:e((function(e,t,i,r){r="function"==typeof i?i:r,i="function"!=typeof i&&i,f(t,((s,p)=>s?r(s):p?r(null):void c(e,t,((s,c)=>{if(s)return r(s);e=c.toDst,u(c.toCwd,i,((i,s)=>{if(i)return r(i);const c=n.dirname(t);f(c,((n,i)=>n?r(n):i?a.symlink(e,t,s,r):void o(c,(n=>{if(n)return r(n);a.symlink(e,t,s,r)}))))}))}))))})),createSymlinkSync:function(e,t,i){if(a.existsSync(t))return;const o=p(e,t);e=o.toDst,i=d(o.toCwd,i);const s=n.dirname(t);return a.existsSync(s)||r(s),a.symlinkSync(e,t,i)}},Yc}function cl(){if(op)return ip;op=1;const e=Wp().fromCallback,t=function(){if(ap)return tp;var e;ap=1;try{e=Hp()}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 tp=i}();return ip={readJson:e(t.readFile),readJsonSync:t.readFileSync,writeJson:e(t.writeFile),writeJsonSync:t.writeFileSync}}function pl(){if(up)return lp;up=1;const e=Wp().fromCallback,n=cl();return n.outputJson=e(function(){if(sp)return rp;sp=1;const e=t,n=Vp(),a=el().pathExists,i=cl();return rp=function(t,o,r,s){"function"==typeof r&&(s=r,r={});const c=e.dirname(t);a(c,((e,a)=>e?s(e):a?i.writeJson(t,o,r,s):void n.mkdirs(c,(e=>{if(e)return s(e);i.writeJson(t,o,r,s)}))))},rp}()),n.outputJsonSync=function(){if(pp)return cp;pp=1;const e=Hp(),n=t,a=Vp(),i=cl();return cp=function(t,o,r){const s=n.dirname(t);e.existsSync(s)||a.mkdirsSync(s),i.writeJsonSync(t,o,r)},cp}(),n.outputJSON=n.outputJson,n.outputJSONSync=n.outputJsonSync,n.writeJSON=n.writeJson,n.writeJSONSync=n.writeJsonSync,n.readJSON=n.readJson,n.readJSONSync=n.readJsonSync,lp=n}function ll(){if(fp)return dp;fp=1;const e=Hp(),n=t,a=Xp().copySync,i=il().removeSync,o=Vp().mkdirpSync,r=Qp();function s(n,t,o){try{e.renameSync(n,t)}catch(e){if("EXDEV"!==e.code)throw e;return function(e,n,t){const o={overwrite:t,errorOnExist:!0};return a(e,n,o),i(e)}(n,t,o)}}return dp=function(t,a,c){const p=(c=c||{}).overwrite||c.clobber||!1,{srcStat:l}=r.checkPathsSync(t,a,"move");return r.checkParentPathsSync(t,l,a,"move"),o(n.dirname(a)),function(n,t,a){if(a)return i(t),s(n,t,a);if(e.existsSync(t))throw new Error("dest already exists.");return s(n,t,a)}(t,a,p)},dp}function ul(){if(xp)return vp;xp=1;const e=Hp(),n=t,a=tl().copy,i=il().remove,o=Vp().mkdirp,r=el().pathExists,s=Qp();function c(n,t,o,r){e.rename(n,t,(e=>e?"EXDEV"!==e.code?r(e):function(e,n,t,o){const r={overwrite:t,errorOnExist:!0};a(e,n,r,(n=>n?o(n):i(e,o)))}(n,t,o,r):r()))}return vp=function(e,t,a,p){"function"==typeof a&&(p=a,a={});const l=a.overwrite||a.clobber||!1;s.checkPaths(e,t,"move",((a,u)=>{if(a)return p(a);const{srcStat:d}=u;s.checkParentPaths(e,d,t,"move",(a=>{if(a)return p(a);o(n.dirname(t),(n=>n?p(n):function(e,n,t,a){if(t)return i(n,(i=>i?a(i):c(e,n,t,a)));r(n,((i,o)=>i?a(i):o?a(new Error("dest already exists.")):c(e,n,t,a)))}(e,t,l,p)))}))}))},vp}function dl(){return Sp||(Sp=1,function(e){e.exports=Object.assign({},Jp(),Xp(),tl(),function(){if(Uc)return $c;Uc=1;const e=Wp().fromCallback,n=Hp(),a=t,i=Vp(),o=il(),r=e((function(e,t){t=t||function(){},n.readdir(e,((n,r)=>{if(n)return i.mkdirs(e,t);r=r.map((n=>a.join(e,n))),function e(){const n=r.pop();if(!n)return t();o.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function s(e){let t;try{t=n.readdirSync(e)}catch(n){return i.mkdirsSync(e)}t.forEach((n=>{n=a.join(e,n),o.removeSync(n)}))}return $c={emptyDirSync:s,emptydirSync:s,emptyDir:r,emptydir:r}}(),function(){if(np)return ep;np=1;const e=ol(),n=rl(),t=sl();return ep={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}}(),pl(),Vp(),hp?mp:(hp=1,mp={moveSync:ll()}),function(){if(yp)return bp;yp=1;const e=Wp().fromCallback;return bp={move:e(ul())}}(),function(){if(wp)return gp;wp=1;const e=Wp().fromCallback,n=Hp(),a=t,i=Vp(),o=el().pathExists;return gp={outputFile:e((function(e,t,r,s){"function"==typeof r&&(s=r,r="utf8");const c=a.dirname(e);o(c,((a,o)=>a?s(a):o?n.writeFile(e,t,r,s):void i.mkdirs(c,(a=>{if(a)return s(a);n.writeFile(e,t,r,s)}))))})),outputFileSync:function(e,...t){const o=a.dirname(e);if(n.existsSync(o))return n.writeFileSync(e,...t);i.mkdirsSync(o),n.writeFileSync(e,...t)}},gp}(),el(),il());const a=n;Object.getOwnPropertyDescriptor(a,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>a.promises})}(zp)),zp.exports}function fl(){if(Op)return jp;Op=1;const e=xs()("streamroller:fileNameFormatter"),n=t;return jp=({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))},jp}function ml(){if(_p)return Cp;_p=1;const e=xs()("streamroller:fileNameParser"),n=Os();return Cp=({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}},Cp}function hl(){if(Fp)return Ap;Fp=1;const e=xs()("streamroller:moveAndMaybeCompressFile"),n=dl(),t=f;return Ap=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")},Ap}function vl(){if(Pp)return Tp;Pp=1;const e=xs()("streamroller:RollingFileWriteStream"),n=dl(),a=t,i=o,r=Ep?kp:(Ep=1,kp=()=>new Date),s=Os(),{Writable:c}=d,p=fl(),l=ml(),u=hl();return Tp=class extends c{constructor(n,t){if(e(`constructor: creating RollingFileWriteStream. path=${n}`),"string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(a.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${a.sep}`)&&(n=n.replace("~",i.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=a.parse(n),""===this.fileObject.dir&&(this.fileObject=a.parse(a.join(process.cwd(),n))),this.fileFormatter=p({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=l({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=s(this.options.pattern,r())),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=s(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!==s(this.options.pattern,r())}_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 u(n,a,i)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?s(this.options.pattern,r()):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)),i=e=>(e.timestamp?e.timestamp:r().getTime())-e.index;return a.sort(((e,n)=>i(e)-i(n))),a}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return n.mkdirSync(e,{recursive:!0})}catch(i){if("ENOENT"===i.code)return t(a.dirname(e)),t(e);if("EEXIST"!==i.code&&"EROFS"!==i.code)throw i;try{if(n.statSync(e).isDirectory())return e;throw i}catch(e){throw i}}};t(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 t=await this._getExistingFiles();if(e(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${t.length}`),e("_clean: existing files are: ",t),this._tooManyFiles(t.length)){const o=t.slice(0,t.length-this.options.numToKeep).map((e=>a.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}},Tp}function xl(){if(Ip)return Np;Ip=1;const e=vl();return Np=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 bl(){if(Mp)return Lp;Mp=1;const e=vl();return Lp=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 yl(){return Dp?qp:(Dp=1,qp={RollingFileWriteStream:vl(),RollingFileStream:xl(),DateRollingFileStream:bl()})}function gl(){if(Bp)return Rp;Bp=1;const e=xs()("log4js:file"),n=t,a=yl(),i=o,r=i.EOL;let s=!1;const c=new Set;function p(){c.forEach((e=>{e.sighupHandler()}))}return Rp.configure=function(t,o){let l=o.basicLayout;return t.layout&&(l=o.layout(t.layout.type,t.layout)),t.mode=t.mode||384,function(t,o,l,u,d,f){if("string"!=typeof t||0===t.length)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(n.sep))throw new Error(`Filename is a directory: ${t}`);function m(e,n,t,i){const o=new a.RollingFileStream(e,n,t,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===t.indexOf(`~${n.sep}`)&&(t=t.replace("~",i.homedir())),t=n.normalize(t),e("Creating file appender (",t,", ",l,", ",u=u||0===u?u:5,", ",d,", ",f,")");let h=m(t,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(o(e,f)+r,"utf8")||process.emit("log4js:pause",!0)}};return v.reopen=function(){h.end((()=>{h=m(t,l,u,d)}))},v.sighupHandler=function(){e("SIGHUP handler called."),v.reopen()},v.shutdown=function(e){c.delete(v),0===c.size&&s&&(process.removeListener("SIGHUP",p),s=!1),h.end("","utf-8",e)},c.add(v),s||(process.on("SIGHUP",p),s=!0),v}(t.filename,l,t.maxLogSize,t.backups,t,t.timezoneOffset)},Rp}var wl,Sl={};function kl(){if(wl)return Sl;wl=1;const e=yl(),n=o.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 Sl.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)},Sl}var El,jl={};function Ol(){if(El)return jl;El=1;const e=xs()("log4js:fileSync"),a=t,i=n,r=o,s=r.EOL;function c(e,n){const t=e=>{try{return i.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(a.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(i.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(a.dirname(e)),i.appendFileSync(e,"",{mode:n.mode,flag:n.flags})}class p{constructor(n,t,a,o){if(e("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=n,this.size=t,this.backups=a,this.options=o,this.currentSize=0,this.currentSize=function(e){let n=0;try{n=i.statSync(e).size}catch(n){c(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 t=this,o=new RegExp(`^${a.basename(n)}`);function r(e){return o.test(e)}function s(e){return parseInt(e.slice(`${a.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===t.backups)i.truncateSync(n,0);else if(r<t.backups){try{i.unlinkSync(`${n}.${r+1}`)}catch(e){}e(`Renaming ${o} -> ${n}.${r+1}`),i.renameSync(a.join(a.dirname(n),o),`${n}.${r+1}`)}}e("Rolling, rolling, rolling"),e("Renaming the old files"),i.readdirSync(a.dirname(n)).filter(r).sort(c).reverse().forEach(p)}write(n,t){const a=this;e("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),e("writing the chunk to the file"),a.currentSize+=n.length,i.appendFileSync(a.filename,n)}}return jl.configure=function(n,t){let o=t.basicLayout;n.layout&&(o=t.layout(n.layout.type,n.layout));const l={flags:n.flags||"a",encoding:n.encoding||"utf8",mode:n.mode||384};return function(n,t,o,l,u,d){if("string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(a.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${a.sep}`)&&(n=n.replace("~",r.homedir())),n=a.normalize(n),e("Creating fileSync appender (",n,", ",o,", ",l=l||0===l?l:5,", ",u,", ",d,")");const f=function(e,n,t){let a;var o;return n?a=new p(e,n,t,u):(c(o=e,u),a={write(e){i.appendFileSync(o,e)}}),a}(n,o,l);return e=>{f.write(t(e,d)+s)}}(n.filename,o,n.maxLogSize,n.backups,l,n.timezoneOffset)},jl}var Cl,_l,Al={};function Fl(){if(Cl)return Al;Cl=1;const e=xs()("log4js:tcp"),n=r;return Al.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)},Al}function Tl(){if(_l)return Is.exports;_l=1;const e=t,n=xs()("log4js:appenders"),a=ys(),i=qs(),o=_s(),r=Cs(),s=Rs(),p=new Map;p.set("console",Us()),p.set("stdout",Hs()),p.set("stderr",Vs()),p.set("logLevelFilter",(Zs||(Zs=1,Qs.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)}),Qs)),p.set("categoryFilter",ec()),p.set("noLogFilter",ac()),p.set("file",gl()),p.set("dateFile",kl()),p.set("fileSync",Ol()),p.set("tcp",Fl());const l=new Map,u=(e,t)=>{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 a.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},d=new Set,f=(e,t)=>{if(l.has(e))return l.get(e);if(!t.appenders[e])return!1;if(d.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);d.add(e),n(`Creating appender ${e}`);const a=m(e,t);return d.delete(e),l.set(e,a),a},m=(t,l)=>{const d=l.appenders[t],m=d.type.configure?d.type:((n,t)=>p.get(n)||u(`./${n}`,t)||u(n,t)||require.main&&require.main.filename&&u(e.join(e.dirname(require.main.filename),n),t)||u(e.join(process.cwd(),n),t))(d.type,l);return a.throwExceptionIf(l,a.not(m),`appender "${t}" is not valid (type "${d.type}" could not be found)`),m.appender&&(process.emitWarning(`Appender ${d.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),n("[log4js-node-DEP0001]",`DEPRECATION: Appender ${d.type} exports an appender function.`)),m.shutdown&&(process.emitWarning(`Appender ${d.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),n("[log4js-node-DEP0002]",`DEPRECATION: Appender ${d.type} exports a shutdown function.`)),n(`${t}: clustering.isMaster ? ${i.isMaster()}`),n(`${t}: appenderModule is ${c.inspect(m)}`),i.onlyOnMaster((()=>(n(`calling appenderModule.configure for ${t} / ${d.type}`),m.configure(s.modifyConfig(d),r,(e=>f(e,l)),o))),(()=>{}))},h=e=>{if(l.clear(),d.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)&&f(t,e)}))},v=()=>{h()};return v(),a.addListener((e=>{a.throwExceptionIf(e,a.not(a.anObject(e.appenders)),'must have a property "appenders" of type object.');const n=Object.keys(e.appenders);a.throwExceptionIf(e,a.not(n.length),"must define at least one appender."),n.forEach((n=>{a.throwExceptionIf(e,a.not(e.appenders[n].type),`appender "${n}" is not valid (must be an object with property "type")`)}))})),a.addListener(h),Is.exports=l,Is.exports.init=v,Is.exports}var Pl,Nl,Il,Ll,Ml,ql,Dl,Bl,Rl,zl={exports:{}};function $l(){return Pl||(Pl=1,function(e){const n=xs()("log4js:categories"),t=ys(),a=_s(),i=Tl(),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})}(zl)),zl.exports}function Ul(){if(Ml)return Ll;Ml=1;const e=_s();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 Ll=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 Wl(){if(Dl)return ql;Dl=1;const e=xs()("log4js:recording"),n=[];function t(){return n.slice()}function a(){n.length=0}return ql={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 Gl=function(){if(Rl)return Bl;Rl=1;const e=xs()("log4js:main"),t=n,a=bs()({proto:!0}),i=ys(),o=Cs(),r=_s(),s=Tl(),c=$l(),p=function(){if(Il)return Nl;Il=1;const e=xs()("log4js:logger"),n=Ms(),t=_s(),a=qs(),i=$l(),o=ys(),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)})),Nl=c}(),l=qs(),u=Ul(),d=Wl();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 Bl=x}(),Hl=q(Gl);(()=>{const e=process.env.NODE_ENV||"production",a=_();let i=t.resolve(a,"env");switch(function(e){try{return n.statSync(e).isDirectory()}catch(e){return e.code,!1}}(i)||(i=t.resolve(a,"..","env")),console.log("load env path: ",i),p.config({path:t.resolve(i,".common.env")}),e){case"development":p.config({path:t.resolve(i,".development.env")});break;case"test":p.config({path:t.resolve(i,".test.env")});break;case"production":p.config({path:t.resolve(i,".production.env")})}})();exports.AuthRouter=function(e,n){return S(e,n,!0)},exports.BaseException=C,exports.INDEX_ROUTE=y,exports.Router=function(e,n){return S(e,n)},exports.contextStore=k,exports.errorRsp=O,exports.getCurrentContext=E,exports.getSrcModulePaths=A,exports.initializeKoaApp=async e=>{const{koaInstance:n,authCheckCallback:t,catchErrorCallback:i,registerHighPriorityMiddleware:o,registerHook:r,log4:s=!1}=e;try{(e=>{const{controllerModule:n,validateModule:t}=A();console.log("load controller path: ",n),T(n,(n=>{if(!n.path.includes("controller"))return;const a=F(n.wholePath),i=a?.routesMap;i&&yt(t,n,i,((t,a)=>!t||e({filePath:n,ctx:a})))}))})(t)}catch(e){console.error("registerControllers error",e)}const c=n||new a;c.context.log4=(e=>{if(!1!==e)return"boolean"==typeof e&&!0===e?Hl.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(Hl)})(s),c.use((async(e,n)=>{r?.(e,"request"),await n(),r?.(e,"response")})),c.use(I),o?.(c);return c.use(((e,n)=>async(t,a)=>{try{await a()}catch(a){e(t),n?n(a,t):O(500,{message:a.message})}})((e=>r?.(e,"error")),i)),c.use(ns()),c.use(ts),"development"!==process.env.NODE_ENV&&"true"!==process.env.DOC||L.get("/doc",(async e=>{const n=await(async()=>{const e=[],n=new Map;return T(kt.DOCUMENTATION_DIR,(n=>{const{pathPrefix:t}=P(n,"doc");e.push(Et(n,t))})),e.forEach((e=>{n.has(e.pathPrefix)||n.set(e.pathPrefix,[]),n.get(e.pathPrefix)?.push(e)})),St({apiData:Array.from(n.entries())})})();e.body=n})),L.get("/",(async e=>{e.body={code:200,message:"hello koa-ts-cli https://www.npmjs.com/package/koa-ts-core"}})),c.use(L.routes()),await(async e=>{const n=process.env.APP_PORT;if(n){const t=e.listen(Number(n));return void t.on("listening",(()=>bt(t)))}const t=await vt.getPortPromise({port:8e3,stopPort:9999});e.listen=(...n)=>{const a=0===n.length?xt.apply(e,[t]):xt.apply(e,n);return a.on("listening",(()=>bt(a))),a}})(c),[c,L]},exports.successRsp=e=>{const n=Array.isArray(e?.data);j({success:!0,message:e?.message,data:n?{list:e?.data}:e?.data})},exports.unSuccessRsp=e=>{j({success:!1,errorCode:e?.code,errorMessage:e?.message,data:e?.data})};
|
|
39
|
+
*/var es=function(){if(ir)return ar;ir=1;const e=Xr(),n=function(){if(tr)return nr;tr=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 nr=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},nr}(),t=qt();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 ar=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()}}}(),ns=q(es);const ts=async(e,n)=>{e.extra={get:e.query,post:e.request.body??{}},await n()};var as,is,os,rs={exports:{}},ss={exports:{}};function cs(){if(is)return as;return is=1,as=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=st(),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},as}var ps,ls,us,ds,fs,ms,hs={exports:{}};function vs(){return ps||(ps=1,function(e,n){const t=s,a=c;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} [0m`;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"[0m")}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=cs()(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)}}(hs,hs.exports)),hs.exports}function xs(){return ls||(ls=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?rs.exports=(os||(os=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=cs()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(ss,ss.exports)),ss.exports):rs.exports=vs()),rs.exports}function bs(){if(ds)return us;function e(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}return ds=1,us=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}},us}function ys(){if(ms)return fs;ms=1;const e=c,n=xs()("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 fs={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 gs,ws,Ss,ks,Es,js={exports:{}};function Os(){return gs||(gs=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"}(js)),js.exports}function Cs(){if(Ss)return ws;Ss=1;const e=Os(),n=o,a=c,i=t,r=m,s=xs()("log4js:layouts"),p={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 l(e){return e?`[${p[e][0]}m`:""}function u(e){return e?`[${p[e][1]}m`:""}function d(n,t){return i=a.format("[%s] [%s] %s - ",e.asString(n.startTime),n.level.toString(),n.categoryName),l(o=t)+i+u(o);var i,o}function f(e){return d(e)+a.format(...e.data)}function h(e){return d(e,e.level.colour)+a.format(...e.data)}function v(e){return a.format(...e.data)}function x(e){return e.data[0]}function b(t,o){const c=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function p(e){return e&&e.pid?e.pid.toString():process.pid.toString()}t=t||"%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"),s("[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"),s("[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 t=e.data;if(n){const[e,a]=n.split(",");t=t.slice(e,a)}return a.format(...t)},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 l(e.level.colour)},"]":function(e){return u(e.level.colour)},y:function(){return p()},z:p,"%":function(){return"%"},x:function(e,n){return void 0!==o[n]?"function"==typeof o[n]?o[n](e):o[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 r.fileURLToPath?e=r.fileURLToPath(e):(e=i.normalize(e.replace(new RegExp(`^${n}`),"")),"win32"===process.platform&&(e=e.startsWith("\\")?e.slice(1):i.sep+i.sep+e))),e}(t),n){const e=parseInt(n,10),a=t.split(i.sep);a.length>e&&(t=a.slice(-e).join(i.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,a="",i=t;for(;null!==(n=c.exec(i));){const t=n[1],o=n[2],r=n[3],s=n[5],c=n[6];if(c)a+=c.toString();else{a+=m(f(r,e,s),o,t)}i=i.slice(n.index+n[0].length)}return a}}const y={messagePassThrough:()=>v,basic:()=>f,colored:()=>h,coloured:()=>h,pattern:e=>b(e&&e.pattern,e&&e.tokens),dummy:()=>x};return ws={basicLayout:f,messagePassThroughLayout:v,patternLayout:b,colouredLayout:h,coloredLayout:h,dummyLayout:x,addLayout(e,n){y[e]=n},layout:(e,n)=>y[e]&&y[e](n)}}function _s(){if(Es)return ks;Es=1;const e=ys(),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)})),ks=t}var As,Fs,Ts,Ps,Ns,Is={exports:{}},Ls={};function Ms(){if(Ts)return Fs;Ts=1;const e=function(){if(As)return Ls;As=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)};Ls.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 Ls.stringify=f,Ls.toJSON=n=>e(f(n)),Ls.fromJSON=e=>d(n(e)),Ls}(),n=_s();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 Fs=a}function qs(){if(Ns)return Ps;Ns=1;const e=xs()("log4js:clustering"),n=Ms(),t=ys();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")})),Ps={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 Ds,Bs={};function Rs(){if(Ds)return Bs;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)}Ds=1;const t={dateFile:n,file:n,fileSync:n};return Bs.modifyConfig=e=>t[e.type]?t[e.type](e):e,Bs}var zs,$s={};function Us(){if(zs)return $s;zs=1;const e=console.log.bind(console);return $s.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)},$s}var Ws,Gs={};function Hs(){if(Ws)return Gs;return Ws=1,Gs.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)},Gs}var Js,Ks={};function Vs(){if(Js)return Ks;return Js=1,Ks.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)},Ks}var Zs,Qs={};var Ys,Xs={};function ec(){if(Ys)return Xs;Ys=1;const e=xs()("log4js:categoryFilter");return Xs.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)},Xs}var nc,tc={};function ac(){if(nc)return tc;nc=1;const e=xs()("log4js:noLogFilter");return tc.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)},tc}var ic,oc,rc,sc,cc,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,qc,Dc,Bc,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,qp,Dp,Bp,Rp={},zp={exports:{}},$p={},Up={};function Wp(){return ic||(ic=1,Up.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})},Up.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})}),Up}function Gp(){if(rc)return oc;rc=1;var e=h,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 oc=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},oc}function Hp(){if(dc)return uc;dc=1;var e,t,a=n,i=Gp(),o=function(){if(cc)return sc;cc=1;var e=d.Stream;return sc=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())}}},sc}(),r=function(){if(lc)return pc;lc=1,pc=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 pc}(),s=c;function p(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 l,u=function(){};if(s.debuglog?u=s.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(u=function(){var e=s.format.apply(s,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!a[e]){var f=M[e]||[];p(a,f),a.close=function(e){function n(n,t){return e.call(a,n,(function(e){e||x(),"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),x()}return Object.defineProperty(n,t,{value:e}),n}(a.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){u(a[e]),v.equal(a[e].length,0)}))}function m(e){i(e),e.gracefulify=m,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 f=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 f},set:function(e){f=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){u("ENQUEUE",n[0].name,n[1]),a[e].push(n),b()}function x(){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);b()}function b(){if(clearTimeout(l),l=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)u("RETRY",t.name,i),t.apply(null,i);else if(Date.now()-r>=6e4){u("TIMEOUT",t.name,i);var c=i.pop();"function"==typeof c&&c.call(null,o)}else{var p=Date.now()-s,d=Math.max(s-r,1);p>=Math.min(1.2*d,100)?(u("RETRY",t.name,i),t.apply(null,i.concat([r]))):a[e].push(n)}void 0===l&&(l=setTimeout(b,0))}}return M[e]||p(M,a[e]),uc=m(r(a)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!a.__patched&&(uc=m(a),a.__patched=!0),uc}function Jp(){return fc||(fc=1,function(e){const n=Wp().fromCallback,t=Hp(),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))}($p)),$p}function Kp(){if(hc)return mc;hc=1;const e=t;function n(n){return(n=e.normalize(e.resolve(n)).split(e.sep)).length>0?n[0]:null}const a=/[<>:"|?*]/;return mc={getRootPath:n,invalidWin32Path:function(e){const t=n(e);return e=e.replace(t,""),a.test(e)}}}function Vp(){if(wc)return gc;wc=1;const e=(0,Wp().fromCallback)(function(){if(xc)return vc;xc=1;const e=Hp(),n=t,a=Kp().invalidWin32Path,i=parseInt("0777",8);return vc=function t(o,r,s,c){if("function"==typeof r?(s=r,r={}):r&&"object"==typeof r||(r={mode:r}),"win32"===process.platform&&a(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=i&~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);t(n.dirname(o),r,((e,n)=>{e?s(e,n):t(o,r,s,n)}))}else l.stat(o,((n,t)=>{n||!t.isDirectory()?s(e,c):s(null,c)}))}))},vc}()),n=function(){if(yc)return bc;yc=1;const e=Hp(),n=t,a=Kp().invalidWin32Path,i=parseInt("0777",8);return bc=function t(o,r,s){r&&"object"==typeof r||(r={mode:r});let c=r.mode;const p=r.fs||e;if("win32"===process.platform&&a(o)){const e=new Error(o+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===c&&(c=i&~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=t(n.dirname(o),r,s),t(o,r,s)}else{let n;try{n=p.statSync(o)}catch(n){throw e}if(!n.isDirectory())throw e}}return s},bc}();return gc={mkdirs:e,mkdirsSync:n,mkdirp:e,mkdirpSync:n,ensureDir:e,ensureDirSync:n}}function Zp(){if(kc)return Sc;kc=1;const e=Hp(),n=o,a=t;return Sc={hasMillisRes:function(t){let i=a.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));i=a.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 t(n);e.open(i,"r+",((n,a)=>{if(n)return t(n);e.futimes(a,o,o,(n=>{if(n)return t(n);e.close(a,(n=>{if(n)return t(n);e.stat(i,((e,n)=>{if(e)return t(e);t(null,n.mtime>1435410243e3)}))}))}))}))}))},hasMillisResSync:function(){let t=a.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));t=a.join(n.tmpdir(),t);const i=new Date(1435410243862);e.writeFileSync(t,"https://github.com/jprichardson/node-fs-extra/pull/141");const o=e.openSync(t,"r+");return e.futimesSync(o,i,i),e.closeSync(o),e.statSync(t).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 Qp(){if(jc)return Ec;jc=1;const e=Hp(),n=t,a=process.versions.node.split("."),i=Number.parseInt(a[0],10),o=Number.parseInt(a[1],10),r=Number.parseInt(a[2],10);function s(){if(i>10)return!0;if(10===i){if(o>5)return!0;if(5===o&&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 Ec={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},Ec}function Yp(){if(Ac)return _c;Ac=1;const e=Hp(),n=t,a=Vp().mkdirsSync,i=Zp().utimesMillisSync,o=Qp();function r(t,a,i,r){if(!r.filter||r.filter(a,i))return function(t,a,i,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,i,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,i,r);if(l.isSymbolicLink())return function(t,a,i,r){let s=e.readlinkSync(a);r.dereference&&(s=n.resolve(process.cwd(),s));if(t){let t;try{t=e.readlinkSync(i)}catch(n){if("EINVAL"===n.code||"UNKNOWN"===n.code)return e.symlinkSync(s,i);throw n}if(r.dereference&&(t=n.resolve(process.cwd(),t)),o.isSrcSubdir(s,t))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${t}'.`);if(e.statSync(i).isDirectory()&&o.isSrcSubdir(t,s))throw new Error(`Cannot overwrite '${t}' with '${s}'.`);return function(n,t){return e.unlinkSync(t),e.symlinkSync(n,t)}(s,i)}return e.symlinkSync(s,i)}(t,a,i,r)}(t,a,i,r)}function s(n,t,a,o){return"function"==typeof e.copyFileSync?(e.copyFileSync(t,a),e.chmodSync(a,n.mode),o.preserveTimestamps?i(a,n.atime,n.mtime):void 0):function(n,t,a,i){const o=65536,r=(Cc?Oc:(Cc=1,Oc=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,a,o)}function c(t,a,i){e.readdirSync(t).forEach((e=>function(e,t,a,i){const s=n.join(t,e),c=n.join(a,e),{destStat:p}=o.checkPathsSync(s,c,"copy");return r(p,s,c,i)}(e,t,a,i)))}return _c=function(t,i,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}=o.checkPathsSync(t,i,"copy");return o.checkParentPathsSync(t,c,i,"copy"),function(t,i,o,s){if(s.filter&&!s.filter(i,o))return;const c=n.dirname(o);e.existsSync(c)||a(c);return r(t,i,o,s)}(p,t,i,s)},_c}function Xp(){return Tc?Fc:(Tc=1,Fc={copySync:Yp()})}function el(){if(Nc)return Pc;Nc=1;const e=Wp().fromPromise,n=Jp();return Pc={pathExists:e((function(e){return n.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:n.existsSync}}function nl(){if(Lc)return Ic;Lc=1;const e=Hp(),n=t,a=Vp().mkdirs,i=el().pathExists,o=Zp().utimesMillis,r=Qp();function s(e,t,o,r,s){const c=n.dirname(o);i(c,((n,i)=>n?s(n):i?p(e,t,o,r,s):void a(c,(n=>n?s(n):p(e,t,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,i){e.chmod(t,n.mode,(e=>e?i(e):a.preserveTimestamps?o(t,n.atime,n.mtime,i):i()))}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 Ic=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)))}))},Ic}function tl(){if(qc)return Mc;qc=1;const e=Wp().fromCallback;return Mc={copy:e(nl())}}function al(){if(Bc)return Dc;Bc=1;const e=Hp(),n=t,a=v,i="win32"===process.platform;function o(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,t){let i=0;"function"==typeof n&&(t=n,n={}),a(e,"rimraf: missing path"),a.strictEqual(typeof e,"string","rimraf: path should be a string"),a.strictEqual(typeof t,"function","rimraf: callback function required"),a(n,"rimraf: invalid options argument provided"),a.strictEqual(typeof n,"object","rimraf: options should be object"),o(n),s(e,n,(function a(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&i<n.maxBusyTries){i++;return setTimeout((()=>s(e,n,a)),100*i)}"ENOENT"===o.code&&(o=null)}t(o)}))}function s(e,n,t){a(e),a(n),a("function"==typeof t),n.lstat(e,((a,o)=>a&&"ENOENT"===a.code?t(null):a&&"EPERM"===a.code&&i?c(e,n,a,t):o&&o.isDirectory()?l(e,n,a,t):void n.unlink(e,(a=>{if(a){if("ENOENT"===a.code)return t(null);if("EPERM"===a.code)return i?c(e,n,a,t):l(e,n,a,t);if("EISDIR"===a.code)return l(e,n,a,t)}return t(a)}))))}function c(e,n,t,i){a(e),a(n),a("function"==typeof i),t&&a(t instanceof Error),n.chmod(e,438,(a=>{a?i("ENOENT"===a.code?null:t):n.stat(e,((a,o)=>{a?i("ENOENT"===a.code?null:t):o.isDirectory()?l(e,n,t,i):n.unlink(e,i)}))}))}function p(e,n,t){let i;a(e),a(n),t&&a(t instanceof Error);try{n.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw t}try{i=n.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw t}i.isDirectory()?d(e,n,t):n.unlinkSync(e)}function l(e,t,i,o){a(e),a(t),i&&a(i instanceof Error),a("function"==typeof o),t.rmdir(e,(s=>{!s||"ENOTEMPTY"!==s.code&&"EEXIST"!==s.code&&"EPERM"!==s.code?s&&"ENOTDIR"===s.code?o(i):o(s):function(e,t,i){a(e),a(t),a("function"==typeof i),t.readdir(e,((a,o)=>{if(a)return i(a);let s,c=o.length;if(0===c)return t.rmdir(e,i);o.forEach((a=>{r(n.join(e,a),t,(n=>{if(!s)return n?i(s=n):void(0==--c&&t.rmdir(e,i))}))}))}))}(e,t,o)}))}function u(e,n){let t;o(n=n||{}),a(e,"rimraf: missing path"),a.strictEqual(typeof e,"string","rimraf: path should be a string"),a(n,"rimraf: missing options"),a.strictEqual(typeof n,"object","rimraf: options should be object");try{t=n.lstatSync(e)}catch(t){if("ENOENT"===t.code)return;"EPERM"===t.code&&i&&p(e,n,t)}try{t&&t.isDirectory()?d(e,n,null):n.unlinkSync(e)}catch(t){if("ENOENT"===t.code)return;if("EPERM"===t.code)return i?p(e,n,t):d(e,n,t);if("EISDIR"!==t.code)throw t;d(e,n,t)}}function d(e,t,o){a(e),a(t),o&&a(o instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw o;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(a(e),a(t),t.readdirSync(e).forEach((a=>u(n.join(e,a),t))),!i){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}return Dc=r,r.sync=u,Dc}function il(){if(zc)return Rc;zc=1;const e=Wp().fromCallback,n=al();return Rc={remove:e(n),removeSync:n.sync}}function ol(){if(Gc)return Wc;Gc=1;const e=Wp().fromCallback,n=t,a=Hp(),i=Vp(),o=el().pathExists;return Wc={createFile:e((function(e,t){function r(){a.writeFile(e,"",(e=>{if(e)return t(e);t()}))}a.stat(e,((a,s)=>{if(!a&&s.isFile())return t();const c=n.dirname(e);o(c,((e,n)=>e?t(e):n?r():void i.mkdirs(c,(e=>{if(e)return t(e);r()}))))}))})),createFileSync:function(e){let t;try{t=a.statSync(e)}catch(e){}if(t&&t.isFile())return;const o=n.dirname(e);a.existsSync(o)||i.mkdirsSync(o),a.writeFileSync(e,"")}},Wc}function rl(){if(Jc)return Hc;Jc=1;const e=Wp().fromCallback,n=t,a=Hp(),i=Vp(),o=el().pathExists;return Hc={createLink:e((function(e,t,r){function s(e,n){a.link(e,n,(e=>{if(e)return r(e);r(null)}))}o(t,((c,p)=>c?r(c):p?r(null):void a.lstat(e,(a=>{if(a)return a.message=a.message.replace("lstat","ensureLink"),r(a);const c=n.dirname(t);o(c,((n,a)=>n?r(n):a?s(e,t):void i.mkdirs(c,(n=>{if(n)return r(n);s(e,t)}))))}))))})),createLinkSync:function(e,t){if(a.existsSync(t))return;try{a.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const o=n.dirname(t);return a.existsSync(o)||i.mkdirsSync(o),a.linkSync(e,t)}},Hc}function sl(){if(Xc)return Yc;Xc=1;const e=Wp().fromCallback,n=t,a=Hp(),i=Vp(),o=i.mkdirs,r=i.mkdirsSync,s=function(){if(Vc)return Kc;Vc=1;const e=t,n=Hp(),a=el().pathExists;return Kc={symlinkPaths:function(t,i,o){if(e.isAbsolute(t))return n.lstat(t,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),o(e)):o(null,{toCwd:t,toDst:t})));{const r=e.dirname(i),s=e.join(r,t);return a(s,((a,i)=>a?o(a):i?o(null,{toCwd:s,toDst:t}):n.lstat(t,(n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),o(n)):o(null,{toCwd:t,toDst:e.relative(r,t)})))))}},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(Qc)return Zc;Qc=1;const e=Hp();return Zc={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"}},Zc}(),u=l.symlinkType,d=l.symlinkTypeSync,f=el().pathExists;return Yc={createSymlink:e((function(e,t,i,r){r="function"==typeof i?i:r,i="function"!=typeof i&&i,f(t,((s,p)=>s?r(s):p?r(null):void c(e,t,((s,c)=>{if(s)return r(s);e=c.toDst,u(c.toCwd,i,((i,s)=>{if(i)return r(i);const c=n.dirname(t);f(c,((n,i)=>n?r(n):i?a.symlink(e,t,s,r):void o(c,(n=>{if(n)return r(n);a.symlink(e,t,s,r)}))))}))}))))})),createSymlinkSync:function(e,t,i){if(a.existsSync(t))return;const o=p(e,t);e=o.toDst,i=d(o.toCwd,i);const s=n.dirname(t);return a.existsSync(s)||r(s),a.symlinkSync(e,t,i)}},Yc}function cl(){if(op)return ip;op=1;const e=Wp().fromCallback,t=function(){if(ap)return tp;var e;ap=1;try{e=Hp()}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 tp=i}();return ip={readJson:e(t.readFile),readJsonSync:t.readFileSync,writeJson:e(t.writeFile),writeJsonSync:t.writeFileSync}}function pl(){if(up)return lp;up=1;const e=Wp().fromCallback,n=cl();return n.outputJson=e(function(){if(sp)return rp;sp=1;const e=t,n=Vp(),a=el().pathExists,i=cl();return rp=function(t,o,r,s){"function"==typeof r&&(s=r,r={});const c=e.dirname(t);a(c,((e,a)=>e?s(e):a?i.writeJson(t,o,r,s):void n.mkdirs(c,(e=>{if(e)return s(e);i.writeJson(t,o,r,s)}))))},rp}()),n.outputJsonSync=function(){if(pp)return cp;pp=1;const e=Hp(),n=t,a=Vp(),i=cl();return cp=function(t,o,r){const s=n.dirname(t);e.existsSync(s)||a.mkdirsSync(s),i.writeJsonSync(t,o,r)},cp}(),n.outputJSON=n.outputJson,n.outputJSONSync=n.outputJsonSync,n.writeJSON=n.writeJson,n.writeJSONSync=n.writeJsonSync,n.readJSON=n.readJson,n.readJSONSync=n.readJsonSync,lp=n}function ll(){if(fp)return dp;fp=1;const e=Hp(),n=t,a=Xp().copySync,i=il().removeSync,o=Vp().mkdirpSync,r=Qp();function s(n,t,o){try{e.renameSync(n,t)}catch(e){if("EXDEV"!==e.code)throw e;return function(e,n,t){const o={overwrite:t,errorOnExist:!0};return a(e,n,o),i(e)}(n,t,o)}}return dp=function(t,a,c){const p=(c=c||{}).overwrite||c.clobber||!1,{srcStat:l}=r.checkPathsSync(t,a,"move");return r.checkParentPathsSync(t,l,a,"move"),o(n.dirname(a)),function(n,t,a){if(a)return i(t),s(n,t,a);if(e.existsSync(t))throw new Error("dest already exists.");return s(n,t,a)}(t,a,p)},dp}function ul(){if(xp)return vp;xp=1;const e=Hp(),n=t,a=tl().copy,i=il().remove,o=Vp().mkdirp,r=el().pathExists,s=Qp();function c(n,t,o,r){e.rename(n,t,(e=>e?"EXDEV"!==e.code?r(e):function(e,n,t,o){const r={overwrite:t,errorOnExist:!0};a(e,n,r,(n=>n?o(n):i(e,o)))}(n,t,o,r):r()))}return vp=function(e,t,a,p){"function"==typeof a&&(p=a,a={});const l=a.overwrite||a.clobber||!1;s.checkPaths(e,t,"move",((a,u)=>{if(a)return p(a);const{srcStat:d}=u;s.checkParentPaths(e,d,t,"move",(a=>{if(a)return p(a);o(n.dirname(t),(n=>n?p(n):function(e,n,t,a){if(t)return i(n,(i=>i?a(i):c(e,n,t,a)));r(n,((i,o)=>i?a(i):o?a(new Error("dest already exists.")):c(e,n,t,a)))}(e,t,l,p)))}))}))},vp}function dl(){return Sp||(Sp=1,function(e){e.exports=Object.assign({},Jp(),Xp(),tl(),function(){if(Uc)return $c;Uc=1;const e=Wp().fromCallback,n=Hp(),a=t,i=Vp(),o=il(),r=e((function(e,t){t=t||function(){},n.readdir(e,((n,r)=>{if(n)return i.mkdirs(e,t);r=r.map((n=>a.join(e,n))),function e(){const n=r.pop();if(!n)return t();o.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function s(e){let t;try{t=n.readdirSync(e)}catch(n){return i.mkdirsSync(e)}t.forEach((n=>{n=a.join(e,n),o.removeSync(n)}))}return $c={emptyDirSync:s,emptydirSync:s,emptyDir:r,emptydir:r}}(),function(){if(np)return ep;np=1;const e=ol(),n=rl(),t=sl();return ep={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}}(),pl(),Vp(),hp?mp:(hp=1,mp={moveSync:ll()}),function(){if(yp)return bp;yp=1;const e=Wp().fromCallback;return bp={move:e(ul())}}(),function(){if(wp)return gp;wp=1;const e=Wp().fromCallback,n=Hp(),a=t,i=Vp(),o=el().pathExists;return gp={outputFile:e((function(e,t,r,s){"function"==typeof r&&(s=r,r="utf8");const c=a.dirname(e);o(c,((a,o)=>a?s(a):o?n.writeFile(e,t,r,s):void i.mkdirs(c,(a=>{if(a)return s(a);n.writeFile(e,t,r,s)}))))})),outputFileSync:function(e,...t){const o=a.dirname(e);if(n.existsSync(o))return n.writeFileSync(e,...t);i.mkdirsSync(o),n.writeFileSync(e,...t)}},gp}(),el(),il());const a=n;Object.getOwnPropertyDescriptor(a,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>a.promises})}(zp)),zp.exports}function fl(){if(Op)return jp;Op=1;const e=xs()("streamroller:fileNameFormatter"),n=t;return jp=({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))},jp}function ml(){if(_p)return Cp;_p=1;const e=xs()("streamroller:fileNameParser"),n=Os();return Cp=({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}},Cp}function hl(){if(Fp)return Ap;Fp=1;const e=xs()("streamroller:moveAndMaybeCompressFile"),n=dl(),t=f;return Ap=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")},Ap}function vl(){if(Pp)return Tp;Pp=1;const e=xs()("streamroller:RollingFileWriteStream"),n=dl(),a=t,i=o,r=Ep?kp:(Ep=1,kp=()=>new Date),s=Os(),{Writable:c}=d,p=fl(),l=ml(),u=hl();return Tp=class extends c{constructor(n,t){if(e(`constructor: creating RollingFileWriteStream. path=${n}`),"string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(a.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${a.sep}`)&&(n=n.replace("~",i.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=a.parse(n),""===this.fileObject.dir&&(this.fileObject=a.parse(a.join(process.cwd(),n))),this.fileFormatter=p({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=l({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=s(this.options.pattern,r())),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=s(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!==s(this.options.pattern,r())}_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 u(n,a,i)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?s(this.options.pattern,r()):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)),i=e=>(e.timestamp?e.timestamp:r().getTime())-e.index;return a.sort(((e,n)=>i(e)-i(n))),a}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return n.mkdirSync(e,{recursive:!0})}catch(i){if("ENOENT"===i.code)return t(a.dirname(e)),t(e);if("EEXIST"!==i.code&&"EROFS"!==i.code)throw i;try{if(n.statSync(e).isDirectory())return e;throw i}catch(e){throw i}}};t(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 t=await this._getExistingFiles();if(e(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${t.length}`),e("_clean: existing files are: ",t),this._tooManyFiles(t.length)){const o=t.slice(0,t.length-this.options.numToKeep).map((e=>a.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}},Tp}function xl(){if(Ip)return Np;Ip=1;const e=vl();return Np=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 bl(){if(Mp)return Lp;Mp=1;const e=vl();return Lp=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 yl(){return Dp?qp:(Dp=1,qp={RollingFileWriteStream:vl(),RollingFileStream:xl(),DateRollingFileStream:bl()})}function gl(){if(Bp)return Rp;Bp=1;const e=xs()("log4js:file"),n=t,a=yl(),i=o,r=i.EOL;let s=!1;const c=new Set;function p(){c.forEach((e=>{e.sighupHandler()}))}return Rp.configure=function(t,o){let l=o.basicLayout;return t.layout&&(l=o.layout(t.layout.type,t.layout)),t.mode=t.mode||384,function(t,o,l,u,d,f){if("string"!=typeof t||0===t.length)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(n.sep))throw new Error(`Filename is a directory: ${t}`);function m(e,n,t,i){const o=new a.RollingFileStream(e,n,t,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===t.indexOf(`~${n.sep}`)&&(t=t.replace("~",i.homedir())),t=n.normalize(t),e("Creating file appender (",t,", ",l,", ",u=u||0===u?u:5,", ",d,", ",f,")");let h=m(t,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(o(e,f)+r,"utf8")||process.emit("log4js:pause",!0)}};return v.reopen=function(){h.end((()=>{h=m(t,l,u,d)}))},v.sighupHandler=function(){e("SIGHUP handler called."),v.reopen()},v.shutdown=function(e){c.delete(v),0===c.size&&s&&(process.removeListener("SIGHUP",p),s=!1),h.end("","utf-8",e)},c.add(v),s||(process.on("SIGHUP",p),s=!0),v}(t.filename,l,t.maxLogSize,t.backups,t,t.timezoneOffset)},Rp}var wl,Sl={};function kl(){if(wl)return Sl;wl=1;const e=yl(),n=o.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 Sl.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)},Sl}var El,jl={};function Ol(){if(El)return jl;El=1;const e=xs()("log4js:fileSync"),a=t,i=n,r=o,s=r.EOL;function c(e,n){const t=e=>{try{return i.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(a.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(i.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(a.dirname(e)),i.appendFileSync(e,"",{mode:n.mode,flag:n.flags})}class p{constructor(n,t,a,o){if(e("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=n,this.size=t,this.backups=a,this.options=o,this.currentSize=0,this.currentSize=function(e){let n=0;try{n=i.statSync(e).size}catch(n){c(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 t=this,o=new RegExp(`^${a.basename(n)}`);function r(e){return o.test(e)}function s(e){return parseInt(e.slice(`${a.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===t.backups)i.truncateSync(n,0);else if(r<t.backups){try{i.unlinkSync(`${n}.${r+1}`)}catch(e){}e(`Renaming ${o} -> ${n}.${r+1}`),i.renameSync(a.join(a.dirname(n),o),`${n}.${r+1}`)}}e("Rolling, rolling, rolling"),e("Renaming the old files"),i.readdirSync(a.dirname(n)).filter(r).sort(c).reverse().forEach(p)}write(n,t){const a=this;e("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),e("writing the chunk to the file"),a.currentSize+=n.length,i.appendFileSync(a.filename,n)}}return jl.configure=function(n,t){let o=t.basicLayout;n.layout&&(o=t.layout(n.layout.type,n.layout));const l={flags:n.flags||"a",encoding:n.encoding||"utf8",mode:n.mode||384};return function(n,t,o,l,u,d){if("string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(a.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${a.sep}`)&&(n=n.replace("~",r.homedir())),n=a.normalize(n),e("Creating fileSync appender (",n,", ",o,", ",l=l||0===l?l:5,", ",u,", ",d,")");const f=function(e,n,t){let a;var o;return n?a=new p(e,n,t,u):(c(o=e,u),a={write(e){i.appendFileSync(o,e)}}),a}(n,o,l);return e=>{f.write(t(e,d)+s)}}(n.filename,o,n.maxLogSize,n.backups,l,n.timezoneOffset)},jl}var Cl,_l,Al={};function Fl(){if(Cl)return Al;Cl=1;const e=xs()("log4js:tcp"),n=r;return Al.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)},Al}function Tl(){if(_l)return Is.exports;_l=1;const e=t,n=xs()("log4js:appenders"),a=ys(),i=qs(),o=_s(),r=Cs(),s=Rs(),p=new Map;p.set("console",Us()),p.set("stdout",Hs()),p.set("stderr",Vs()),p.set("logLevelFilter",(Zs||(Zs=1,Qs.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)}),Qs)),p.set("categoryFilter",ec()),p.set("noLogFilter",ac()),p.set("file",gl()),p.set("dateFile",kl()),p.set("fileSync",Ol()),p.set("tcp",Fl());const l=new Map,u=(e,t)=>{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 a.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},d=new Set,f=(e,t)=>{if(l.has(e))return l.get(e);if(!t.appenders[e])return!1;if(d.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);d.add(e),n(`Creating appender ${e}`);const a=m(e,t);return d.delete(e),l.set(e,a),a},m=(t,l)=>{const d=l.appenders[t],m=d.type.configure?d.type:((n,t)=>p.get(n)||u(`./${n}`,t)||u(n,t)||require.main&&require.main.filename&&u(e.join(e.dirname(require.main.filename),n),t)||u(e.join(process.cwd(),n),t))(d.type,l);return a.throwExceptionIf(l,a.not(m),`appender "${t}" is not valid (type "${d.type}" could not be found)`),m.appender&&(process.emitWarning(`Appender ${d.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),n("[log4js-node-DEP0001]",`DEPRECATION: Appender ${d.type} exports an appender function.`)),m.shutdown&&(process.emitWarning(`Appender ${d.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),n("[log4js-node-DEP0002]",`DEPRECATION: Appender ${d.type} exports a shutdown function.`)),n(`${t}: clustering.isMaster ? ${i.isMaster()}`),n(`${t}: appenderModule is ${c.inspect(m)}`),i.onlyOnMaster((()=>(n(`calling appenderModule.configure for ${t} / ${d.type}`),m.configure(s.modifyConfig(d),r,(e=>f(e,l)),o))),(()=>{}))},h=e=>{if(l.clear(),d.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)&&f(t,e)}))},v=()=>{h()};return v(),a.addListener((e=>{a.throwExceptionIf(e,a.not(a.anObject(e.appenders)),'must have a property "appenders" of type object.');const n=Object.keys(e.appenders);a.throwExceptionIf(e,a.not(n.length),"must define at least one appender."),n.forEach((n=>{a.throwExceptionIf(e,a.not(e.appenders[n].type),`appender "${n}" is not valid (must be an object with property "type")`)}))})),a.addListener(h),Is.exports=l,Is.exports.init=v,Is.exports}var Pl,Nl,Il,Ll,Ml,ql,Dl,Bl,Rl,zl={exports:{}};function $l(){return Pl||(Pl=1,function(e){const n=xs()("log4js:categories"),t=ys(),a=_s(),i=Tl(),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})}(zl)),zl.exports}function Ul(){if(Ml)return Ll;Ml=1;const e=_s();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 Ll=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 Wl(){if(Dl)return ql;Dl=1;const e=xs()("log4js:recording"),n=[];function t(){return n.slice()}function a(){n.length=0}return ql={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 Gl=function(){if(Rl)return Bl;Rl=1;const e=xs()("log4js:main"),t=n,a=bs()({proto:!0}),i=ys(),o=Cs(),r=_s(),s=Tl(),c=$l(),p=function(){if(Il)return Nl;Il=1;const e=xs()("log4js:logger"),n=Ms(),t=_s(),a=qs(),i=$l(),o=ys(),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)})),Nl=c}(),l=qs(),u=Ul(),d=Wl();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 Bl=x}(),Hl=q(Gl);(()=>{const e=process.env.NODE_ENV||"production",a=_();let i=t.resolve(a,"env");switch(function(e){try{return n.statSync(e).isDirectory()}catch(e){return e.code,!1}}(i)||(i=t.resolve(a,"..","env")),console.log("load env path: ",i),p.config({path:t.resolve(i,".common.env")}),e){case"development":p.config({path:t.resolve(i,".development.env")});break;case"test":p.config({path:t.resolve(i,".test.env")});break;case"production":p.config({path:t.resolve(i,".production.env")})}})();exports.AuthRouter=function(e,n){return S(e,n,!0)},exports.BaseException=C,exports.INDEX_ROUTE=y,exports.Router=function(e,n){return S(e,n)},exports.contextStore=k,exports.errorRsp=O,exports.getCurrentContext=E,exports.getSrcModulePaths=A,exports.initializeKoaApp=async e=>{const{koaInstance:n,authCheckCallback:t,catchErrorCallback:i,registerHighPriorityMiddleware:o,registerHook:r,log4:s=!1}=e;try{(e=>{const{controllerModule:n,validateModule:t}=A();console.log("load controller path: ",n),T(n,(n=>{if(!n.path.includes("controller"))return;const a=F(n.wholePath),i=a?.routesMap;i&&yt(t,n,i,((t,a)=>!t||e({filePath:n,ctx:a})))}))})(t)}catch(e){console.error("registerControllers error",e)}const c=n||new a;c.context.validated={params:{},get:{},post:{}},c.context.log4=(e=>{if(!1!==e)return"boolean"==typeof e&&!0===e?Hl.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(Hl)})(s),c.use((async(e,n)=>{r?.(e,"request"),await n(),r?.(e,"response")})),c.use(I),o?.(c);return c.use(((e,n)=>async(t,a)=>{try{await a()}catch(a){e(t),n?n(a,t):O(500,{message:a.message})}})((e=>r?.(e,"error")),i)),c.use(ns()),c.use(ts),"development"!==process.env.NODE_ENV&&"true"!==process.env.DOC||L.get("/doc",(async e=>{const n=await(async()=>{const e=[],n=new Map;return T(kt.DOCUMENTATION_DIR,(n=>{const{pathPrefix:t}=P(n,"doc");e.push(Et(n,t))})),e.forEach((e=>{n.has(e.pathPrefix)||n.set(e.pathPrefix,[]),n.get(e.pathPrefix)?.push(e)})),St({apiData:Array.from(n.entries())})})();e.body=n})),L.get("/",(async e=>{e.body={code:200,message:"hello koa-ts-cli https://www.npmjs.com/package/koa-ts-core"}})),c.use(L.routes()),await(async e=>{const n=process.env.APP_PORT;if(n){const t=e.listen(Number(n));return void t.on("listening",(()=>bt(t)))}const t=await vt.getPortPromise({port:8e3,stopPort:9999});e.listen=(...n)=>{const a=0===n.length?xt.apply(e,[t]):xt.apply(e,n);return a.on("listening",(()=>bt(a))),a}})(c),[c,L]},exports.successRsp=e=>{const n=Array.isArray(e?.data);j({success:!0,message:e?.message,data:n?{list:e?.data}:e?.data})},exports.unSuccessRsp=e=>{j({success:!1,errorCode:e?.code,errorMessage:e?.message,data:e?.data})};
|
package/dist/index.d.ts
CHANGED
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 ps=function(){if(fr)return dr;fr=1;const e=cs(),n=function(){if(ur)return lr;ur=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 lr=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},lr}(),t=Ht();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 dr=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()}}}(),ls=H(ps);const us=async(e,n)=>{e.extra={get:e.query,post:e.request.body??{}},await n()};var ds,fs,ms,hs={exports:{}},vs={exports:{}};function xs(){if(fs)return ds;return fs=1,ds=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=vt(),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},ds}var bs,ys,gs,ws,Ss,ks,Es={exports:{}};function js(){return bs||(bs=1,function(e,n){const t=d,a=f;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} [0m`;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"[0m")}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=xs()(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)}}(Es,Es.exports)),Es.exports}function Os(){return ys||(ys=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?hs.exports=(ms||(ms=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=xs()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(vs,vs.exports)),vs.exports):hs.exports=js()),hs.exports}function Cs(){if(ws)return gs;function e(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}return ws=1,gs=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}},gs}function _s(){if(ks)return Ss;ks=1;const e=f,n=Os()("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 Ss={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 As,Fs,Ts,Ps,Ns,Is={exports:{}};function Ls(){return As||(As=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"}(Is)),Is.exports}function Ms(){if(Ts)return Fs;Ts=1;const e=Ls(),n=l,t=f,a=o,i=y,r=Os()("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 u(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 d(e){return u(e)+t.format(...e.data)}function m(e){return u(e,e.level.colour)+t.format(...e.data)}function h(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:()=>h,basic:()=>d,colored:()=>m,coloured:()=>m,pattern:e=>x(e&&e.pattern,e&&e.tokens),dummy:()=>v};return Fs={basicLayout:d,messagePassThroughLayout:h,patternLayout:x,colouredLayout:m,coloredLayout:m,dummyLayout:v,addLayout(e,n){b[e]=n},layout:(e,n)=>b[e]&&b[e](n)}}function Ds(){if(Ns)return Ps;Ns=1;const e=_s(),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)})),Ps=t}var Bs,qs,Rs,zs,$s,Us={exports:{}},Ws={};function Gs(){if(Rs)return qs;Rs=1;const e=function(){if(Bs)return Ws;Bs=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)};Ws.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 Ws.stringify=f,Ws.toJSON=n=>e(f(n)),Ws.fromJSON=e=>d(n(e)),Ws}(),n=Ds();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 qs=a}function Hs(){if($s)return zs;$s=1;const e=Os()("log4js:clustering"),n=Gs(),t=_s();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")})),zs={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 Js,Ks={};function Vs(){if(Js)return Ks;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)}Js=1;const t={dateFile:n,file:n,fileSync:n};return Ks.modifyConfig=e=>t[e.type]?t[e.type](e):e,Ks}var Zs,Qs={};function Ys(){if(Zs)return Qs;Zs=1;const e=console.log.bind(console);return Qs.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)},Qs}var Xs,ec={};function nc(){if(Xs)return ec;return Xs=1,ec.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)},ec}var tc,ac={};function ic(){if(tc)return ac;return tc=1,ac.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)},ac}var oc,rc={};var sc,cc={};function pc(){if(sc)return cc;sc=1;const e=Os()("log4js:categoryFilter");return cc.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)},cc}var lc,uc={};function dc(){if(lc)return uc;lc=1;const e=Os()("log4js:noLogFilter");return uc.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)},uc}var 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,Jp,Kp,Vp={},Zp={exports:{}},Qp={},Yp={};function Xp(){return fc||(fc=1,Yp.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})},Yp.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})}),Yp}function el(){if(hc)return mc;hc=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 mc=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},mc}function nl(){if(wc)return gc;wc=1;var e,t,a=n,i=el(),o=function(){if(xc)return vc;xc=1;var e=x.Stream;return vc=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())}}},vc}(),r=function(){if(yc)return bc;yc=1,bc=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 bc}(),s=f;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=G[e]||[];c(a,u),a.close=function(e){function n(n,t){return e.call(a,n,(function(e){e||h(),"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),h()}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 d(e){i(e),e.gracefulify=d,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):m([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):m([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):m([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):m([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)):m([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 f=v;Object.defineProperty(e,"FileReadStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var h=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 h},set:function(e){h=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):m([e,[n,t,a,i],r,o||Date.now(),Date.now()])}))}(e,n,t,a)}return e.open=y,e}function m(n){l("ENQUEUE",n[0].name,n[1]),a[e].push(n),v()}function h(){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);v()}function v(){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(v,0))}}return G[e]||c(G,a[e]),gc=d(r(a)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!a.__patched&&(gc=d(a),a.__patched=!0),gc}function tl(){return Sc||(Sc=1,function(e){const n=Xp().fromCallback,t=nl(),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))}(Qp)),Qp}function al(){if(Ec)return kc;Ec=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 kc={getRootPath:n,invalidWin32Path:function(e){const a=n(e);return e=e.replace(a,""),t.test(e)}}}function il(){if(Fc)return Ac;Fc=1;const e=(0,Xp().fromCallback)(function(){if(Oc)return jc;Oc=1;const e=nl(),n=o,t=al().invalidWin32Path,a=parseInt("0777",8);return jc=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)}))}))},jc}()),n=function(){if(_c)return Cc;_c=1;const e=nl(),n=o,t=al().invalidWin32Path,a=parseInt("0777",8);return Cc=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},Cc}();return Ac={mkdirs:e,mkdirsSync:n,mkdirp:e,mkdirpSync:n,ensureDir:e,ensureDirSync:n}}function ol(){if(Pc)return Tc;Pc=1;const e=nl(),n=l,t=o;return Tc={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 rl(){if(Ic)return Nc;Ic=1;const e=nl(),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 Nc={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},Nc}function sl(){if(Bc)return Dc;Bc=1;const e=nl(),n=o,t=il().mkdirsSync,a=ol().utimesMillisSync,i=rl();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=(Mc?Lc:(Mc=1,Lc=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 Dc=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)},Dc}function cl(){return Rc?qc:(Rc=1,qc={copySync:sl()})}function pl(){if($c)return zc;$c=1;const e=Xp().fromPromise,n=tl();return zc={pathExists:e((function(e){return n.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:n.existsSync}}function ll(){if(Wc)return Uc;Wc=1;const e=nl(),n=o,t=il().mkdirs,a=pl().pathExists,i=ol().utimesMillis,r=rl();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 Uc=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)))}))},Uc}function ul(){if(Hc)return Gc;Hc=1;const e=Xp().fromCallback;return Gc={copy:e(ll())}}function dl(){if(Kc)return Jc;Kc=1;const e=nl(),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 Jc=r,r.sync=u,Jc}function fl(){if(Zc)return Vc;Zc=1;const e=Xp().fromCallback,n=dl();return Vc={remove:e(n),removeSync:n.sync}}function ml(){if(ep)return Xc;ep=1;const e=Xp().fromCallback,n=o,t=nl(),a=il(),i=pl().pathExists;return Xc={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,"")}},Xc}function hl(){if(tp)return np;tp=1;const e=Xp().fromCallback,n=o,t=nl(),a=il(),i=pl().pathExists;return np={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)}},np}function vl(){if(cp)return sp;cp=1;const e=Xp().fromCallback,n=o,t=nl(),a=il(),i=a.mkdirs,r=a.mkdirsSync,s=function(){if(ip)return ap;ip=1;const e=o,n=nl(),t=pl().pathExists;return ap={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(rp)return op;rp=1;const e=nl();return op={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"}},op}(),u=l.symlinkType,d=l.symlinkTypeSync,f=pl().pathExists;return sp={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)}},sp}function xl(){if(mp)return fp;mp=1;const e=Xp().fromCallback,t=function(){if(dp)return up;var e;dp=1;try{e=nl()}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 up=i}();return fp={readJson:e(t.readFile),readJsonSync:t.readFileSync,writeJson:e(t.writeFile),writeJsonSync:t.writeFileSync}}function bl(){if(gp)return yp;gp=1;const e=Xp().fromCallback,n=xl();return n.outputJson=e(function(){if(vp)return hp;vp=1;const e=o,n=il(),t=pl().pathExists,a=xl();return hp=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)}))))},hp}()),n.outputJsonSync=function(){if(bp)return xp;bp=1;const e=nl(),n=o,t=il(),a=xl();return xp=function(i,o,r){const s=n.dirname(i);e.existsSync(s)||t.mkdirsSync(s),a.writeJsonSync(i,o,r)},xp}(),n.outputJSON=n.outputJson,n.outputJSONSync=n.outputJsonSync,n.writeJSON=n.writeJson,n.writeJSONSync=n.writeJsonSync,n.readJSON=n.readJson,n.readJSONSync=n.readJsonSync,yp=n}function yl(){if(Sp)return wp;Sp=1;const e=nl(),n=o,t=cl().copySync,a=fl().removeSync,i=il().mkdirpSync,r=rl();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 wp=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)},wp}function gl(){if(Op)return jp;Op=1;const e=nl(),n=o,t=ul().copy,a=fl().remove,i=il().mkdirp,r=pl().pathExists,s=rl();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 jp=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)))}))}))},jp}function wl(){return Tp||(Tp=1,function(e){e.exports=Object.assign({},tl(),cl(),ul(),function(){if(Yc)return Qc;Yc=1;const e=Xp().fromCallback,n=nl(),t=o,a=il(),i=fl(),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 Qc={emptyDirSync:s,emptydirSync:s,emptyDir:r,emptydir:r}}(),function(){if(lp)return pp;lp=1;const e=ml(),n=hl(),t=vl();return pp={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}}(),bl(),il(),Ep?kp:(Ep=1,kp={moveSync:yl()}),function(){if(_p)return Cp;_p=1;const e=Xp().fromCallback;return Cp={move:e(gl())}}(),function(){if(Fp)return Ap;Fp=1;const e=Xp().fromCallback,n=nl(),t=o,a=il(),i=pl().pathExists;return Ap={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)}},Ap}(),pl(),fl());const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Zp)),Zp.exports}function Sl(){if(Lp)return Ip;Lp=1;const e=Os()("streamroller:fileNameFormatter"),n=o;return Ip=({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))},Ip}function kl(){if(Dp)return Mp;Dp=1;const e=Os()("streamroller:fileNameParser"),n=Ls();return Mp=({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}},Mp}function El(){if(qp)return Bp;qp=1;const e=Os()("streamroller:moveAndMaybeCompressFile"),n=wl(),t=b;return Bp=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")},Bp}function jl(){if(zp)return Rp;zp=1;const e=Os()("streamroller:RollingFileWriteStream"),n=wl(),t=o,a=l,i=Np?Pp:(Np=1,Pp=()=>new Date),r=Ls(),{Writable:s}=x,c=Sl(),p=kl(),u=El();return Rp=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 u(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}},Rp}function Ol(){if(Up)return $p;Up=1;const e=jl();return $p=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 Cl(){if(Gp)return Wp;Gp=1;const e=jl();return Wp=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 _l(){return Jp?Hp:(Jp=1,Hp={RollingFileWriteStream:jl(),RollingFileStream:Ol(),DateRollingFileStream:Cl()})}function Al(){if(Kp)return Vp;Kp=1;const e=Os()("log4js:file"),n=o,t=_l(),a=l,i=a.EOL;let r=!1;const s=new Set;function c(){s.forEach((e=>{e.sighupHandler()}))}return Vp.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)},Vp}var Fl,Tl={};function Pl(){if(Fl)return Tl;Fl=1;const e=_l(),n=l.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 Tl.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)},Tl}var Nl,Il={};function Ll(){if(Nl)return Il;Nl=1;const e=Os()("log4js:fileSync"),t=o,a=n,i=l,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 Il.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)},Il}var Ml,Dl,Bl={};function ql(){if(Ml)return Bl;Ml=1;const e=Os()("log4js:tcp"),n=u;return Bl.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)},Bl}function Rl(){if(Dl)return Us.exports;Dl=1;const e=o,n=Os()("log4js:appenders"),t=_s(),a=Hs(),i=Ds(),r=Ms(),s=Vs(),c=new Map;c.set("console",Ys()),c.set("stdout",nc()),c.set("stderr",ic()),c.set("logLevelFilter",(oc||(oc=1,rc.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)}),rc)),c.set("categoryFilter",pc()),c.set("noLogFilter",dc()),c.set("file",Al()),c.set("dateFile",Pl()),c.set("fileSync",Ll()),c.set("tcp",ql());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=m(e,t);return u.delete(e),p.set(e,a),a},m=(o,p)=>{const u=p.appenders[o],m=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(m),`appender "${o}" is not valid (type "${u.type}" could not be found)`),m.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.`)),m.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 ${f.inspect(m)}`),a.onlyOnMaster((()=>(n(`calling appenderModule.configure for ${o} / ${u.type}`),m.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),Us.exports=p,Us.exports.init=v,Us.exports}var zl,$l,Ul,Wl,Gl,Hl,Jl,Kl,Vl,Zl={exports:{}};function Ql(){return zl||(zl=1,function(e){const n=Os()("log4js:categories"),t=_s(),a=Ds(),i=Rl(),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})}(Zl)),Zl.exports}function Yl(){if(Gl)return Wl;Gl=1;const e=Ds();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 Wl=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 Xl(){if(Jl)return Hl;Jl=1;const e=Os()("log4js:recording"),n=[];function t(){return n.slice()}function a(){n.length=0}return Hl={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 eu=function(){if(Vl)return Kl;Vl=1;const e=Os()("log4js:main"),t=n,a=Cs()({proto:!0}),i=_s(),o=Ms(),r=Ds(),s=Rl(),c=Ql(),p=function(){if(Ul)return $l;Ul=1;const e=Os()("log4js:logger"),n=Gs(),t=Ds(),a=Hs(),i=Ql(),o=_s(),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)})),$l=c}(),l=Hs(),u=Yl(),d=Xl();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 Kl=x}(),nu=H(eu);(()=>{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),m.config({path:r(a,".common.env")}),e){case"development":m.config({path:r(a,".development.env")});break;case"test":m.config({path:r(a,".test.env")});break;case"production":m.config({path:r(a,".production.env")})}})();const tu=async e=>{const{koaInstance:n,authCheckCallback:t,catchErrorCallback:a,registerHighPriorityMiddleware:i,registerHook:o,log4:r=!1}=e;try{(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&&_t(t,n,i,((t,a)=>!t||e({filePath:n,ctx:a})))}))})(t)}catch(e){console.error("registerControllers error",e)}const s=n||new c;s.context.log4=(e=>{if(!1!==e)return"boolean"==typeof e&&!0===e?nu.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(nu)})(r),s.use((async(e,n)=>{o?.(e,"request"),await n(),o?.(e,"response")})),s.use(U),i?.(s);return s.use(((e,n)=>async(t,a)=>{try{await a()}catch(a){e(t),n?n(a,t):L(500,{message:a.message})}})((e=>o?.(e,"error")),a)),s.use(ls()),s.use(us),"development"!==process.env.NODE_ENV&&"true"!==process.env.DOC||W.get("/doc",(async e=>{const n=await(async()=>{const e=[],n=new Map;return R(Pt.DOCUMENTATION_DIR,(n=>{const{pathPrefix:t}=z(n,"doc");e.push(Nt(n,t))})),e.forEach((e=>{n.has(e.pathPrefix)||n.set(e.pathPrefix,[]),n.get(e.pathPrefix)?.push(e)})),Tt({apiData:Array.from(n.entries())})})();e.body=n})),W.get("/",(async e=>{e.body={code:200,message:"hello koa-ts-cli https://www.npmjs.com/package/koa-ts-core"}})),s.use(W.routes()),await(async e=>{const n=process.env.APP_PORT;if(n){const t=e.listen(Number(n));return void t.on("listening",(()=>Ct(t)))}const t=await jt.getPortPromise({port:8e3,stopPort:9999});e.listen=(...n)=>{const a=0===n.length?Ot.apply(e,[t]):Ot.apply(e,n);return a.on("listening",(()=>Ct(a))),a}})(s),[s,W]};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 ps=function(){if(fr)return dr;fr=1;const e=cs(),n=function(){if(ur)return lr;ur=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 lr=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},lr}(),t=Ht();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 dr=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()}}}(),ls=H(ps);const us=async(e,n)=>{e.extra={get:e.query,post:e.request.body??{}},await n()};var ds,fs,ms,hs={exports:{}},vs={exports:{}};function xs(){if(fs)return ds;return fs=1,ds=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=vt(),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},ds}var bs,ys,gs,ws,Ss,ks,Es={exports:{}};function js(){return bs||(bs=1,function(e,n){const t=d,a=f;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} [0m`;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"[0m")}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=xs()(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)}}(Es,Es.exports)),Es.exports}function Os(){return ys||(ys=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?hs.exports=(ms||(ms=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=xs()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(vs,vs.exports)),vs.exports):hs.exports=js()),hs.exports}function Cs(){if(ws)return gs;function e(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}return ws=1,gs=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}},gs}function _s(){if(ks)return Ss;ks=1;const e=f,n=Os()("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 Ss={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 As,Fs,Ts,Ps,Ns,Is={exports:{}};function Ls(){return As||(As=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"}(Is)),Is.exports}function Ms(){if(Ts)return Fs;Ts=1;const e=Ls(),n=l,t=f,a=o,i=y,r=Os()("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 u(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 d(e){return u(e)+t.format(...e.data)}function m(e){return u(e,e.level.colour)+t.format(...e.data)}function h(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:()=>h,basic:()=>d,colored:()=>m,coloured:()=>m,pattern:e=>x(e&&e.pattern,e&&e.tokens),dummy:()=>v};return Fs={basicLayout:d,messagePassThroughLayout:h,patternLayout:x,colouredLayout:m,coloredLayout:m,dummyLayout:v,addLayout(e,n){b[e]=n},layout:(e,n)=>b[e]&&b[e](n)}}function Ds(){if(Ns)return Ps;Ns=1;const e=_s(),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)})),Ps=t}var Bs,qs,Rs,zs,$s,Us={exports:{}},Ws={};function Gs(){if(Rs)return qs;Rs=1;const e=function(){if(Bs)return Ws;Bs=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)};Ws.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 Ws.stringify=f,Ws.toJSON=n=>e(f(n)),Ws.fromJSON=e=>d(n(e)),Ws}(),n=Ds();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 qs=a}function Hs(){if($s)return zs;$s=1;const e=Os()("log4js:clustering"),n=Gs(),t=_s();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")})),zs={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 Js,Ks={};function Vs(){if(Js)return Ks;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)}Js=1;const t={dateFile:n,file:n,fileSync:n};return Ks.modifyConfig=e=>t[e.type]?t[e.type](e):e,Ks}var Zs,Qs={};function Ys(){if(Zs)return Qs;Zs=1;const e=console.log.bind(console);return Qs.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)},Qs}var Xs,ec={};function nc(){if(Xs)return ec;return Xs=1,ec.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)},ec}var tc,ac={};function ic(){if(tc)return ac;return tc=1,ac.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)},ac}var oc,rc={};var sc,cc={};function pc(){if(sc)return cc;sc=1;const e=Os()("log4js:categoryFilter");return cc.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)},cc}var lc,uc={};function dc(){if(lc)return uc;lc=1;const e=Os()("log4js:noLogFilter");return uc.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)},uc}var 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,Jp,Kp,Vp={},Zp={exports:{}},Qp={},Yp={};function Xp(){return fc||(fc=1,Yp.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})},Yp.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})}),Yp}function el(){if(hc)return mc;hc=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 mc=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},mc}function nl(){if(wc)return gc;wc=1;var e,t,a=n,i=el(),o=function(){if(xc)return vc;xc=1;var e=x.Stream;return vc=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())}}},vc}(),r=function(){if(yc)return bc;yc=1,bc=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 bc}(),s=f;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=G[e]||[];c(a,u),a.close=function(e){function n(n,t){return e.call(a,n,(function(e){e||h(),"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),h()}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 d(e){i(e),e.gracefulify=d,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):m([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):m([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):m([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):m([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)):m([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 f=v;Object.defineProperty(e,"FileReadStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var h=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 h},set:function(e){h=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):m([e,[n,t,a,i],r,o||Date.now(),Date.now()])}))}(e,n,t,a)}return e.open=y,e}function m(n){l("ENQUEUE",n[0].name,n[1]),a[e].push(n),v()}function h(){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);v()}function v(){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(v,0))}}return G[e]||c(G,a[e]),gc=d(r(a)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!a.__patched&&(gc=d(a),a.__patched=!0),gc}function tl(){return Sc||(Sc=1,function(e){const n=Xp().fromCallback,t=nl(),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))}(Qp)),Qp}function al(){if(Ec)return kc;Ec=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 kc={getRootPath:n,invalidWin32Path:function(e){const a=n(e);return e=e.replace(a,""),t.test(e)}}}function il(){if(Fc)return Ac;Fc=1;const e=(0,Xp().fromCallback)(function(){if(Oc)return jc;Oc=1;const e=nl(),n=o,t=al().invalidWin32Path,a=parseInt("0777",8);return jc=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)}))}))},jc}()),n=function(){if(_c)return Cc;_c=1;const e=nl(),n=o,t=al().invalidWin32Path,a=parseInt("0777",8);return Cc=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},Cc}();return Ac={mkdirs:e,mkdirsSync:n,mkdirp:e,mkdirpSync:n,ensureDir:e,ensureDirSync:n}}function ol(){if(Pc)return Tc;Pc=1;const e=nl(),n=l,t=o;return Tc={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 rl(){if(Ic)return Nc;Ic=1;const e=nl(),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 Nc={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},Nc}function sl(){if(Bc)return Dc;Bc=1;const e=nl(),n=o,t=il().mkdirsSync,a=ol().utimesMillisSync,i=rl();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=(Mc?Lc:(Mc=1,Lc=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 Dc=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)},Dc}function cl(){return Rc?qc:(Rc=1,qc={copySync:sl()})}function pl(){if($c)return zc;$c=1;const e=Xp().fromPromise,n=tl();return zc={pathExists:e((function(e){return n.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:n.existsSync}}function ll(){if(Wc)return Uc;Wc=1;const e=nl(),n=o,t=il().mkdirs,a=pl().pathExists,i=ol().utimesMillis,r=rl();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 Uc=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)))}))},Uc}function ul(){if(Hc)return Gc;Hc=1;const e=Xp().fromCallback;return Gc={copy:e(ll())}}function dl(){if(Kc)return Jc;Kc=1;const e=nl(),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 Jc=r,r.sync=u,Jc}function fl(){if(Zc)return Vc;Zc=1;const e=Xp().fromCallback,n=dl();return Vc={remove:e(n),removeSync:n.sync}}function ml(){if(ep)return Xc;ep=1;const e=Xp().fromCallback,n=o,t=nl(),a=il(),i=pl().pathExists;return Xc={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,"")}},Xc}function hl(){if(tp)return np;tp=1;const e=Xp().fromCallback,n=o,t=nl(),a=il(),i=pl().pathExists;return np={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)}},np}function vl(){if(cp)return sp;cp=1;const e=Xp().fromCallback,n=o,t=nl(),a=il(),i=a.mkdirs,r=a.mkdirsSync,s=function(){if(ip)return ap;ip=1;const e=o,n=nl(),t=pl().pathExists;return ap={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(rp)return op;rp=1;const e=nl();return op={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"}},op}(),u=l.symlinkType,d=l.symlinkTypeSync,f=pl().pathExists;return sp={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)}},sp}function xl(){if(mp)return fp;mp=1;const e=Xp().fromCallback,t=function(){if(dp)return up;var e;dp=1;try{e=nl()}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 up=i}();return fp={readJson:e(t.readFile),readJsonSync:t.readFileSync,writeJson:e(t.writeFile),writeJsonSync:t.writeFileSync}}function bl(){if(gp)return yp;gp=1;const e=Xp().fromCallback,n=xl();return n.outputJson=e(function(){if(vp)return hp;vp=1;const e=o,n=il(),t=pl().pathExists,a=xl();return hp=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)}))))},hp}()),n.outputJsonSync=function(){if(bp)return xp;bp=1;const e=nl(),n=o,t=il(),a=xl();return xp=function(i,o,r){const s=n.dirname(i);e.existsSync(s)||t.mkdirsSync(s),a.writeJsonSync(i,o,r)},xp}(),n.outputJSON=n.outputJson,n.outputJSONSync=n.outputJsonSync,n.writeJSON=n.writeJson,n.writeJSONSync=n.writeJsonSync,n.readJSON=n.readJson,n.readJSONSync=n.readJsonSync,yp=n}function yl(){if(Sp)return wp;Sp=1;const e=nl(),n=o,t=cl().copySync,a=fl().removeSync,i=il().mkdirpSync,r=rl();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 wp=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)},wp}function gl(){if(Op)return jp;Op=1;const e=nl(),n=o,t=ul().copy,a=fl().remove,i=il().mkdirp,r=pl().pathExists,s=rl();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 jp=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)))}))}))},jp}function wl(){return Tp||(Tp=1,function(e){e.exports=Object.assign({},tl(),cl(),ul(),function(){if(Yc)return Qc;Yc=1;const e=Xp().fromCallback,n=nl(),t=o,a=il(),i=fl(),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 Qc={emptyDirSync:s,emptydirSync:s,emptyDir:r,emptydir:r}}(),function(){if(lp)return pp;lp=1;const e=ml(),n=hl(),t=vl();return pp={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}}(),bl(),il(),Ep?kp:(Ep=1,kp={moveSync:yl()}),function(){if(_p)return Cp;_p=1;const e=Xp().fromCallback;return Cp={move:e(gl())}}(),function(){if(Fp)return Ap;Fp=1;const e=Xp().fromCallback,n=nl(),t=o,a=il(),i=pl().pathExists;return Ap={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)}},Ap}(),pl(),fl());const t=n;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(Zp)),Zp.exports}function Sl(){if(Lp)return Ip;Lp=1;const e=Os()("streamroller:fileNameFormatter"),n=o;return Ip=({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))},Ip}function kl(){if(Dp)return Mp;Dp=1;const e=Os()("streamroller:fileNameParser"),n=Ls();return Mp=({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}},Mp}function El(){if(qp)return Bp;qp=1;const e=Os()("streamroller:moveAndMaybeCompressFile"),n=wl(),t=b;return Bp=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")},Bp}function jl(){if(zp)return Rp;zp=1;const e=Os()("streamroller:RollingFileWriteStream"),n=wl(),t=o,a=l,i=Np?Pp:(Np=1,Pp=()=>new Date),r=Ls(),{Writable:s}=x,c=Sl(),p=kl(),u=El();return Rp=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 u(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}},Rp}function Ol(){if(Up)return $p;Up=1;const e=jl();return $p=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 Cl(){if(Gp)return Wp;Gp=1;const e=jl();return Wp=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 _l(){return Jp?Hp:(Jp=1,Hp={RollingFileWriteStream:jl(),RollingFileStream:Ol(),DateRollingFileStream:Cl()})}function Al(){if(Kp)return Vp;Kp=1;const e=Os()("log4js:file"),n=o,t=_l(),a=l,i=a.EOL;let r=!1;const s=new Set;function c(){s.forEach((e=>{e.sighupHandler()}))}return Vp.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)},Vp}var Fl,Tl={};function Pl(){if(Fl)return Tl;Fl=1;const e=_l(),n=l.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 Tl.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)},Tl}var Nl,Il={};function Ll(){if(Nl)return Il;Nl=1;const e=Os()("log4js:fileSync"),t=o,a=n,i=l,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 Il.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)},Il}var Ml,Dl,Bl={};function ql(){if(Ml)return Bl;Ml=1;const e=Os()("log4js:tcp"),n=u;return Bl.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)},Bl}function Rl(){if(Dl)return Us.exports;Dl=1;const e=o,n=Os()("log4js:appenders"),t=_s(),a=Hs(),i=Ds(),r=Ms(),s=Vs(),c=new Map;c.set("console",Ys()),c.set("stdout",nc()),c.set("stderr",ic()),c.set("logLevelFilter",(oc||(oc=1,rc.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)}),rc)),c.set("categoryFilter",pc()),c.set("noLogFilter",dc()),c.set("file",Al()),c.set("dateFile",Pl()),c.set("fileSync",Ll()),c.set("tcp",ql());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=m(e,t);return u.delete(e),p.set(e,a),a},m=(o,p)=>{const u=p.appenders[o],m=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(m),`appender "${o}" is not valid (type "${u.type}" could not be found)`),m.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.`)),m.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 ${f.inspect(m)}`),a.onlyOnMaster((()=>(n(`calling appenderModule.configure for ${o} / ${u.type}`),m.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),Us.exports=p,Us.exports.init=v,Us.exports}var zl,$l,Ul,Wl,Gl,Hl,Jl,Kl,Vl,Zl={exports:{}};function Ql(){return zl||(zl=1,function(e){const n=Os()("log4js:categories"),t=_s(),a=Ds(),i=Rl(),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})}(Zl)),Zl.exports}function Yl(){if(Gl)return Wl;Gl=1;const e=Ds();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 Wl=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 Xl(){if(Jl)return Hl;Jl=1;const e=Os()("log4js:recording"),n=[];function t(){return n.slice()}function a(){n.length=0}return Hl={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 eu=function(){if(Vl)return Kl;Vl=1;const e=Os()("log4js:main"),t=n,a=Cs()({proto:!0}),i=_s(),o=Ms(),r=Ds(),s=Rl(),c=Ql(),p=function(){if(Ul)return $l;Ul=1;const e=Os()("log4js:logger"),n=Gs(),t=Ds(),a=Hs(),i=Ql(),o=_s(),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)})),$l=c}(),l=Hs(),u=Yl(),d=Xl();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 Kl=x}(),nu=H(eu);(()=>{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),m.config({path:r(a,".common.env")}),e){case"development":m.config({path:r(a,".development.env")});break;case"test":m.config({path:r(a,".test.env")});break;case"production":m.config({path:r(a,".production.env")})}})();const tu=async e=>{const{koaInstance:n,authCheckCallback:t,catchErrorCallback:a,registerHighPriorityMiddleware:i,registerHook:o,log4:r=!1}=e;try{(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&&_t(t,n,i,((t,a)=>!t||e({filePath:n,ctx:a})))}))})(t)}catch(e){console.error("registerControllers error",e)}const s=n||new c;s.context.validated={params:{},get:{},post:{}},s.context.log4=(e=>{if(!1!==e)return"boolean"==typeof e&&!0===e?nu.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(nu)})(r),s.use((async(e,n)=>{o?.(e,"request"),await n(),o?.(e,"response")})),s.use(U),i?.(s);return s.use(((e,n)=>async(t,a)=>{try{await a()}catch(a){e(t),n?n(a,t):L(500,{message:a.message})}})((e=>o?.(e,"error")),a)),s.use(ls()),s.use(us),"development"!==process.env.NODE_ENV&&"true"!==process.env.DOC||W.get("/doc",(async e=>{const n=await(async()=>{const e=[],n=new Map;return R(Pt.DOCUMENTATION_DIR,(n=>{const{pathPrefix:t}=z(n,"doc");e.push(Nt(n,t))})),e.forEach((e=>{n.has(e.pathPrefix)||n.set(e.pathPrefix,[]),n.get(e.pathPrefix)?.push(e)})),Tt({apiData:Array.from(n.entries())})})();e.body=n})),W.get("/",(async e=>{e.body={code:200,message:"hello koa-ts-cli https://www.npmjs.com/package/koa-ts-core"}})),s.use(W.routes()),await(async e=>{const n=process.env.APP_PORT;if(n){const t=e.listen(Number(n));return void t.on("listening",(()=>Ct(t)))}const t=await jt.getPortPromise({port:8e3,stopPort:9999});e.listen=(...n)=>{const a=0===n.length?Ot.apply(e,[t]):Ot.apply(e,n);return a.on("listening",(()=>Ct(a))),a}})(s),[s,W]};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};
|