@ckirg/corelib-cloud 0.1.22 → 0.2.0
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/aws/RequestUnlimited-CXTEHPLC.mjs +2 -0
- package/dist/aws/bun-THMEYPJD.mjs +2 -0
- package/dist/aws/chunk-6G4LF4KV.mjs +2 -0
- package/dist/aws/{chunk-F2KTMAO3.mjs → chunk-BIWQVQOH.mjs} +1 -1
- package/dist/aws/{chunk-Y7RZHZ53.mjs → chunk-QDX5GFCD.mjs} +1 -1
- package/dist/aws/chunk-QE5QGPOG.mjs +24 -0
- package/dist/aws/{chunk-V3XZ4XYN.mjs → chunk-XFLNYUID.mjs} +1 -1
- package/dist/aws/chunk-Z5QO7O62.mjs +8 -0
- package/dist/aws/chunk-ZGHY5A62.mjs +2 -0
- package/dist/aws/cloudflare-QTQSRNP7.mjs +2 -0
- package/dist/aws/deno-BKEQIY74.mjs +2 -0
- package/dist/{cloudrun/gcp-W76U73T6.js → aws/gcp-VNE5WPOL.mjs} +1 -1
- package/dist/aws/handler.mjs +3 -3
- package/dist/aws/lambda-4S67INQI.mjs +3 -0
- package/dist/aws/node-RQLZ4GQE.mjs +2 -0
- package/dist/aws/utils-5YBC32TV.mjs +2 -0
- package/dist/cloudflare/RequestUnlimited-OE7GCYBY.js +1 -0
- package/dist/cloudflare/bun-B6T46QQU.js +1 -0
- package/dist/cloudflare/{chunk-QPTGW2LL.js → chunk-BHGBRQZV.js} +1 -1
- package/dist/cloudflare/{chunk-EQSCULS7.js → chunk-GY2JCE4G.js} +2 -2
- package/dist/cloudflare/chunk-QPM32MRA.js +1 -0
- package/dist/cloudflare/chunk-VBA2ACKG.js +1 -0
- package/dist/cloudflare/{chunk-DGDAVQYC.js → chunk-ZMQIBLAC.js} +1 -1
- package/dist/cloudflare/cloudflare-CTNLQDS4.js +1 -0
- package/dist/cloudflare/deno-2KIX5TV5.js +1 -0
- package/dist/cloudflare/gcp-GBGWAZSX.js +1 -0
- package/dist/cloudflare/lambda-6HQKP6G3.js +1 -0
- package/dist/cloudflare/node-BRA7RBP5.js +1 -0
- package/dist/cloudflare/utils-3L6PYJAG.js +1 -0
- package/dist/cloudflare/worker.js +3 -3
- package/dist/cloudrun/RequestUnlimited-DEASSJEC.js +2 -0
- package/dist/cloudrun/bun-MBTNJC4U.js +2 -0
- package/dist/cloudrun/{chunk-JUVTJQ7I.js → chunk-6DRVUVNZ.js} +1 -1
- package/dist/cloudrun/chunk-EV26JQYW.js +2 -0
- package/dist/cloudrun/chunk-GSIUCMVK.js +8 -0
- package/dist/cloudrun/{chunk-FYZPEVAA.js → chunk-JBN5SOGD.js} +1 -1
- package/dist/cloudrun/chunk-MHUQ3MGN.js +24 -0
- package/dist/cloudrun/{chunk-GB4XIPDS.js → chunk-R26GKMTH.js} +1 -1
- package/dist/cloudrun/chunk-XO3TAODL.js +2 -0
- package/dist/cloudrun/cloudflare-5WFHLALX.js +2 -0
- package/dist/cloudrun/deno-7HS4QY7G.js +2 -0
- package/dist/{aws/gcp-ZEEIATV7.mjs → cloudrun/gcp-ODIRVFFY.js} +1 -1
- package/dist/cloudrun/lambda-HR2JPPGG.js +3 -0
- package/dist/cloudrun/node-YIKCMSEO.js +2 -0
- package/dist/cloudrun/server.js +4 -4
- package/dist/cloudrun/utils-TJZDD75X.js +2 -0
- package/package.json +3 -3
- package/dist/aws/RequestUnlimited-EKXQGSQT.mjs +0 -2
- package/dist/aws/bun-GK5CEVAU.mjs +0 -2
- package/dist/aws/chunk-QCE23AKJ.mjs +0 -8
- package/dist/aws/chunk-STPKE4A5.mjs +0 -24
- package/dist/aws/cloudflare-BDB3FS4Y.mjs +0 -2
- package/dist/aws/deno-AIUOFIXG.mjs +0 -2
- package/dist/aws/lambda-S3DVSSBV.mjs +0 -3
- package/dist/aws/node-A7ZN443L.mjs +0 -2
- package/dist/aws/utils-KMHFLZAJ.mjs +0 -2
- package/dist/cloudflare/RequestUnlimited-QCOTVU4G.js +0 -1
- package/dist/cloudflare/bun-O4EJPGLH.js +0 -1
- package/dist/cloudflare/chunk-O3XYZ4KS.js +0 -1
- package/dist/cloudflare/cloudflare-I5A4OJEG.js +0 -1
- package/dist/cloudflare/deno-KE6IVNNU.js +0 -1
- package/dist/cloudflare/gcp-MNKOPDML.js +0 -1
- package/dist/cloudflare/lambda-PLZQW4BF.js +0 -1
- package/dist/cloudflare/node-DRV76TUB.js +0 -1
- package/dist/cloudflare/utils-7K7MHQMD.js +0 -1
- package/dist/cloudrun/RequestUnlimited-YQAPYTOH.js +0 -2
- package/dist/cloudrun/bun-BONNABBU.js +0 -2
- package/dist/cloudrun/chunk-5B5BV7SP.js +0 -8
- package/dist/cloudrun/chunk-CFQMQATE.js +0 -24
- package/dist/cloudrun/cloudflare-Q3ZW7CDF.js +0 -2
- package/dist/cloudrun/deno-CPTVGH3A.js +0 -2
- package/dist/cloudrun/lambda-NKM4QA4M.js +0 -3
- package/dist/cloudrun/node-SKMPZMFE.js +0 -2
- package/dist/cloudrun/utils-SDRX3ZUT.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i}from"./chunk-GSIUCMVK.js";import"./chunk-XO3TAODL.js";import"./chunk-6DRVUVNZ.js";import"./chunk-JBN5SOGD.js";import"./chunk-5CIUNKHO.js";export{g as DEFAULT_REQUEST_OPTIONS,d as MAX_BACKOFF_LIMIT_MS,a as MAX_RETRY_LIMIT,c as MAX_TIMEOUT_MS,b as MIN_TIMEOUT_MS,e as clampNumber,h as endPoint,i as endPoints,f as fullJitterDelay};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as g}from"./chunk-R26GKMTH.js";import"./chunk-ZXZVHMQF.js";import{c as p,d as i}from"./chunk-MHUQ3MGN.js";import"./chunk-EV26JQYW.js";import"./chunk-XO3TAODL.js";import"./chunk-JBN5SOGD.js";import{e as s,h as n}from"./chunk-5CIUNKHO.js";n();var o=s(p(),1),a=s(g(),1);import{Writable as d}from"stream";var f=process.env.LOG_PRETTY==="true"||process.env.NODE_ENV!=="production"&&process.env.LOG_PRETTY!=="false",e=process.env.LOG_LEVEL||"info",m=new d({write(t,v,c){let r=globalThis.__wsLogWrite;r&&r(typeof t=="string"?t:t.toString("utf8")),c()}}),l=o.default.multistream([{level:e,stream:f?(0,a.default)({colorize:!0,translateTime:"SYS:standard",ignore:"pid,hostname"}):process.stdout},{level:e,stream:m}]),u=(0,o.default)({level:e,redact:["password","secret","token","authorization","apiKey"]},l),L=new i(u),S=L;export{S as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as m}from"./chunk-FYZPEVAA.js";import{h as g}from"./chunk-5CIUNKHO.js";g();g();var L=m();async function F(){let t;switch(L){case"cloudflare":t=await import("./cloudflare-Q3ZW7CDF.js");break;case"aws-lambda":t=await import("./lambda-NKM4QA4M.js");break;case"gcp-cloudrun":t=await import("./gcp-W76U73T6.js");break;case"bun":t=await import("./bun-BONNABBU.js");break;case"deno":t=await import("./deno-CPTVGH3A.js");break;default:t=await import("./node-SKMPZMFE.js");break}let e=t.default,r=typeof e=="function"?e():e;return globalThis.logger=r,r}var M=await F();g();g();function T(t){return Date.UTC(t.y,t.m-1,t.d,t.h,t.i,t.s)}function N(t,e){return t.y===e.y&&t.m===e.m&&t.d===e.d&&t.h===e.h&&t.i===e.i&&t.s===e.s}function $(t,e){let r=new Date(Date.parse(t));if(isNaN(r))throw new Error("Invalid ISO8601 passed to timezone parser.");let i=t.substring(9);return i.includes("Z")||i.includes("+")||i.includes("-")?R(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),"Etc/UTC"):R(r.getFullYear(),r.getMonth()+1,r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),e)}function U(t,e,r){return S($(t,e),r)}function S(t,e){let r=new Date(T(t)),i=v(r,t.tz),n=T(t),s=T(i),o=n-s,a=new Date(r.getTime()+o),h=v(a,t.tz);if(N(h,t)){let u=new Date(a.getTime()-36e5),f=v(u,t.tz);return N(f,t)?u:a}let l=new Date(a.getTime()+T(t)-T(h)),p=v(l,t.tz);if(N(p,t))return l;if(e)throw new Error("Invalid date passed to fromTZ()");return a.getTime()>l.getTime()?a:l}function v(t,e){let r,i;try{r=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}),i=r.formatToParts(t)}catch(s){let o=s instanceof Error?s.message:String(s);throw new RangeError(`toTZ: Invalid timezone '${e}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${o}`)}let n={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let s of i)(s.type==="year"||s.type==="month"||s.type==="day"||s.type==="hour"||s.type==="minute"||s.type==="second")&&(n[s.type]=parseInt(s.value,10));if(isNaN(n.year)||isNaN(n.month)||isNaN(n.day)||isNaN(n.hour)||isNaN(n.minute)||isNaN(n.second))throw new Error(`toTZ: Failed to parse all date components from timezone '${e}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(n)}`);return n.hour===24&&(n.hour=0),{y:n.year,m:n.month,d:n.day,h:n.hour,i:n.minute,s:n.second,tz:e}}function R(t,e,r,i,n,s,o){return{y:t,m:e,d:r,h:i,i:n,s,tz:o}}var z=[1,2,4,8,16],P=class{pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(t,e,r){this.pattern=t,this.timezone=e,this.mode=r?.mode??"auto",this.alternativeWeekdays=r?.alternativeWeekdays??!1,this.sloppyRanges=r?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw new TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let t=this.pattern.match(/\S+/g)||[""],e=t.length;if(t.length<5||t.length>7)throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five, six, or seven space separated parts are required.");if(this.mode!=="auto"){let i;switch(this.mode){case"5-part":i=5;break;case"6-part":i=6;break;case"7-part":i=7;break;case"5-or-6-parts":i=[5,6];break;case"6-or-7-parts":i=[6,7];break;default:i=0}if(!(Array.isArray(i)?i.includes(e):e===i)){let n=Array.isArray(i)?i.join(" or "):i.toString();throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${n} parts, but pattern '${this.pattern}' has ${e} parts.`)}}if(t.length===5&&t.unshift("0"),t.length===6&&t.push("*"),t[3].toUpperCase()==="LW"?(this.lastWeekday=!0,t[3]=""):t[3].toUpperCase().indexOf("L")>=0&&(t[3]=t[3].replace(/L/gi,""),this.lastDayOfMonth=!0),t[3]=="*"&&(this.starDOM=!0),t[6]=="*"&&(this.starYear=!0),t[4].length>=3&&(t[4]=this.replaceAlphaMonths(t[4])),t[5].length>=3&&(t[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(t[5]):this.replaceAlphaDays(t[5])),t[5].startsWith("+")&&(this.useAndLogic=!0,t[5]=t[5].substring(1),t[5]===""))throw new TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");switch(t[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0&&(t[0]=t[0].replace(/\?/g,"*"),t[1]=t[1].replace(/\?/g,"*"),t[2]=t[2].replace(/\?/g,"*"),t[3]=t[3].replace(/\?/g,"*"),t[4]=t[4].replace(/\?/g,"*"),t[5]=t[5].replace(/\?/g,"*"),t[6]&&(t[6]=t[6].replace(/\?/g,"*"))),this.mode){case"5-part":t[0]="0",t[6]="*";break;case"6-part":t[6]="*";break;case"5-or-6-parts":t[6]="*";break;case"6-or-7-parts":break;case"7-part":case"auto":break}this.throwAtIllegalCharacters(t),this.partToArray("second",t[0],0,1),this.partToArray("minute",t[1],0,1),this.partToArray("hour",t[2],0,1),this.partToArray("day",t[3],-1,1),this.partToArray("month",t[4],-1,1);let r=this.alternativeWeekdays?-1:0;this.partToArray("dayOfWeek",t[5],r,63),this.partToArray("year",t[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(t,e,r,i){let n=this[t],s=t==="day"&&this.lastDayOfMonth,o=t==="day"&&this.lastWeekday;if(e===""&&!s&&!o)throw new TypeError("CronPattern: configuration entry "+t+" ("+e+") is empty, check for trailing spaces.");if(e==="*")return n.fill(i);let a=e.split(",");if(a.length>1)for(let h=0;h<a.length;h++)this.partToArray(t,a[h],r,i);else e.indexOf("-")!==-1&&e.indexOf("/")!==-1?this.handleRangeWithStepping(e,t,r,i):e.indexOf("-")!==-1?this.handleRange(e,t,r,i):e.indexOf("/")!==-1?this.handleStepping(e,t,r,i):e!==""&&this.handleNumber(e,t,r,i)}throwAtIllegalCharacters(t){for(let e=0;e<t.length;e++)if((e===3?/[^/*0-9,\-WwLl]+/:e===5?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(t[e]))throw new TypeError("CronPattern: configuration entry "+e+" ("+t[e]+") contains illegal characters.")}handleNumber(t,e,r,i){let n=this.extractNth(t,e),s=t.toUpperCase().includes("W");if(e!=="day"&&s)throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");s&&(e="nearestWeekdays");let o=parseInt(n[0],10)+r;if(isNaN(o))throw new TypeError("CronPattern: "+e+" is not a number: '"+t+"'");this.setPart(e,o,n[1]||i)}setPart(t,e,r){if(!Object.prototype.hasOwnProperty.call(this,t))throw new TypeError("CronPattern: Invalid part specified: "+t);if(t==="dayOfWeek"){if(e===7&&(e=0),e<0||e>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+e);this.setNthWeekdayOfMonth(e,r);return}if(t==="second"||t==="minute"){if(e<0||e>=60)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="hour"){if(e<0||e>=24)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="day"||t==="nearestWeekdays"){if(e<0||e>=31)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="month"){if(e<0||e>=12)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="year"&&(e<1||e>=1e4))throw new RangeError("CronPattern: Invalid value for "+t+": "+e+" (supported range: 1-9999)");this[t][e]=r}validateNotNaN(t,e){if(isNaN(t))throw new TypeError(e)}validateRange(t,e,r,i,n){if(t>e)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");if(r!==void 0){if(r===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(r>this[i].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[i].length+")")}}handleRangeWithStepping(t,e,r,i){if(t.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");let n=this.extractNth(t,e),s=n[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(s===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+t+"'");let[,o,a,h]=s,l=parseInt(o,10)+r,p=parseInt(a,10)+r,u=parseInt(h,10);this.validateNotNaN(l,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(p,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateNotNaN(u,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(l,p,u,e,t);for(let f=l;f<=p;f+=u)this.setPart(e,f,n[1]||i)}extractNth(t,e){let r=t,i;if(r.includes("#")){if(e!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");i=r.split("#")[1],r=r.split("#")[0]}else if(r.toUpperCase().endsWith("L")){if(e!=="dayOfWeek")throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");i="L",r=r.slice(0,-1)}return[r,i]}handleRange(t,e,r,i){if(t.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");let n=this.extractNth(t,e),s=n[0].split("-");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+t+"'");let o=parseInt(s[0],10)+r,a=parseInt(s[1],10)+r;this.validateNotNaN(o,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(a,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateRange(o,a,void 0,e,t);for(let h=o;h<=a;h++)this.setPart(e,h,n[1]||i)}handleStepping(t,e,r,i){if(t.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");let n=this.extractNth(t,e),s=n[0].split("/");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+t+"'");if(this.sloppyRanges)s[0]===""&&(s[0]="*");else{if(s[0]==="")throw new TypeError("CronPattern: Syntax error, stepping with missing prefix ('"+t+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");if(s[0]!=="*")throw new TypeError("CronPattern: Syntax error, stepping with numeric prefix ('"+t+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.")}let o=0;s[0]!=="*"&&(o=parseInt(s[0],10)+r);let a=parseInt(s[1],10);this.validateNotNaN(a,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(0,this[e].length-1,a,e,t);for(let h=o;h<this[e].length;h+=a)this.setPart(e,h,n[1]||i)}replaceAlphaDays(t){return t.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaDaysQuartz(t){return t.replace(/sun/gi,"1").replace(/mon/gi,"2").replace(/tue/gi,"3").replace(/wed/gi,"4").replace(/thu/gi,"5").replace(/fri/gi,"6").replace(/sat/gi,"7")}replaceAlphaMonths(t){return t.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(t){let e=t.trim().toLowerCase();if(e==="@yearly"||e==="@annually")return"0 0 1 1 *";if(e==="@monthly")return"0 0 1 * *";if(e==="@weekly")return"0 0 * * 0";if(e==="@daily"||e==="@midnight")return"0 0 * * *";if(e==="@hourly")return"0 * * * *";if(e==="@reboot")throw new TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");return t}setNthWeekdayOfMonth(t,e){if(typeof e!="number"&&e.toUpperCase()==="L")this.dayOfWeek[t]=this.dayOfWeek[t]|32;else if(e===63)this.dayOfWeek[t]=63;else if(e<6&&e>0)this.dayOfWeek[t]=this.dayOfWeek[t]|z[e-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${e}, Type: ${typeof e}`)}},b=[31,28,31,30,31,30,31,31,30,31,30,31],d=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],y=class I{tz;ms;second;minute;hour;day;month;year;constructor(e,r){if(this.tz=r,e&&e instanceof Date)if(!isNaN(e))this.fromDate(e);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(e==null)this.fromDate(new Date);else if(e&&typeof e=="string")this.fromString(e);else if(e instanceof I)this.fromCronDate(e);else throw new TypeError("CronDate: Invalid type ("+typeof e+") passed to CronDate constructor")}getLastDayOfMonth(e,r){return r!==1?b[r]:new Date(Date.UTC(e,r+1,0)).getUTCDate()}getLastWeekday(e,r){let i=this.getLastDayOfMonth(e,r),n=new Date(Date.UTC(e,r,i)).getUTCDay();return n===0?i-2:n===6?i-1:i}getNearestWeekday(e,r,i){let n=this.getLastDayOfMonth(e,r);if(i>n)return-1;let s=new Date(Date.UTC(e,r,i)).getUTCDay();return s===0?i===n?i-2:i+1:s===6?i===1?i+2:i-1:i}isNthWeekdayOfMonth(e,r,i,n){let s=new Date(Date.UTC(e,r,i)).getUTCDay(),o=0;for(let a=1;a<=i;a++)new Date(Date.UTC(e,r,a)).getUTCDay()===s&&o++;if(n&63&&z[o-1]&n)return!0;if(n&32){let a=this.getLastDayOfMonth(e,r);for(let h=i+1;h<=a;h++)if(new Date(Date.UTC(e,r,h)).getUTCDay()===s)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else try{let r=v(e,this.tz);this.ms=e.getMilliseconds(),this.second=r.s,this.minute=r.i,this.hour=r.h,this.day=r.d,this.month=r.m-1,this.year=r.y}catch(r){let i=r instanceof Error?r.message:String(r);throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${i}`)}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.month<0||this.day>b[this.month]||this.day<1||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz=="number"){let r=U(e);this.ms=r.getUTCMilliseconds(),this.second=r.getUTCSeconds(),this.minute=r.getUTCMinutes(),this.hour=r.getUTCHours(),this.day=r.getUTCDate(),this.month=r.getUTCMonth(),this.year=r.getUTCFullYear(),this.apply()}else return this.fromDate(U(e,this.tz))}findNext(e,r,i,n){return this._findMatch(e,r,i,n,1)}_findMatch(e,r,i,n,s){let o=this[r],a;i.lastDayOfMonth&&(a=this.getLastDayOfMonth(this.year,this.month));let h=!i.starDOW&&r=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0,l=this[r]+n,p=s===1?u=>u<i[r].length:u=>u>=0;for(let u=l;p(u);u+=s){let f=i[r][u];if(r==="day"&&!f){for(let c=0;c<i.nearestWeekdays.length;c++)if(i.nearestWeekdays[c]){let E=this.getNearestWeekday(this.year,this.month,c-n);if(E===-1)continue;if(E===u-n){f=1;break}}}if(r==="day"&&i.lastWeekday){let c=this.getLastWeekday(this.year,this.month);u-n===c&&(f=1)}if(r==="day"&&i.lastDayOfMonth&&u-n==a&&(f=1),r==="day"&&!i.starDOW){let c=i.dayOfWeek[(h+(u-n-1))%7];if(c&&c&63)c=this.isNthWeekdayOfMonth(this.year,this.month,u-n,c)?1:0;else if(c)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${c}`);i.useAndLogic?f=f&&c:!e.domAndDow&&!i.starDOM?f=f||c:f=f&&c}if(f)return this[r]=u-n,o!==this[r]?2:1}return 3}recurse(e,r,i){if(i===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let s=-1;for(let o=this.year+1;o<e.year.length&&o<1e4;o++)if(e.year[o]===1){s=o;break}if(s===-1)return null;this.year=s,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let n=this.findNext(r,d[i][0],e,d[i][2]);if(n>1){let s=i+1;for(;s<d.length;)this[d[s][0]]=-d[s][2],s++;if(n===3){if(this[d[i][1]]++,this[d[i][0]]=-d[i][2],this.apply(),i===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=e.year.length)return null}return this.recurse(e,r,0)}else if(this.apply())return this.recurse(e,r,i-1)}return i+=1,i>=d.length?this:(e.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(e,r,i)}increment(e,r,i){return this.second+=r.interval!==void 0&&r.interval>1&&i?r.interval:1,this.ms=0,this.apply(),this.recurse(e,r,0)}decrement(e,r){return this.second-=r.interval!==void 0&&r.interval>1?r.interval:1,this.ms=0,this.apply(),this.recurseBackward(e,r,0,0)}recurseBackward(e,r,i,n=0){if(n>1e4)return null;if(i===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let o=-1;for(let a=this.year-1;a>=0;a--)if(e.year[a]===1){o=a;break}if(o===-1)return null;this.year=o,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let s=this.findPrevious(r,d[i][0],e,d[i][2]);if(s>1){let o=i+1;for(;o<d.length;){let a=d[o][0],h=d[o][2],l=this.getMaxPatternValue(a,e,h);this[a]=l,o++}if(s===3){if(this[d[i][1]]--,i===0){let p=this.getLastDayOfMonth(this.year,this.month);this.day>p&&(this.day=p)}if(i===1)if(this.day<=0)this.day=1;else{let p=this.year,u=this.month;for(;u<0;)u+=12,p--;for(;u>11;)u-=12,p++;let f=u!==1?b[u]:new Date(Date.UTC(p,u+1,0)).getUTCDate();this.day>f&&(this.day=f)}this.apply();let a=d[i][0],h=d[i][2],l=this.getMaxPatternValue(a,e,h);if(a==="day"){let p=this.getLastDayOfMonth(this.year,this.month);this[a]=Math.min(l,p)}else this[a]=l;if(this.apply(),i===0){let p=d[1][2],u=this.getMaxPatternValue("day",e,p),f=this.getLastDayOfMonth(this.year,this.month),c=Math.min(u,f);c!==this.day&&(this.day=c,this.hour=this.getMaxPatternValue("hour",e,d[2][2]),this.minute=this.getMaxPatternValue("minute",e,d[3][2]),this.second=this.getMaxPatternValue("second",e,d[4][2]))}if(i===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0;)this.year--;if(this.year<0)return null}return this.recurseBackward(e,r,0,n+1)}else if(this.apply())return this.recurseBackward(e,r,i-1,n+1)}return i+=1,i>=d.length?this:this.year<0?null:this.recurseBackward(e,r,i,n+1)}getMaxPatternValue(e,r,i){if(e==="day"&&r.lastDayOfMonth)return this.getLastDayOfMonth(this.year,this.month);if(e==="day"&&!r.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let n=r[e].length-1;n>=0;n--)if(r[e][n])return n-i;return r[e].length-1-i}findPrevious(e,r,i,n){return this._findMatch(e,r,i,n,-1)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):S(R(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(e,r){if(!e.starYear&&(this.year<0||this.year>=e.year.length||e.year[this.year]===0))return!1;for(let i=0;i<d.length;i++){let n=d[i][0],s=d[i][2],o=this[n];if(o+s<0||o+s>=e[n].length)return!1;let a=e[n][o+s];if(n==="day"){if(!a){for(let h=0;h<e.nearestWeekdays.length;h++)if(e.nearestWeekdays[h]){let l=this.getNearestWeekday(this.year,this.month,h-s);if(l!==-1&&l===o){a=1;break}}}if(e.lastWeekday){let h=this.getLastWeekday(this.year,this.month);o===h&&(a=1)}if(e.lastDayOfMonth){let h=this.getLastDayOfMonth(this.year,this.month);o===h&&(a=1)}if(!e.starDOW){let h=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),l=e.dayOfWeek[(h+(o-1))%7];l&&l&63&&(l=this.isNthWeekdayOfMonth(this.year,this.month,o,l)?1:0),e.useAndLogic?a=a&&l:!r.domAndDow&&!e.starDOM?a=a||l:a=a&&l}}if(!a)return!1}return!0}};function Y(t){if(t===void 0&&(t={}),delete t.name,t.legacyMode!==void 0&&t.domAndDow===void 0?t.domAndDow=!t.legacyMode:t.domAndDow===void 0&&(t.domAndDow=!1),t.legacyMode=!t.domAndDow,t.paused=t.paused===void 0?!1:t.paused,t.maxRuns=t.maxRuns===void 0?1/0:t.maxRuns,t.catch=t.catch===void 0?!1:t.catch,t.interval=t.interval===void 0?0:parseInt(t.interval.toString(),10),t.utcOffset=t.utcOffset===void 0?void 0:parseInt(t.utcOffset.toString(),10),t.dayOffset=t.dayOffset===void 0?0:parseInt(t.dayOffset.toString(),10),t.unref=t.unref===void 0?!1:t.unref,t.mode=t.mode===void 0?"auto":t.mode,t.alternativeWeekdays=t.alternativeWeekdays===void 0?!1:t.alternativeWeekdays,t.sloppyRanges=t.sloppyRanges===void 0?!1:t.sloppyRanges,!["auto","5-part","6-part","7-part","5-or-6-parts","6-or-7-parts"].includes(t.mode))throw new Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");if(t.startAt&&(t.startAt=new y(t.startAt,t.timezone)),t.stopAt&&(t.stopAt=new y(t.stopAt,t.timezone)),t.interval!==null){if(isNaN(t.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(t.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(t.utcOffset!==void 0){if(isNaN(t.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(t.utcOffset<-870||t.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(t.utcOffset!==void 0&&t.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(t.unref!==!0&&t.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");if(t.dayOffset!==void 0&&t.dayOffset!==0&&isNaN(t.dayOffset))throw new Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");return t}function D(t){return Object.prototype.toString.call(t)==="[object Function]"||typeof t=="function"||t instanceof Function}function j(t){return D(t)}function q(t){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(t):t&&typeof t.unref<"u"&&t.unref()}var A=30*1e3,O=[],_=class{name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(t){if(this.options.dayOffset!==void 0&&this.options.dayOffset!==0){let e=this.options.dayOffset*24*60*60*1e3;return new Date(t.getTime()+e)}return t}constructor(t,e,r){let i,n;if(D(e))n=e;else if(typeof e=="object")i=e;else if(e!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(D(r))n=r;else if(typeof r=="object")i=r;else if(r!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=i?.name,this.options=Y(i),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:i?i.maxRuns:void 0,paused:i?i.paused:!1,pattern:new P("* * * * *",void 0,{mode:"auto"})},t&&(t instanceof Date||typeof t=="string"&&t.indexOf(":")>0)?this._states.once=new y(t,this.getTz()):this._states.pattern=new P(t,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(O.find(s=>s.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");O.push(this)}return n!==void 0&&j(n)&&(this.fn=n,this.schedule()),this}nextRun(t){let e=this._next(t);return e?this.applyDayOffset(e.getDate(!1)):null}nextRuns(t,e){this._states.maxRuns!==void 0&&t>this._states.maxRuns&&(t=this._states.maxRuns);let r=e||this._states.currentRun||void 0;return this._enumerateRuns(t,r,"next")}previousRuns(t,e){return this._enumerateRuns(t,e||void 0,"previous")}_enumerateRuns(t,e,r){let i=[],n=e?new y(e,this.getTz()):null,s=r==="next"?this._next:this._previous;for(;t--;){let o=s.call(this,n);if(!o)break;let a=o.getDate(!1);i.push(this.applyDayOffset(a)),n=o}return i}match(t){if(this._states.once){let r=new y(t,this.getTz());r.ms=0;let i=new y(this._states.once,this.getTz());return i.ms=0,r.getTime()===i.getTime()}let e=new y(t,this.getTz());return e.ms=0,e.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let t=this.nextRun(this._states.currentRun),e=!this._states.paused,r=this.fn!==void 0,i=!this._states.kill;return e&&r&&i&&t!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(t){let e=this._next(t);return e?t instanceof y||t instanceof Date?e.getTime()-t.getTime():e.getTime()-new y(t).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let t=O.indexOf(this);t>=0&&O.splice(t,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(t){if(t&&this.fn)throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");t&&(this.fn=t);let e=this.msToNext(),r=this.nextRun(this._states.currentRun);return e==null||isNaN(e)||r===null?this:(e>A&&(e=A),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(r),e),this._states.currentTimeout&&this.options.unref&&q(this._states.currentTimeout),this)}async _trigger(t){this._states.blocking=!0,this._states.currentRun=new y(void 0,this.getTz());try{if(this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){if(D(this.options.catch))try{this.options.catch(e,this)}catch{}}else this.fn!==void 0&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new y(t,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(t){let e=new Date,r=!this._states.paused&&e.getTime()>=t.getTime(),i=this._states.blocking&&this.options.protect;r&&!i?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):r&&i&&D(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(t){let e=!!(t||this._states.currentRun),r=!1;!t&&this.options.startAt&&this.options.interval&&([t,e]=this._calculatePreviousRun(t,e),r=!t),t=new y(t,this.getTz()),this.options.startAt&&t&&t.getTime()<this.options.startAt.getTime()&&(t=this.options.startAt);let i=this._states.once||new y(t,this.getTz());return!r&&i!==this._states.once&&(i=i.increment(this._states.pattern,this.options,e)),this._states.once&&this._states.once.getTime()<=t.getTime()||i===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&i.getTime()>=this.options.stopAt.getTime()?null:i}_previous(t){let e=new y(t,this.getTz());this.options.stopAt&&e.getTime()>this.options.stopAt.getTime()&&(e=this.options.stopAt);let r=new y(e,this.getTz());return this._states.once?this._states.once.getTime()<e.getTime()?this._states.once:null:(r=r.decrement(this._states.pattern,this.options),r===null||this.options.startAt&&r.getTime()<this.options.startAt.getTime()?null:r)}_calculatePreviousRun(t,e){let r=new y(void 0,this.getTz()),i=t;if(this.options.startAt.getTime()<=r.getTime()){i=this.options.startAt;let n=i.getTime()+this.options.interval*1e3;for(;n<=r.getTime();)i=new y(i,this.getTz()).increment(this._states.pattern,this.options,!0),n=i.getTime()+this.options.interval*1e3;e=!0}return i===null&&(i=void 0),[i,e]}};function V(t,e,r,i){let n=i?{timezone:i}:{};return new _("* * * * * *",()=>{let o=new Date;if(!t.some(l=>new _(l,n).nextRun(o)===null))return;e.some(l=>new _(l,n).nextRun(o)===null)||r()})}g();var B=0;function H(){return++B}var W;(typeof __EDGE_RUNTIME__>"u"||!__EDGE_RUNTIME__)&&(W=(await import("module")).createRequire);var Z=M.child({section:"Utils"}),w,C=()=>{if(!w){let t=m();if(W&&typeof import.meta<"u"&&import.meta.url)try{w=W(import.meta.url)}catch{}!w&&typeof globalThis.require=="function"&&(w=globalThis.require),w||(w=e=>{throw new Error(`require("${e}") is not available in this runtime (${t}).`)})}return w},pt={run:()=>Z.info(`Running on ${m()}`)},G=t=>{try{if(typeof Deno<"u"&&Deno.env)return Deno.env.get(t)}catch{}try{if(typeof process<"u"&&process.env)return process.env[t]}catch{}},ct=()=>{try{if(typeof Deno<"u"&&Deno.env)return Deno.env.toObject()}catch{}try{if(typeof process<"u"&&process.env)return{...process.env}}catch{}return{}},yt=t=>{if(typeof Deno<"u"&&Deno.readTextFileSync)return Deno.readTextFileSync(t);let{readFileSync:e}=C()("node:fs");return e(t,"utf8")},gt=t=>{if(typeof Deno<"u"&&Deno.statSync)try{return Deno.statSync(t),!0}catch{return!1}let{existsSync:e}=C()("node:fs");return e(t)},mt=()=>typeof Deno<"u"&&Deno.cwd?Deno.cwd():typeof process<"u"&&process.cwd?process.cwd():"/",wt=()=>{if(m()==="deno")return new URL(".",import.meta.url).pathname;if(typeof import.meta<"u"&&import.meta.url){let e=new URL(import.meta.url);if(e.protocol==="file:"){let{dirname:i}=C()("node:path"),{fileURLToPath:n}=C()("node:url");return i(n(import.meta.url))}let r=e.pathname;return r.substring(0,r.lastIndexOf("/"))}return""},Tt=()=>{let t=m(),e;return t==="deno"?e=Deno.build.os:e=process.platform,e==="win32"||e==="windows"?"windows":"linux"},vt=()=>G("NODE_ENV")?.toLowerCase()==="production"?"production":"development",Dt=()=>m()==="deno"?Deno.env.get("TMPDIR")||Deno.env.get("TEMP")||"/tmp":C()("node:os").tmpdir(),Ct=t=>new Promise(e=>setTimeout(e,t));export{M as a,V as b,H as c,C as d,pt as e,G as f,ct as g,yt as h,gt as i,mt as j,wt as k,Tt as l,vt as m,Dt as n,Ct as o};
|
|
2
|
+
import{a as m}from"./chunk-JBN5SOGD.js";import{h as g}from"./chunk-5CIUNKHO.js";g();g();var L=m();async function F(){let t;switch(L){case"cloudflare":t=await import("./cloudflare-5WFHLALX.js");break;case"aws-lambda":t=await import("./lambda-HR2JPPGG.js");break;case"gcp-cloudrun":t=await import("./gcp-ODIRVFFY.js");break;case"bun":t=await import("./bun-MBTNJC4U.js");break;case"deno":t=await import("./deno-7HS4QY7G.js");break;default:t=await import("./node-YIKCMSEO.js");break}let e=t.default,r=typeof e=="function"?e():e;return globalThis.logger=r,r}var M=await F();g();g();function T(t){return Date.UTC(t.y,t.m-1,t.d,t.h,t.i,t.s)}function N(t,e){return t.y===e.y&&t.m===e.m&&t.d===e.d&&t.h===e.h&&t.i===e.i&&t.s===e.s}function $(t,e){let r=new Date(Date.parse(t));if(isNaN(r))throw new Error("Invalid ISO8601 passed to timezone parser.");let i=t.substring(9);return i.includes("Z")||i.includes("+")||i.includes("-")?R(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),"Etc/UTC"):R(r.getFullYear(),r.getMonth()+1,r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),e)}function U(t,e,r){return S($(t,e),r)}function S(t,e){let r=new Date(T(t)),i=v(r,t.tz),n=T(t),s=T(i),o=n-s,a=new Date(r.getTime()+o),h=v(a,t.tz);if(N(h,t)){let u=new Date(a.getTime()-36e5),f=v(u,t.tz);return N(f,t)?u:a}let l=new Date(a.getTime()+T(t)-T(h)),p=v(l,t.tz);if(N(p,t))return l;if(e)throw new Error("Invalid date passed to fromTZ()");return a.getTime()>l.getTime()?a:l}function v(t,e){let r,i;try{r=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}),i=r.formatToParts(t)}catch(s){let o=s instanceof Error?s.message:String(s);throw new RangeError(`toTZ: Invalid timezone '${e}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${o}`)}let n={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let s of i)(s.type==="year"||s.type==="month"||s.type==="day"||s.type==="hour"||s.type==="minute"||s.type==="second")&&(n[s.type]=parseInt(s.value,10));if(isNaN(n.year)||isNaN(n.month)||isNaN(n.day)||isNaN(n.hour)||isNaN(n.minute)||isNaN(n.second))throw new Error(`toTZ: Failed to parse all date components from timezone '${e}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(n)}`);return n.hour===24&&(n.hour=0),{y:n.year,m:n.month,d:n.day,h:n.hour,i:n.minute,s:n.second,tz:e}}function R(t,e,r,i,n,s,o){return{y:t,m:e,d:r,h:i,i:n,s,tz:o}}var z=[1,2,4,8,16],P=class{pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(t,e,r){this.pattern=t,this.timezone=e,this.mode=r?.mode??"auto",this.alternativeWeekdays=r?.alternativeWeekdays??!1,this.sloppyRanges=r?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw new TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let t=this.pattern.match(/\S+/g)||[""],e=t.length;if(t.length<5||t.length>7)throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five, six, or seven space separated parts are required.");if(this.mode!=="auto"){let i;switch(this.mode){case"5-part":i=5;break;case"6-part":i=6;break;case"7-part":i=7;break;case"5-or-6-parts":i=[5,6];break;case"6-or-7-parts":i=[6,7];break;default:i=0}if(!(Array.isArray(i)?i.includes(e):e===i)){let n=Array.isArray(i)?i.join(" or "):i.toString();throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${n} parts, but pattern '${this.pattern}' has ${e} parts.`)}}if(t.length===5&&t.unshift("0"),t.length===6&&t.push("*"),t[3].toUpperCase()==="LW"?(this.lastWeekday=!0,t[3]=""):t[3].toUpperCase().indexOf("L")>=0&&(t[3]=t[3].replace(/L/gi,""),this.lastDayOfMonth=!0),t[3]=="*"&&(this.starDOM=!0),t[6]=="*"&&(this.starYear=!0),t[4].length>=3&&(t[4]=this.replaceAlphaMonths(t[4])),t[5].length>=3&&(t[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(t[5]):this.replaceAlphaDays(t[5])),t[5].startsWith("+")&&(this.useAndLogic=!0,t[5]=t[5].substring(1),t[5]===""))throw new TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");switch(t[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0&&(t[0]=t[0].replace(/\?/g,"*"),t[1]=t[1].replace(/\?/g,"*"),t[2]=t[2].replace(/\?/g,"*"),t[3]=t[3].replace(/\?/g,"*"),t[4]=t[4].replace(/\?/g,"*"),t[5]=t[5].replace(/\?/g,"*"),t[6]&&(t[6]=t[6].replace(/\?/g,"*"))),this.mode){case"5-part":t[0]="0",t[6]="*";break;case"6-part":t[6]="*";break;case"5-or-6-parts":t[6]="*";break;case"6-or-7-parts":break;case"7-part":case"auto":break}this.throwAtIllegalCharacters(t),this.partToArray("second",t[0],0,1),this.partToArray("minute",t[1],0,1),this.partToArray("hour",t[2],0,1),this.partToArray("day",t[3],-1,1),this.partToArray("month",t[4],-1,1);let r=this.alternativeWeekdays?-1:0;this.partToArray("dayOfWeek",t[5],r,63),this.partToArray("year",t[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(t,e,r,i){let n=this[t],s=t==="day"&&this.lastDayOfMonth,o=t==="day"&&this.lastWeekday;if(e===""&&!s&&!o)throw new TypeError("CronPattern: configuration entry "+t+" ("+e+") is empty, check for trailing spaces.");if(e==="*")return n.fill(i);let a=e.split(",");if(a.length>1)for(let h=0;h<a.length;h++)this.partToArray(t,a[h],r,i);else e.indexOf("-")!==-1&&e.indexOf("/")!==-1?this.handleRangeWithStepping(e,t,r,i):e.indexOf("-")!==-1?this.handleRange(e,t,r,i):e.indexOf("/")!==-1?this.handleStepping(e,t,r,i):e!==""&&this.handleNumber(e,t,r,i)}throwAtIllegalCharacters(t){for(let e=0;e<t.length;e++)if((e===3?/[^/*0-9,\-WwLl]+/:e===5?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(t[e]))throw new TypeError("CronPattern: configuration entry "+e+" ("+t[e]+") contains illegal characters.")}handleNumber(t,e,r,i){let n=this.extractNth(t,e),s=t.toUpperCase().includes("W");if(e!=="day"&&s)throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");s&&(e="nearestWeekdays");let o=parseInt(n[0],10)+r;if(isNaN(o))throw new TypeError("CronPattern: "+e+" is not a number: '"+t+"'");this.setPart(e,o,n[1]||i)}setPart(t,e,r){if(!Object.prototype.hasOwnProperty.call(this,t))throw new TypeError("CronPattern: Invalid part specified: "+t);if(t==="dayOfWeek"){if(e===7&&(e=0),e<0||e>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+e);this.setNthWeekdayOfMonth(e,r);return}if(t==="second"||t==="minute"){if(e<0||e>=60)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="hour"){if(e<0||e>=24)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="day"||t==="nearestWeekdays"){if(e<0||e>=31)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="month"){if(e<0||e>=12)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="year"&&(e<1||e>=1e4))throw new RangeError("CronPattern: Invalid value for "+t+": "+e+" (supported range: 1-9999)");this[t][e]=r}validateNotNaN(t,e){if(isNaN(t))throw new TypeError(e)}validateRange(t,e,r,i,n){if(t>e)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");if(r!==void 0){if(r===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(r>this[i].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[i].length+")")}}handleRangeWithStepping(t,e,r,i){if(t.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");let n=this.extractNth(t,e),s=n[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(s===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+t+"'");let[,o,a,h]=s,l=parseInt(o,10)+r,p=parseInt(a,10)+r,u=parseInt(h,10);this.validateNotNaN(l,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(p,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateNotNaN(u,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(l,p,u,e,t);for(let f=l;f<=p;f+=u)this.setPart(e,f,n[1]||i)}extractNth(t,e){let r=t,i;if(r.includes("#")){if(e!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");i=r.split("#")[1],r=r.split("#")[0]}else if(r.toUpperCase().endsWith("L")){if(e!=="dayOfWeek")throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");i="L",r=r.slice(0,-1)}return[r,i]}handleRange(t,e,r,i){if(t.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");let n=this.extractNth(t,e),s=n[0].split("-");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+t+"'");let o=parseInt(s[0],10)+r,a=parseInt(s[1],10)+r;this.validateNotNaN(o,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(a,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateRange(o,a,void 0,e,t);for(let h=o;h<=a;h++)this.setPart(e,h,n[1]||i)}handleStepping(t,e,r,i){if(t.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");let n=this.extractNth(t,e),s=n[0].split("/");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+t+"'");if(this.sloppyRanges)s[0]===""&&(s[0]="*");else{if(s[0]==="")throw new TypeError("CronPattern: Syntax error, stepping with missing prefix ('"+t+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");if(s[0]!=="*")throw new TypeError("CronPattern: Syntax error, stepping with numeric prefix ('"+t+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.")}let o=0;s[0]!=="*"&&(o=parseInt(s[0],10)+r);let a=parseInt(s[1],10);this.validateNotNaN(a,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(0,this[e].length-1,a,e,t);for(let h=o;h<this[e].length;h+=a)this.setPart(e,h,n[1]||i)}replaceAlphaDays(t){return t.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaDaysQuartz(t){return t.replace(/sun/gi,"1").replace(/mon/gi,"2").replace(/tue/gi,"3").replace(/wed/gi,"4").replace(/thu/gi,"5").replace(/fri/gi,"6").replace(/sat/gi,"7")}replaceAlphaMonths(t){return t.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(t){let e=t.trim().toLowerCase();if(e==="@yearly"||e==="@annually")return"0 0 1 1 *";if(e==="@monthly")return"0 0 1 * *";if(e==="@weekly")return"0 0 * * 0";if(e==="@daily"||e==="@midnight")return"0 0 * * *";if(e==="@hourly")return"0 * * * *";if(e==="@reboot")throw new TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");return t}setNthWeekdayOfMonth(t,e){if(typeof e!="number"&&e.toUpperCase()==="L")this.dayOfWeek[t]=this.dayOfWeek[t]|32;else if(e===63)this.dayOfWeek[t]=63;else if(e<6&&e>0)this.dayOfWeek[t]=this.dayOfWeek[t]|z[e-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${e}, Type: ${typeof e}`)}},b=[31,28,31,30,31,30,31,31,30,31,30,31],d=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],y=class I{tz;ms;second;minute;hour;day;month;year;constructor(e,r){if(this.tz=r,e&&e instanceof Date)if(!isNaN(e))this.fromDate(e);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(e==null)this.fromDate(new Date);else if(e&&typeof e=="string")this.fromString(e);else if(e instanceof I)this.fromCronDate(e);else throw new TypeError("CronDate: Invalid type ("+typeof e+") passed to CronDate constructor")}getLastDayOfMonth(e,r){return r!==1?b[r]:new Date(Date.UTC(e,r+1,0)).getUTCDate()}getLastWeekday(e,r){let i=this.getLastDayOfMonth(e,r),n=new Date(Date.UTC(e,r,i)).getUTCDay();return n===0?i-2:n===6?i-1:i}getNearestWeekday(e,r,i){let n=this.getLastDayOfMonth(e,r);if(i>n)return-1;let s=new Date(Date.UTC(e,r,i)).getUTCDay();return s===0?i===n?i-2:i+1:s===6?i===1?i+2:i-1:i}isNthWeekdayOfMonth(e,r,i,n){let s=new Date(Date.UTC(e,r,i)).getUTCDay(),o=0;for(let a=1;a<=i;a++)new Date(Date.UTC(e,r,a)).getUTCDay()===s&&o++;if(n&63&&z[o-1]&n)return!0;if(n&32){let a=this.getLastDayOfMonth(e,r);for(let h=i+1;h<=a;h++)if(new Date(Date.UTC(e,r,h)).getUTCDay()===s)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else try{let r=v(e,this.tz);this.ms=e.getMilliseconds(),this.second=r.s,this.minute=r.i,this.hour=r.h,this.day=r.d,this.month=r.m-1,this.year=r.y}catch(r){let i=r instanceof Error?r.message:String(r);throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${i}`)}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.month<0||this.day>b[this.month]||this.day<1||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz=="number"){let r=U(e);this.ms=r.getUTCMilliseconds(),this.second=r.getUTCSeconds(),this.minute=r.getUTCMinutes(),this.hour=r.getUTCHours(),this.day=r.getUTCDate(),this.month=r.getUTCMonth(),this.year=r.getUTCFullYear(),this.apply()}else return this.fromDate(U(e,this.tz))}findNext(e,r,i,n){return this._findMatch(e,r,i,n,1)}_findMatch(e,r,i,n,s){let o=this[r],a;i.lastDayOfMonth&&(a=this.getLastDayOfMonth(this.year,this.month));let h=!i.starDOW&&r=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0,l=this[r]+n,p=s===1?u=>u<i[r].length:u=>u>=0;for(let u=l;p(u);u+=s){let f=i[r][u];if(r==="day"&&!f){for(let c=0;c<i.nearestWeekdays.length;c++)if(i.nearestWeekdays[c]){let E=this.getNearestWeekday(this.year,this.month,c-n);if(E===-1)continue;if(E===u-n){f=1;break}}}if(r==="day"&&i.lastWeekday){let c=this.getLastWeekday(this.year,this.month);u-n===c&&(f=1)}if(r==="day"&&i.lastDayOfMonth&&u-n==a&&(f=1),r==="day"&&!i.starDOW){let c=i.dayOfWeek[(h+(u-n-1))%7];if(c&&c&63)c=this.isNthWeekdayOfMonth(this.year,this.month,u-n,c)?1:0;else if(c)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${c}`);i.useAndLogic?f=f&&c:!e.domAndDow&&!i.starDOM?f=f||c:f=f&&c}if(f)return this[r]=u-n,o!==this[r]?2:1}return 3}recurse(e,r,i){if(i===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let s=-1;for(let o=this.year+1;o<e.year.length&&o<1e4;o++)if(e.year[o]===1){s=o;break}if(s===-1)return null;this.year=s,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let n=this.findNext(r,d[i][0],e,d[i][2]);if(n>1){let s=i+1;for(;s<d.length;)this[d[s][0]]=-d[s][2],s++;if(n===3){if(this[d[i][1]]++,this[d[i][0]]=-d[i][2],this.apply(),i===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=e.year.length)return null}return this.recurse(e,r,0)}else if(this.apply())return this.recurse(e,r,i-1)}return i+=1,i>=d.length?this:(e.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(e,r,i)}increment(e,r,i){return this.second+=r.interval!==void 0&&r.interval>1&&i?r.interval:1,this.ms=0,this.apply(),this.recurse(e,r,0)}decrement(e,r){return this.second-=r.interval!==void 0&&r.interval>1?r.interval:1,this.ms=0,this.apply(),this.recurseBackward(e,r,0,0)}recurseBackward(e,r,i,n=0){if(n>1e4)return null;if(i===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let o=-1;for(let a=this.year-1;a>=0;a--)if(e.year[a]===1){o=a;break}if(o===-1)return null;this.year=o,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let s=this.findPrevious(r,d[i][0],e,d[i][2]);if(s>1){let o=i+1;for(;o<d.length;){let a=d[o][0],h=d[o][2],l=this.getMaxPatternValue(a,e,h);this[a]=l,o++}if(s===3){if(this[d[i][1]]--,i===0){let p=this.getLastDayOfMonth(this.year,this.month);this.day>p&&(this.day=p)}if(i===1)if(this.day<=0)this.day=1;else{let p=this.year,u=this.month;for(;u<0;)u+=12,p--;for(;u>11;)u-=12,p++;let f=u!==1?b[u]:new Date(Date.UTC(p,u+1,0)).getUTCDate();this.day>f&&(this.day=f)}this.apply();let a=d[i][0],h=d[i][2],l=this.getMaxPatternValue(a,e,h);if(a==="day"){let p=this.getLastDayOfMonth(this.year,this.month);this[a]=Math.min(l,p)}else this[a]=l;if(this.apply(),i===0){let p=d[1][2],u=this.getMaxPatternValue("day",e,p),f=this.getLastDayOfMonth(this.year,this.month),c=Math.min(u,f);c!==this.day&&(this.day=c,this.hour=this.getMaxPatternValue("hour",e,d[2][2]),this.minute=this.getMaxPatternValue("minute",e,d[3][2]),this.second=this.getMaxPatternValue("second",e,d[4][2]))}if(i===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0;)this.year--;if(this.year<0)return null}return this.recurseBackward(e,r,0,n+1)}else if(this.apply())return this.recurseBackward(e,r,i-1,n+1)}return i+=1,i>=d.length?this:this.year<0?null:this.recurseBackward(e,r,i,n+1)}getMaxPatternValue(e,r,i){if(e==="day"&&r.lastDayOfMonth)return this.getLastDayOfMonth(this.year,this.month);if(e==="day"&&!r.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let n=r[e].length-1;n>=0;n--)if(r[e][n])return n-i;return r[e].length-1-i}findPrevious(e,r,i,n){return this._findMatch(e,r,i,n,-1)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):S(R(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(e,r){if(!e.starYear&&(this.year<0||this.year>=e.year.length||e.year[this.year]===0))return!1;for(let i=0;i<d.length;i++){let n=d[i][0],s=d[i][2],o=this[n];if(o+s<0||o+s>=e[n].length)return!1;let a=e[n][o+s];if(n==="day"){if(!a){for(let h=0;h<e.nearestWeekdays.length;h++)if(e.nearestWeekdays[h]){let l=this.getNearestWeekday(this.year,this.month,h-s);if(l!==-1&&l===o){a=1;break}}}if(e.lastWeekday){let h=this.getLastWeekday(this.year,this.month);o===h&&(a=1)}if(e.lastDayOfMonth){let h=this.getLastDayOfMonth(this.year,this.month);o===h&&(a=1)}if(!e.starDOW){let h=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),l=e.dayOfWeek[(h+(o-1))%7];l&&l&63&&(l=this.isNthWeekdayOfMonth(this.year,this.month,o,l)?1:0),e.useAndLogic?a=a&&l:!r.domAndDow&&!e.starDOM?a=a||l:a=a&&l}}if(!a)return!1}return!0}};function Y(t){if(t===void 0&&(t={}),delete t.name,t.legacyMode!==void 0&&t.domAndDow===void 0?t.domAndDow=!t.legacyMode:t.domAndDow===void 0&&(t.domAndDow=!1),t.legacyMode=!t.domAndDow,t.paused=t.paused===void 0?!1:t.paused,t.maxRuns=t.maxRuns===void 0?1/0:t.maxRuns,t.catch=t.catch===void 0?!1:t.catch,t.interval=t.interval===void 0?0:parseInt(t.interval.toString(),10),t.utcOffset=t.utcOffset===void 0?void 0:parseInt(t.utcOffset.toString(),10),t.dayOffset=t.dayOffset===void 0?0:parseInt(t.dayOffset.toString(),10),t.unref=t.unref===void 0?!1:t.unref,t.mode=t.mode===void 0?"auto":t.mode,t.alternativeWeekdays=t.alternativeWeekdays===void 0?!1:t.alternativeWeekdays,t.sloppyRanges=t.sloppyRanges===void 0?!1:t.sloppyRanges,!["auto","5-part","6-part","7-part","5-or-6-parts","6-or-7-parts"].includes(t.mode))throw new Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");if(t.startAt&&(t.startAt=new y(t.startAt,t.timezone)),t.stopAt&&(t.stopAt=new y(t.stopAt,t.timezone)),t.interval!==null){if(isNaN(t.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(t.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(t.utcOffset!==void 0){if(isNaN(t.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(t.utcOffset<-870||t.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(t.utcOffset!==void 0&&t.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(t.unref!==!0&&t.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");if(t.dayOffset!==void 0&&t.dayOffset!==0&&isNaN(t.dayOffset))throw new Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");return t}function D(t){return Object.prototype.toString.call(t)==="[object Function]"||typeof t=="function"||t instanceof Function}function j(t){return D(t)}function q(t){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(t):t&&typeof t.unref<"u"&&t.unref()}var A=30*1e3,O=[],_=class{name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(t){if(this.options.dayOffset!==void 0&&this.options.dayOffset!==0){let e=this.options.dayOffset*24*60*60*1e3;return new Date(t.getTime()+e)}return t}constructor(t,e,r){let i,n;if(D(e))n=e;else if(typeof e=="object")i=e;else if(e!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(D(r))n=r;else if(typeof r=="object")i=r;else if(r!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=i?.name,this.options=Y(i),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:i?i.maxRuns:void 0,paused:i?i.paused:!1,pattern:new P("* * * * *",void 0,{mode:"auto"})},t&&(t instanceof Date||typeof t=="string"&&t.indexOf(":")>0)?this._states.once=new y(t,this.getTz()):this._states.pattern=new P(t,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(O.find(s=>s.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");O.push(this)}return n!==void 0&&j(n)&&(this.fn=n,this.schedule()),this}nextRun(t){let e=this._next(t);return e?this.applyDayOffset(e.getDate(!1)):null}nextRuns(t,e){this._states.maxRuns!==void 0&&t>this._states.maxRuns&&(t=this._states.maxRuns);let r=e||this._states.currentRun||void 0;return this._enumerateRuns(t,r,"next")}previousRuns(t,e){return this._enumerateRuns(t,e||void 0,"previous")}_enumerateRuns(t,e,r){let i=[],n=e?new y(e,this.getTz()):null,s=r==="next"?this._next:this._previous;for(;t--;){let o=s.call(this,n);if(!o)break;let a=o.getDate(!1);i.push(this.applyDayOffset(a)),n=o}return i}match(t){if(this._states.once){let r=new y(t,this.getTz());r.ms=0;let i=new y(this._states.once,this.getTz());return i.ms=0,r.getTime()===i.getTime()}let e=new y(t,this.getTz());return e.ms=0,e.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let t=this.nextRun(this._states.currentRun),e=!this._states.paused,r=this.fn!==void 0,i=!this._states.kill;return e&&r&&i&&t!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(t){let e=this._next(t);return e?t instanceof y||t instanceof Date?e.getTime()-t.getTime():e.getTime()-new y(t).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let t=O.indexOf(this);t>=0&&O.splice(t,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(t){if(t&&this.fn)throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");t&&(this.fn=t);let e=this.msToNext(),r=this.nextRun(this._states.currentRun);return e==null||isNaN(e)||r===null?this:(e>A&&(e=A),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(r),e),this._states.currentTimeout&&this.options.unref&&q(this._states.currentTimeout),this)}async _trigger(t){this._states.blocking=!0,this._states.currentRun=new y(void 0,this.getTz());try{if(this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){if(D(this.options.catch))try{this.options.catch(e,this)}catch{}}else this.fn!==void 0&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new y(t,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(t){let e=new Date,r=!this._states.paused&&e.getTime()>=t.getTime(),i=this._states.blocking&&this.options.protect;r&&!i?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):r&&i&&D(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(t){let e=!!(t||this._states.currentRun),r=!1;!t&&this.options.startAt&&this.options.interval&&([t,e]=this._calculatePreviousRun(t,e),r=!t),t=new y(t,this.getTz()),this.options.startAt&&t&&t.getTime()<this.options.startAt.getTime()&&(t=this.options.startAt);let i=this._states.once||new y(t,this.getTz());return!r&&i!==this._states.once&&(i=i.increment(this._states.pattern,this.options,e)),this._states.once&&this._states.once.getTime()<=t.getTime()||i===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&i.getTime()>=this.options.stopAt.getTime()?null:i}_previous(t){let e=new y(t,this.getTz());this.options.stopAt&&e.getTime()>this.options.stopAt.getTime()&&(e=this.options.stopAt);let r=new y(e,this.getTz());return this._states.once?this._states.once.getTime()<e.getTime()?this._states.once:null:(r=r.decrement(this._states.pattern,this.options),r===null||this.options.startAt&&r.getTime()<this.options.startAt.getTime()?null:r)}_calculatePreviousRun(t,e){let r=new y(void 0,this.getTz()),i=t;if(this.options.startAt.getTime()<=r.getTime()){i=this.options.startAt;let n=i.getTime()+this.options.interval*1e3;for(;n<=r.getTime();)i=new y(i,this.getTz()).increment(this._states.pattern,this.options,!0),n=i.getTime()+this.options.interval*1e3;e=!0}return i===null&&(i=void 0),[i,e]}};function V(t,e,r,i){let n=i?{timezone:i}:{};return new _("* * * * * *",()=>{let o=new Date;if(!t.some(l=>new _(l,n).nextRun(o)===null))return;e.some(l=>new _(l,n).nextRun(o)===null)||r()})}g();var B=0;function H(){return++B}var W;(typeof __EDGE_RUNTIME__>"u"||!__EDGE_RUNTIME__)&&(W=(await import("module")).createRequire);var Z=M.child({section:"Utils"}),w,C=()=>{if(!w){let t=m();if(W&&typeof import.meta<"u"&&import.meta.url)try{w=W(import.meta.url)}catch{}!w&&typeof globalThis.require=="function"&&(w=globalThis.require),w||(w=e=>{throw new Error(`require("${e}") is not available in this runtime (${t}).`)})}return w},ft={run:()=>Z.info(`Running on ${m()}`)},G=t=>{try{if(typeof Deno<"u"&&Deno.env)return Deno.env.get(t)}catch{}try{if(typeof process<"u"&&process.env)return process.env[t]}catch{}},pt=()=>{try{if(typeof Deno<"u"&&Deno.env)return Deno.env.toObject()}catch{}try{if(typeof process<"u"&&process.env)return{...process.env}}catch{}return{}},ct=t=>{if(typeof Deno<"u"&&Deno.readTextFileSync)return Deno.readTextFileSync(t);let{readFileSync:e}=C()("node:fs");return e(t,"utf8")},yt=t=>{if(typeof Deno<"u"&&Deno.statSync)try{return Deno.statSync(t),!0}catch{return!1}let{existsSync:e}=C()("node:fs");return e(t)},gt=()=>typeof Deno<"u"&&Deno.cwd?Deno.cwd():typeof process<"u"&&process.cwd?process.cwd():"/",mt=()=>{if(m()==="deno")return new URL(".",import.meta.url).pathname;if(typeof import.meta<"u"&&import.meta.url){let e=new URL(import.meta.url);if(e.protocol==="file:"){let{dirname:i}=C()("node:path"),{fileURLToPath:n}=C()("node:url");return i(n(import.meta.url))}let r=e.pathname;return r.substring(0,r.lastIndexOf("/"))}return""},wt=()=>{let t=m(),e;return t==="deno"?e=Deno.build.os:e=process.platform,e==="win32"||e==="windows"?"windows":"linux"},Tt=()=>G("NODE_ENV")?.toLowerCase()==="production"?"production":"development",vt=()=>m()==="deno"?Deno.env.get("TMPDIR")||Deno.env.get("TEMP")||"/tmp":C()("node:os").tmpdir(),Dt=t=>new Promise(e=>setTimeout(e,t));export{M as a,V as b,H as c,C as d,ft as e,G as f,pt as g,ct as h,yt as i,gt as j,mt as k,wt as l,Tt as m,vt as n,Dt as o};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as s}from"./chunk-XO3TAODL.js";import{h as f}from"./chunk-5CIUNKHO.js";f();function u(n){return n instanceof Error||Object.prototype.toString.call(n)==="[object Error]"}function w(n){if(typeof n!="object"||n===null)return!1;let o=Object.getPrototypeOf(n);return o===Object.prototype||o===null}function b(n){if(n===void 0)return;if(u(n))return{err:s(n)};let o=new Map,i=r=>{if(u(r))return s(r);if(Array.isArray(r)){let e=o.get(r);if(e)return e;let t=[];o.set(r,t);for(let c of r)t.push(i(c));return t}if(w(r)){let e=o.get(r);if(e)return e;let t={};o.set(r,t);for(let[c,k]of Object.entries(r))t[c]=i(k);return t}return r};return i(n)}export{b as a};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as E}from"./chunk-XO3TAODL.js";import{a as M,c as Z,d as ee,g as we,h as z,i as te,j as be,k as Re,l as ke,m as re}from"./chunk-6DRVUVNZ.js";import{a as ye}from"./chunk-JBN5SOGD.js";import{h as u}from"./chunk-5CIUNKHO.js";u();u();var x={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")},Jt={defaultMerge:x.defaultMerge};function et(t,e){return e}function tt(t,e){return t.filter(r=>r!==void 0)}var Te;(function(t){t[t.NOT=0]="NOT",t[t.RECORD=1]="RECORD",t[t.ARRAY=2]="ARRAY",t[t.SET=3]="SET",t[t.MAP=4]="MAP",t[t.OTHER=5]="OTHER"})(Te||(Te={}));function xe(t){return typeof t!="object"||t===null?0:Array.isArray(t)?2:ot(t)?1:t instanceof Set?3:t instanceof Map?4:5}function rt(t){let e=new Set;for(let r of t)for(let n of[...Object.keys(r),...Object.getOwnPropertySymbols(r)])e.add(n);return e}function nt(t,e){return typeof t=="object"&&Object.prototype.propertyIsEnumerable.call(t,e)}function Ee(t){let e=0,r=t[0]?.[Symbol.iterator]();return{[Symbol.iterator](){return{next(){do{if(r===void 0)return{done:!0,value:void 0};let n=r.next();if(n.done===!0){e+=1,r=t[e]?.[Symbol.iterator]();continue}return{done:!1,value:n.value}}while(!0)}}}}}var Se=["[object Object]","[object Module]"];function ot(t){if(!Se.includes(Object.prototype.toString.call(t)))return!1;let{constructor:e}=t;if(e===void 0)return!0;let r=e.prototype;return!(r===null||typeof r!="object"||!Se.includes(Object.prototype.toString.call(r))||!r.hasOwnProperty("isPrototypeOf"))}function st(t,e,r){let n={};for(let o of rt(t)){let s=[];for(let a of t)nt(a,o)&&s.push(a[o]);if(s.length===0)continue;let i=e.metaDataUpdater(r,{key:o,parents:t}),c=Oe(s,e,i);c!==x.skip&&(o==="__proto__"?Object.defineProperty(n,o,{value:c,configurable:!0,enumerable:!0,writable:!0}):n[o]=c)}return n}function it(t){return t.flat()}function at(t){return new Set(Ee(t))}function ct(t){return new Map(Ee(t))}function ut(t){return t.at(-1)}var H={mergeRecords:st,mergeArrays:it,mergeSets:at,mergeMaps:ct,mergeOthers:ut};function $(t,e){let r=ft(t,n);function n(...o){return Oe(o,r,e)}return n}function ft(t,e){return{defaultMergeFunctions:H,mergeFunctions:{...H,...Object.fromEntries(Object.entries(t).filter(([r,n])=>Object.hasOwn(H,r)).map(([r,n])=>n===!1?[r,H.mergeOthers]:[r,n]))},metaDataUpdater:t.metaDataUpdater??et,deepmerge:e,useImplicitDefaultMerging:t.enableImplicitDefaultMerging??!1,filterValues:t.filterValues===!1?void 0:t.filterValues??tt,actions:x}}function Oe(t,e,r){let n=e.filterValues?.(t,r)??t;if(n.length===0)return;if(n.length===1)return ne(n,e,r);let o=xe(n[0]);if(o!==0&&o!==5){for(let s=1;s<n.length;s++)if(xe(n[s])!==o)return ne(n,e,r)}switch(o){case 1:return lt(n,e,r);case 2:return dt(n,e,r);case 3:return ht(n,e,r);case 4:return mt(n,e,r);default:return ne(n,e,r)}}function lt(t,e,r){let n=e.mergeFunctions.mergeRecords(t,e,r);return n===x.defaultMerge||e.useImplicitDefaultMerging&&n===void 0&&e.mergeFunctions.mergeRecords!==e.defaultMergeFunctions.mergeRecords?e.defaultMergeFunctions.mergeRecords(t,e,r):n}function dt(t,e,r){let n=e.mergeFunctions.mergeArrays(t,e,r);return n===x.defaultMerge||e.useImplicitDefaultMerging&&n===void 0&&e.mergeFunctions.mergeArrays!==e.defaultMergeFunctions.mergeArrays?e.defaultMergeFunctions.mergeArrays(t):n}function ht(t,e,r){let n=e.mergeFunctions.mergeSets(t,e,r);return n===x.defaultMerge||e.useImplicitDefaultMerging&&n===void 0&&e.mergeFunctions.mergeSets!==e.defaultMergeFunctions.mergeSets?e.defaultMergeFunctions.mergeSets(t):n}function mt(t,e,r){let n=e.mergeFunctions.mergeMaps(t,e,r);return n===x.defaultMerge||e.useImplicitDefaultMerging&&n===void 0&&e.mergeFunctions.mergeMaps!==e.defaultMergeFunctions.mergeMaps?e.defaultMergeFunctions.mergeMaps(t):n}function ne(t,e,r){let n=e.mergeFunctions.mergeOthers(t,e,r);return n===x.defaultMerge||e.useImplicitDefaultMerging&&n===void 0&&e.mergeFunctions.mergeOthers!==e.defaultMergeFunctions.mergeOthers?e.defaultMergeFunctions.mergeOthers(t):n}u();u();u();u();var R=class extends Error{name="KyError";get isKyError(){return!0}};var k=class extends R{name="HTTPError";response;request;options;data;constructor(e,r,n){let o=e.status||e.status===0?e.status:"",s=e.statusText??"",i=`${o} ${s}`.trim(),c=i?`status code ${i}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.response=e,this.request=r,this.options=n}};u();var v=class extends R{name="NetworkError";request;constructor(e,r){super(`Request failed due to a network error: ${e.method} ${e.url}`,r),this.request=e}};u();var A=class extends Error{name="NonError";value;constructor(e){let r="Non-error value was thrown";try{typeof e=="string"?r=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(r=e.message)}catch{}super(r),this.value=e}};u();var O=class extends R{name="ForceRetryError";customDelay;code;customRequest;constructor(e){let r=e?.cause?e.cause instanceof Error?e.cause:new A(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",r?{cause:r}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}};u();var B=class extends Error{name="SchemaValidationError";issues;constructor(e){super("Response schema validation failed"),this.issues=e}};u();var w=class extends R{name="TimeoutError";request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.request=e}};u();u();var oe=(()=>{let t=!1,e=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(o){if(o instanceof Error&&o.message==="unsupported BodyInit type")return!1;throw o}return t&&!e})(),Pe=typeof globalThis.AbortController=="function",V=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",Me=typeof globalThis.ReadableStream=="function",ve=typeof globalThis.FormData=="function",J=["get","post","put","patch","head","delete"],pt=()=>{};pt();var Ae={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},q=2147483647,qe=40,W=Symbol("stop"),F=class{options;constructor(e){this.options=e}},Ce=t=>new F(t),je={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Ie={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var K=new TextEncoder,gt=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(let[r,n]of t)e+=qe,e+=K.encode(`Content-Disposition: form-data; name="${r}"`).byteLength,e+=typeof n=="string"?K.encode(n).byteLength:n.size;return e}return t instanceof Blob?t.size:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:typeof t=="string"?K.encode(t).byteLength:t instanceof URLSearchParams?K.encode(t.toString()).byteLength:0},Fe=(t,e,r)=>{let n,o=0;return t.pipeThrough(new TransformStream({transform(s,i){if(i.enqueue(s),n){o+=n.byteLength;let c=e===0?0:o/e;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(e,o),transferredBytes:o},n)}n=s},flush(){n&&(o+=n.byteLength,r?.({percent:1,totalBytes:Math.max(e,o),transferredBytes:o},n))}}))},_e=(t,e)=>{if(!t.body)return t;let r={status:t.status,statusText:t.statusText,headers:t.headers};if(t.status===204)return new Response(null,r);let n=Math.max(0,Number(t.headers.get("content-length"))||0);return new Response(Fe(t.body,n,e),r)},Le=(t,e,r)=>{if(!t.body)return t;let n=gt(r??t.body);return new Request(t,{duplex:"half",body:Fe(t.body,n,e)})};u();u();var T=t=>t!==null&&typeof t=="object";var yt=Symbol("replaceOption"),se=t=>T(t)&&t[yt]===!0?{isReplace:!0,value:t.value}:{isReplace:!1,value:t};var L=(...t)=>{for(let e of t)if((!T(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return ce({},...t)},ae=(t={},e={})=>{let r=new globalThis.Headers(t),n=e instanceof globalThis.Headers,o=new globalThis.Headers(e);for(let[s,i]of o.entries())n&&i==="undefined"||i===void 0?r.delete(s):r.set(s,i);return r},ie=t=>{if(!T(t)||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},C=t=>{if(t instanceof URLSearchParams){let e=new URLSearchParams(t),r=t[S];return r&&(e[S]=new Set(r)),e}return t instanceof globalThis.Headers?new globalThis.Headers(t):Array.isArray(t)?[...t]:ie(t)?{...t}:t},wt=t=>Object.fromEntries(Object.entries(t).filter(e=>e[1]!==void 0)),bt=(t,e)=>ie(t)&&ie(e)?wt({...t,...e}):ae(t,e);function _(t,e,r){return Object.hasOwn(e,r)&&e[r]===void 0?[]:ce(t[r]??[],e[r]??[])}var X=(t={},e={})=>({init:_(t,e,"init"),beforeRequest:_(t,e,"beforeRequest"),beforeRetry:_(t,e,"beforeRetry"),beforeError:_(t,e,"beforeError"),afterResponse:_(t,e,"afterResponse")}),S=Symbol("deletedParameters"),Rt=(t,e)=>{let r=new URLSearchParams,n=new Set;for(let o of[t,e])if(o!==void 0)if(o instanceof URLSearchParams){for(let[i,c]of o.entries())r.append(i,c),n.delete(i);let s=o[S];if(s)for(let i of s)r.delete(i),n.add(i)}else if(Array.isArray(o))for(let s of o){if(!Array.isArray(s)||s.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(s[0]),String(s[1])),n.delete(String(s[0]))}else if(T(o))for(let[s,i]of Object.entries(o))i===void 0?(r.delete(s),n.add(s)):(r.append(s,String(i)),n.delete(s));else{let s=new URLSearchParams(o);for(let[i,c]of s.entries())r.append(i,c),n.delete(i)}return n.size>0&&(r[S]=n),r},ce=(...t)=>{let e={},r={},n={},o,s=[];for(let i of t)if(Array.isArray(i))Array.isArray(e)||(e=[]),e=[...e,...i];else if(T(i)){for(let[c,a]of Object.entries(i)){if(c==="signal"&&a instanceof globalThis.AbortSignal){s.push(a);continue}let f=se(a),{isReplace:l}=f;if(a=f.value,c==="context"){if(a!=null&&(!T(a)||Array.isArray(a)))throw new TypeError("The `context` option must be an object");e={...e,context:a==null?{}:l?{...a}:{...e.context,...a}};continue}if(c==="searchParams"){a==null?o=void 0:l?o=a:o=o===void 0?a:Rt(o,a);continue}T(a)&&!l&&c in e&&(a=ce(e[c],a)),e={...e,[c]:a}}if(T(i.hooks)){let{value:c,isReplace:a}=se(i.hooks);n=X(a?{}:n,c),e.hooks=n}if(T(i.headers)){let{value:c,isReplace:a}=se(i.headers);r=a?C(c):bt(r,c),e.headers=r}}return o!==void 0&&(e.searchParams=o),s.length>0&&(s.length===1?e.signal=s[0]:V?e.signal=AbortSignal.any(s):e.signal=s.at(-1)),e};u();var Ne=t=>J.includes(t)?t.toUpperCase():t,kt=["get","put","head","delete","options","trace"],Tt=[408,413,429,500,502,503,504],xt=[413,429,503],De={limit:2,methods:kt,statusCodes:Tt,afterStatusCodes:xt,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3,jitter:void 0,retryOnTimeout:!1},Ue=(t={})=>{if(typeof t=="number")return{...De,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");let e=Object.fromEntries(Object.entries({...t,methods:t.methods?.map(r=>r.toLowerCase())}).filter(([,r])=>r!==void 0));return{...De,...e}};u();async function ue(t,e,r,n){return new Promise((o,s)=>{let i=setTimeout(()=>{r&&r.abort(),s(new w(t))},n.timeout);n.fetch(t,e).then(o).catch(s).then(()=>{clearTimeout(i)})})}u();async function Y(t,{signal:e}){return new Promise((r,n)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",o,{once:!0}));function o(){clearTimeout(s),n(e.reason)}let s=setTimeout(()=>{e?.removeEventListener("abort",o),r()},t)})}u();var ze=t=>{let e={};for(let r in t)Object.hasOwn(t,r)&&!(r in Ie)&&!(r in je)&&(e[r]=t[r]);return e},He=t=>t===void 0?!1:Array.isArray(t)?t.length>0:t instanceof URLSearchParams?t.size>0||!!t[S]?.size:typeof t=="object"?Object.keys(t).length>0:typeof t=="string"?t.trim().length>0:!!t;u();var St=Object.prototype.toString,Et=t=>St.call(t)==="[object Error]",Ot=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function fe(t){if(!(t&&Et(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")||r==="Failed to fetch"||r.startsWith("Failed to fetch (")&&r.endsWith(")")?!0:Ot.has(r)}u();var le=(t,e)=>t instanceof e||t?.name===e.name;function $e(t){return le(t,k)}function Be(t){return le(t,v)}function Ve(t){return le(t,w)}var Pt=10*1024*1024,Mt="The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl",D=Symbol("timedOutResponseData"),vt=t=>{let e=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(t),r=e?.[1]??e?.[2];if(r)try{return new TextDecoder(r)}catch{}return new TextDecoder},Je="The `schema` argument must follow the Standard Schema specification",At=t=>typeof t!="object"?t:{...t,...t.methods&&{methods:[...t.methods]},...t.statusCodes&&{statusCodes:[...t.statusCodes]},...t.afterStatusCodes&&{afterStatusCodes:[...t.afterStatusCodes]}},Xe=Object.prototype.toString,We=t=>t instanceof globalThis.Request||Xe.call(t)==="[object Request]",N=t=>t instanceof globalThis.Response||Xe.call(t)==="[object Response]",qt=t=>Array.isArray(t)?t.map(e=>[...e]):C(t);function Ct(t){let e={...t,json:C(t.json),context:C(t.context),headers:C(t.headers),searchParams:qt(t.searchParams)};return t.retry!==void 0&&(e.retry=At(t.retry)),e}var Ke=async(t,e)=>{if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError(Je);let r=e["~standard"];if(typeof r!="object"||r===null||typeof r.validate!="function")throw new TypeError(Je);let n=await r.validate(t);if(n.issues)throw new B(n.issues);return n.value},U=class t{static create(e,r){let n=r.hooks?.init??[],o=n.length>0?Ct(r):r;for(let a of n)a(o);let s=new t(e,o),i=async()=>{if(typeof s.#e.timeout=="number"&&s.#e.timeout>q)throw new RangeError(`The \`timeout\` option cannot be greater than ${q}`);if(typeof s.#e.totalTimeout=="number"&&s.#e.totalTimeout>q)throw new RangeError(`The \`totalTimeout\` option cannot be greater than ${q}`);await Promise.resolve();let a=await s.#I(),f=a??await s.#O(async()=>s.#y()),l=a!==void 0||s.#g();for(;;){if(f===void 0)return f;if(N(f))try{f=await s.#F(f)}catch(p){if(!(p instanceof O))throw p;let b=await s.#p(p,async()=>s.#y());if(b===void 0)return b;f=b,l=s.#g();continue}let d=f;if(!d.ok&&d.type!=="opaque"&&(typeof s.#e.throwHttpErrors=="function"?s.#e.throwHttpErrors(d.status):s.#e.throwHttpErrors)){let p=new k(d,s.#a(d),s.#i()),b=p;if(p.data=await s.#A(d),l)throw b;let g=await s.#p(p,async()=>s.#y());if(g===void 0)return g;f=g,l=s.#g();continue}break}if(!N(f))return f;if(s.#x(f),s.#e.onDownloadProgress){if(typeof s.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Me)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");let d=f.clone();return s.#n(f),_e(d,s.#e.onDownloadProgress)}return f},c=(async()=>{try{return await i()}catch(a){if(!(a instanceof Error)||s.#k.has(a))throw a;let f=a;for(let l of s.#e.hooks.beforeError){let d=await l({request:s.request,options:s.#i(),error:f,retryCount:s.#r});d instanceof Error&&(f=d)}throw f}finally{let a=s.#R;s.#m(a?.body??void 0),s.request!==a&&s.#m(s.request.body??void 0)}})();for(let[a,f]of Object.entries(Ae))a==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(c[a]=async l=>{s.request.headers.set("accept",s.request.headers.get("accept")||f);let d=await c;if(a!=="json")return d[a]();let p=await d.text();if(p==="")return l!==void 0?Ke(void 0,l):JSON.parse(p);let b=o.parseJson?await o.parseJson(p,{request:s.#a(d),response:d}):JSON.parse(p);return l===void 0?b:Ke(b,l)});return c}static#M(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0)):e}request;#o;#r=0;#t;#e;#R;#c;#k=new WeakSet;#u;#h;#f=!1;#T=new WeakMap;constructor(e,r={}){if(this.#t=e,Object.hasOwn(r,"prefixUrl"))throw new Error(Mt);if(this.#e={...r,headers:ae(this.#t.headers,r.headers),hooks:X({},r.hooks),method:Ne(r.method??this.#t.method??"GET"),prefix:String(r.prefix||""),retry:Ue(r.retry),throwHttpErrors:r.throwHttpErrors??!0,timeout:r.timeout??1e4,totalTimeout:r.totalTimeout??!1,fetch:r.fetch??globalThis.fetch.bind(globalThis),context:r.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(typeof this.#t=="string"){if(this.#e.prefix){let o=this.#e.prefix.replace(/\/+$/,""),s=this.#t.replace(/^\/+/,"");this.#t=`${o}/${s}`}if(this.#e.baseUrl){let o;try{o=new URL(this.#t)}catch{}o||(this.#t=new URL(this.#t,new Request(this.#e.baseUrl).url))}}Pe&&V&&(this.#c=this.#e.signal??this.#t.signal,this.#o=new globalThis.AbortController,this.#e.signal=this.#E()),oe&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));let n=r.headers&&new globalThis.Headers(r.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(ve&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!n&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),He(this.#e.searchParams)){let o=new URL(this.request.url),s=this.#e.searchParams?.[S];if(s)for(let i of s)o.searchParams.delete(i);if(typeof this.#e.searchParams=="string"){let i=this.#e.searchParams.replace(/^\?/,"");i!==""&&(o.search=o.search?`${o.search}&${i}`:`?${i}`)}else{let i=new URLSearchParams(t.#M(this.#e.searchParams));for(let[c,a]of i.entries())o.searchParams.append(c,a)}if(this.#e.searchParams&&typeof this.#e.searchParams=="object"&&!Array.isArray(this.#e.searchParams)&&!(this.#e.searchParams instanceof URLSearchParams))for(let[i,c]of Object.entries(this.#e.searchParams))c===void 0&&o.searchParams.delete(i);this.request=new globalThis.Request(o,this.#e)}if(this.#e.onUploadProgress&&typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");this.#h=typeof this.#e.totalTimeout=="number"?this.#P():void 0}#s(){let e=this.#e.retry.delay(this.#r+1),r=e;return this.#e.retry.jitter===!0?r=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(r=this.#e.retry.jitter(e),(!Number.isFinite(r)||r<0)&&(r=e)),Math.min(this.#e.retry.backoffLimit,r)}async#v(e){if(this.#r>=this.#e.retry.limit)throw e;let r=e instanceof Error?e:new A(e);if(r instanceof O)return r.customDelay??this.#s();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){let n=await this.#e.retry.shouldRetry({error:r,retryCount:this.#r+1});if(n===!1)throw e;if(n===!0)return this.#s()}if(Ve(e)){if(!this.#e.retry.retryOnTimeout)throw e;return this.#s()}if($e(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;let n=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(n&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let o=Number(n)*1e3;return Number.isNaN(o)?o=Date.parse(n)-Date.now():o>=Date.parse("2024-01-01")&&(o-=Date.now()),Number.isFinite(o)?(o=Math.max(0,o),Math.min(this.#e.retry.maxRetryAfter,o)):Math.min(this.#e.retry.maxRetryAfter,this.#s())}if(e.response.status===413)throw e;return this.#s()}if(!Be(e))throw e;return this.#s()}#x(e){let r=this.#a(e);return this.#e.parseJson&&(e.json=async()=>{let n=await e.text();return n===""?JSON.parse(n):this.#e.parseJson(n,{request:r,response:e})}),e}async#A(e){let r=await this.#C(e,this.#S());if(r===D){this.#l();return}if(!r)return;if(!this.#q(e.headers.get("content-type")??""))return r;let n=await this.#j(r,e,this.#S(),this.#a(e));if(n===D){this.#l();return}return n}#S(){let e=this.#e.timeout===!1?1e4:this.#e.timeout,r=this.#d();if(r===void 0)return e;if(r<=0)throw new w(this.request);return Math.min(e,r)}#q(e){let r=(e.split(";",1)[0]??"").trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(r)}async#C(e,r){let{body:n}=e;if(!n)try{return await e.text()}catch{return}let o;try{o=n.getReader()}catch{return}let s=vt(e.headers.get("content-type")??""),i=[],c=0,a=(async()=>{try{for(;;){let{done:d,value:p}=await o.read();if(d)break;if(c+=p.byteLength,c>Pt){o.cancel().catch(()=>{});return}i.push(s.decode(p,{stream:!0}))}}catch{return}return i.push(s.decode()),i.join("")})(),f=new Promise(d=>{let p=setTimeout(()=>{d(D)},r);a.finally(()=>{clearTimeout(p)})}),l=await Promise.race([a,f]);return l===D&&o.cancel().catch(()=>{}),l}async#j(e,r,n,o){let s;try{return await Promise.race([Promise.resolve().then(()=>this.#e.parseJson?this.#e.parseJson(e,{request:o,response:r}):JSON.parse(e)),new Promise(i=>{s=setTimeout(()=>{i(D)},n)})])}catch{return}finally{clearTimeout(s)}}#m(e){e&&e.cancel().catch(()=>{})}#n(e){this.#m(e.body??void 0)}#E(){return this.#c?AbortSignal.any([this.#c,this.#o.signal]):this.#o.signal}#l(){let e=this.#d();if(e!==void 0&&e<=0)throw new w(this.request)}async#I(){for(let e of this.#e.hooks.beforeRequest){let r=await e({request:this.request,options:this.#i(),retryCount:0});if(We(r))this.#w(r);else if(N(r))return r}}async#F(e){let r=this.#a(e);for(let n of this.#e.hooks.afterResponse){let o=this.#b(e.clone(),r);this.#x(o);let s;try{s=await n({request:this.request,options:this.#i(),response:o,retryCount:this.#r})}catch(c){throw o!==e&&this.#n(o),this.#n(e),c}if(s instanceof F)throw o!==e&&this.#n(o),this.#n(e),new O(s.options);let i=N(s)?this.#b(s,r):e;o!==e&&o!==i&&o.body!==i.body&&this.#n(o),e!==i&&e.body!==i.body&&this.#n(e),e=i}return e}async#O(e){try{return await e()}catch(r){return this.#p(r,e)}}async#p(e,r){this.#f=!1;let n=Math.min(await this.#v(e),q),o={signal:this.#c},s=this.#d();if(s!==void 0){if(s<=0)throw new w(this.request);if(n>=s)throw await Y(s,o),new w(this.request)}if(await Y(n,o),this.#l(),e instanceof O&&e.customRequest){let i=new globalThis.Request(e.customRequest,this.#e.signal?{signal:this.#e.signal}:void 0);this.#w(i)}for(let i of this.#e.hooks.beforeRetry){let c;try{c=await i({request:this.request,options:this.#i(),error:e,retryCount:this.#r+1})}catch(a){throw a instanceof Error&&a!==e&&this.#k.add(a),a}if(We(c)){this.#w(c);break}if(N(c))return this.#f=!0,this.#r++,c;if(c===W)return}return this.#l(),this.#r++,this.#O(r)}#g(){let e=this.#f;return this.#f=!1,e}async#y(){this.#o?.signal.aborted&&(this.#o=new globalThis.AbortController,this.#e.signal=this.#E(),this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));let e=ze(this.#e),r=this.#e.retry.limit>0?this.request.clone():void 0,n=this.#_(this.request,this.#e.body??void 0);this.#R=n,r&&(this.request=r);try{let o=this.#d();if(o!==void 0&&o<=0)throw new w(this.request);let s=this.#e.timeout===!1?o:o===void 0?this.#e.timeout:Math.min(this.#e.timeout,o),i=s===void 0?await this.#e.fetch(n,e):await ue(n,e,this.#o,{timeout:s,fetch:this.#e.fetch});return this.#b(i,n)}catch(o){throw fe(o)?new v(this.request,{cause:o}):o}}#d(){if(this.#h===void 0)return;let e=this.#P()-this.#h;return Math.max(0,this.#e.totalTimeout-e)}#P(){return globalThis.performance?.now()??Date.now()}#i(){if(!this.#u){let{hooks:e,json:r,parseJson:n,stringifyJson:o,searchParams:s,timeout:i,totalTimeout:c,throwHttpErrors:a,fetch:f,...l}=this.#e;this.#u=Object.freeze(l)}return this.#u}#w(e){this.#u=void 0,this.request=e}#a(e){return this.#T.get(e)??this.request}#b(e,r){return this.#T.set(e,r),e}#_(e,r){return!this.#e.onUploadProgress||!e.body||!oe?e:Le(e,this.#e.onUploadProgress,r??this.#e.body??void 0)}};var de=t=>{let e=(r,n)=>U.create(r,L(t,n));for(let r of J)e[r]=(n,o)=>U.create(n,L(t,o,{method:r}));return e.create=r=>de(L(r)),e.extend=r=>(typeof r=="function"&&(r=r(t??{})),de(L(t,r))),e.stop=W,e.retry=Ce,e},jt=de(),Ye=jt;u();u();import{EventEmitter as Ft}from"events";var he={markets:{chromeVersion:"146",nasdaq:{statusEndpoint:"https://api.nasdaq.com/api/market-info",monitor:{liveIntervalSec:10,closedIntervalSec:3600,warnIntervalSec:60},symbols:{nasdaqListedUrl:"https://www.nasdaqtrader.com/dynamic/symdir/nasdaqlisted.txt",otherListedUrl:"https://www.nasdaqtrader.com/dynamic/symdir/otherlisted.txt",initialBackoffMs:1e3,maxRetryBackoffMs:36e5,maxFetchRetries:10},quotes:{concurrencyLimit:5}}},retrieve:{timeout:5e4,retry:{limit:5,backoffLimit:3e3}}};u();async function Ge(t){let{getEnv:e}=await import("./utils-TJZDD75X.js"),r=(await import("crypto")).default,n=e("CORELIB_AES_PASSWORD");if(!n)throw new Error("Decryption failed: CORELIB_AES_PASSWORD environment variable is not set.");let o=t.split(`
|
|
3
|
+
`).map(l=>l.trim()).filter(Boolean);if(o.length<2)throw new Error("Invalid .enc file format. Expected IV on line 1 and Ciphertext on line 2.");let s=Buffer.from(o[0],"base64"),i=Buffer.from(o[1],"base64"),c=Buffer.from(n,"hex"),a=r.createDecipheriv("aes-256-cbc",c,s),f=a.update(i);return f=Buffer.concat([f,a.final()]),JSON.parse(f.toString("utf8"))}var me=$({mergeArrays:!1}),_t=t=>!t.split(/[.-]/).some(e=>e==="__proto__"||e==="constructor"||e==="prototype");function j(t,e){for(let r of Object.keys(t))r in e||delete t[r];for(let r of Object.keys(e)){let n=e[r];n&&typeof n=="object"&&!Array.isArray(n)?((!t[r]||typeof t[r]!="object"||Array.isArray(t[r]))&&(t[r]={}),j(t[r],n)):t[r]=n}}function Lt(t,e,r,n){let o=t;for(;;){if(r(e.join(o,"pnpm-workspace.yaml")))return e.basename(o);let s=e.join(o,"package.json");if(r(s))try{if(JSON.parse(n(s)).workspaces)return e.basename(o)}catch{}let i=e.dirname(o);if(i===o)break;o=i}return e.basename(t)}var P=class t extends Ft{static instance;_config={};_defaultsPath;static _logger=M.child({section:"ConfigManager"});_initPromise=null;_isInitialized=!1;_mutationChain=Promise.resolve();_inFlightTempConfig=null;static _prematureWarnEmitted=!1;constructor(){super();let e=Re(),r=e;try{let{join:n}=ee()("node:path");r=n(e,"ConfigManager.json")}catch{r=`${e}/ConfigManager.json`}this._defaultsPath=r,j(this._config,he),globalThis.sysconfig=this._config}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(e){!this._isInitialized&&!t._prematureWarnEmitted&&re()!=="production"&&(t._prematureWarnEmitted=!0,t._logger.warn(`ConfigManager.get("${e}") called before initialize() resolved; returning seeded default`));let r=e.split("."),n=this._config;for(let o of r){if(n===null||typeof n!="object"||!(o in n))return;n=n[o]}return n}static get(e){return t.getInstance().get(e)}initialize(e){return this._initPromise?this._initPromise:(this._initPromise=this._enqueue(()=>this.runInitSequence(e)).then(()=>{this._isInitialized=!0,this._initPromise=null},r=>{throw this._initPromise=null,r}),this._initPromise)}async runInitSequence(e){t._logger.trace("initialize: start");let r=e??(typeof process<"u"&&Array.isArray(process.argv)?process.argv.slice(2):[]),n,o={};for(let i=0;i<r.length;i++){let c=r[i];if(c==="-C"||c==="--config"){i+1<r.length&&!r[i+1].startsWith("-")&&(n=r[++i]);continue}if(c.startsWith("--config=")){n=c.slice(9);continue}if(!c.startsWith("--"))continue;let a=c.slice(2);if(a===""||a.startsWith("="))continue;let f,l=a.indexOf("=");l>-1?(f=a.slice(l+1),a=a.slice(0,l)):i+1<r.length&&!r[i+1].startsWith("-")?f=r[++i]:f=!0,o[a]=f}t._logger.trace("initialize: resolved",{hasConfigPath:n!=null,overrideCount:Object.keys(o).length});let s={};this._inFlightTempConfig=s;try{if(this.loadDefaults(s),n){let i=await this.fetchExternalConfig(n);this.processHierarchy(i,s)}this.applyEnvOverrides(s),this.applyCliOverrides(o,s),j(this._config,s),t._logger.trace("initialize: committed",{keys:Object.keys(this._config??{}).length}),this.emit("initialized",this._config)}finally{this._inFlightTempConfig=null}}_enqueue(e){let r=this._mutationChain.then(e,e);return this._mutationChain=r.then(()=>{},()=>{}),r}getConfig(){return this._config}get isInitialized(){return this._isInitialized}whenReady(){return this._isInitialized?Promise.resolve():this._initPromise??Promise.resolve()}loadExternalConfig(e){return this._enqueue(()=>this.loadExternalConfigInner(e))}async loadExternalConfigInner(e){try{let r=await this.fetchExternalConfig(e),n=structuredClone(this._config);this._inFlightTempConfig=n;try{this.processHierarchy(r,n),this.applyEnvOverrides(n),j(this._config,n),this.emit("configLoaded",this._config)}finally{this._inFlightTempConfig=null}}catch(r){throw this.logError(`Failed to load external config dynamically from ${e}`,r),r}}loadDefaults(e){let r={...he};if(te(this._defaultsPath))try{r=JSON.parse(z(this._defaultsPath))}catch(n){this.logError("Failed to load defaults",n)}j(e,r)}async fetchExternalConfig(e){t._logger.trace("external config",{source:e.startsWith("http")?"http":"file"});let r;if(e.startsWith("http")){let{endPoint:s}=await import("./RequestUnlimited-DEASSJEC.js"),i=await s(e);if(i.status==="error")throw new Error("Failed to fetch external config");r=i.value.body}else r=z(e);let n=e.toLowerCase();if(n.endsWith(".enc")){t._logger.trace("decrypting .enc config");let s=this.validateConfigObject(await Ge(r),e);return t._logger.trace("decryption ok"),s}let o=await import("./dist-VT4HJLSH.js");return n.endsWith(".yaml")||n.endsWith(".yml")?this.validateConfigObject(o.parseYAML(r),e):n.endsWith(".toml")?this.validateConfigObject(o.parseTOML(r),e):n.endsWith(".json5")?this.validateConfigObject(o.parseJSON5(r),e):n.endsWith(".jsonc")?this.validateConfigObject(o.parseJSONC(r),e):n.endsWith(".ini")?this.validateConfigObject(o.parseINI(r),e):this.validateConfigObject(o.parseJSON(r),e)}validateConfigObject(e,r){if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`Config from "${r}" must be a JSON object, got ${Array.isArray(e)?"array":typeof e}`);return e}processHierarchy(e,r){if(!e)return;let n=this.getAppName(),o=ke(),s=re(),i=e.commonAll||{},c=Object.keys(e).find(l=>l.toLowerCase()===n.toLowerCase()),a=c?e[c]:null;if(a){a.common&&(i=me(i,a.common));let l=a[o];if(l){let d=l[s];d&&(i=me(i,d))}}let f=me(r,i);j(r,f)}applyEnvOverrides(e){let r="CORELIB_",n=we();Object.keys(n).forEach(o=>{if(o.startsWith(r)){let s=o.slice(r.length).toLowerCase().replace(/_/g,".");t._logger.trace("env override",{key:s});let i=this.parseValue(n[o]);this.setPath(e,s,i)}})}applyCliOverrides(e,r){Object.keys(e).forEach(n=>{if(n==="config")return;if(!_t(n)){t._logger.warn(`Dropped unsafe CLI override key "${n}" (prototype-pollution guard)`);return}let o=n.replace(/-/g,".");t._logger.trace("cli override",{key:o});let s=this.parseValue(e[n]);this.setPath(r,o,s)})}updateValue(e,r){this.setPath(this._config,e,r),this._inFlightTempConfig!==null&&this.setPath(this._inFlightTempConfig,e,r),this.emit("change",{path:e,value:r}),this.emit(`change:${e}`,r)}setPath(e,r,n){let o=r.split("."),s=e;for(;o.length>1;){let i=o.shift();(!(i in s)||typeof s[i]!="object"||s[i]===null)&&(s[i]={}),s=s[i]}s[o[0]]=n}parseValue(e){if(typeof e!="string")return e;if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}"))try{return JSON.parse(e)}catch(r){return this.logError("Failed to parse complex JSON from CLI/Env flag",r),e}return e.toLowerCase()==="true"?!0:e.toLowerCase()==="false"?!1:!Number.isNaN(Number(e))&&e.trim()!==""?Number(e):e}getAppName(){try{let e=ye();if(e==="node"||e==="bun"||typeof import.meta<"u"&&import.meta.url&&import.meta.url.startsWith("file:")){let r=ee()("node:path");return Lt(be(),r,n=>te(n),n=>z(n))}return"edge-app"}catch(e){return this.logError("Failed to get app name from cwd. Falling back to default-app",e),"default-app"}}logError(e,r){let n=r?E(r):void 0;t._logger.error(e,{error:n})}toJsonString(){return JSON.stringify(this._config)}toBuffer(){return Buffer.from(this.toJsonString())}__resetForTests(){this._initPromise=null,this._isInitialized=!1,this._inFlightTempConfig=null,this._mutationChain=Promise.resolve(),t._prematureWarnEmitted=!1}};u();var Dt=M.child({section:"RequestResponseSerialize"});async function pe(t){if(!t)return null;let e={};t.headers.forEach((o,s)=>{e[s.toLowerCase()]=o});let r,n=t.headers.get("content-type")||"";try{if(t.bodyUsed)r="[Body already consumed]";else{let o=await t.clone().text();if(n.includes("application/json"))try{r=JSON.parse(o)}catch{r=o}else r=o}}catch(o){Dt.warn("Failed to read response body",{status:t.status,url:t.url,bodyUsed:t.bodyUsed,error:E(o)}),r="[Error reading body]"}return{ok:t.ok,status:t.status,statusText:t.statusText,headers:e,url:t.url,redirected:t.redirected,type:t.type,body:r}}var y=M.child({section:"RequestUnlimited"}),Nt=$({mergeArrays:!1}),Ut=10,zt=1e3,Ht=12e4,$t=6e4;function ge(t,e,r,n){return typeof t!="number"||!Number.isFinite(t)?n:Math.min(r,Math.max(e,t))}function Qe(t){try{let e=t instanceof URL?t:new URL(t instanceof Request?t.url:t);return`${e.origin}${e.pathname}`}catch{return"[unparseable url]"}}function Bt(t,e){let r=Math.min(e,300*2**(t-1)),n=Math.round(Math.random()*r);return y.trace("retry delay computed",{attempt:t,base:r,cap:e,delayMs:n}),n}var G={timeout:5e4,throwHttpErrors:!0,retry:{limit:5,methods:["get","post","put","delete","patch"],backoffLimit:3e3,shouldRetry:({error:t,retryCount:e})=>{if(t instanceof k&&t.response){let r=t.response.status;if(r===429&&e<=5)return y.trace("retry decision",{status:r,willRetry:!0}),!0;if(r>=400&&r<500)return y.trace("retry decision: skip",{status:r,willRetry:!1}),!1;let n=r>=500;return y.trace(n?"retry decision":"retry decision: skip",{status:r,willRetry:n}),n}return y.trace("retry decision",{willRetry:!0}),!0}},method:"get",headers:{"content-type":"application/json",accept:"application/json"},hooks:{beforeRetry:[]}};function Ze(t){let e={};for(let r in t)Object.hasOwn(t,r)&&t[r]!==void 0&&(e[r.toLowerCase()]=t[r]);return e}async function Vt(t,e={}){let r=Ze(G.headers||{}),n=e.headers?Ze(e.headers):{},{headers:o,hooks:s,...i}=e,c=ge(P.get("retrieve.timeout"),zt,Ht,5e4),a=ge(P.get("retrieve.retry.limit"),0,Ut,5),f=ge(P.get("retrieve.retry.backoffLimit"),0,$t,3e3),l=Z(),d=performance.now();y.trace("endPoint: request",{cid:l,url:Qe(t),timeout:c,retryLimit:a,backoffLimit:f});let p=G.retry,b=Nt(G,{timeout:c,retry:{...p,limit:a,backoffLimit:f,delay:g=>Bt(g,f)}},i,{headers:{...r,...n},hooks:{beforeRetry:[...G.hooks?.beforeRetry||[],async({retryCount:g})=>{y.trace("endPoint: retry",{cid:l,retryCount:g,durationMs:performance.now()-d})},...s?.beforeRetry||[]]}});try{let g=await Ye(t,b),I=await pe(g);return y.trace("endPoint: ok",{cid:l,durationMs:performance.now()-d,url:Qe(t),status:g.status}),{status:"success",value:I}}catch(g){if(g instanceof k||g.response){let Q=await pe(g.response);return y.trace("endPoint: error",{cid:l,durationMs:performance.now()-d,status:Q?.status,errorMsg:"HTTP error"}),y.warn("HTTP Error",{cid:l,status:Q?.status,url:t.toString()}),{status:"error",reason:Q}}let I=E(g);return y.trace("endPoint: error",{cid:l,durationMs:performance.now()-d,errorMsg:I?.message??"internal/network error"}),y.error("Internal/Network Error",{cid:l,error:I}),{status:"error",reason:I}}}async function Un(t,e={}){let r=Z(),n=performance.now();y.trace("endPoints: batch",{cid:r,count:t.length});let o=t.map(a=>Vt(a,e)),i=(await Promise.allSettled(o)).map(a=>a.status==="fulfilled"?a.value:{status:"error",reason:E(a.reason)}),c=i.filter(a=>a.status==="success").length;return y.trace("endPoints: done",{cid:r,durationMs:performance.now()-n,ok:c,failed:i.length-c}),i}export{Ut as a,zt as b,Ht as c,$t as d,ge as e,Bt as f,G as g,Vt as h,Un as i,P as j};
|
|
4
|
+
/*! Bundled license information:
|
|
5
|
+
|
|
6
|
+
ky/distribution/index.js:
|
|
7
|
+
(*! MIT License © Sindre Sorhus *)
|
|
8
|
+
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{h as t}from"./chunk-5CIUNKHO.js";t();var s;function R(){try{if(typeof process<"u"&&process.env&&process.env.RUNTIME){let e=process.env.RUNTIME.toLowerCase();if(["node","bun","deno","cloudflare","aws-lambda","gcp-cloudrun"].includes(e))return e}}catch{}try{if(typeof globalThis<"u"&&(globalThis.cloudflare||globalThis.caches||globalThis.WebSocketPair||globalThis.__CFW__)||typeof process<"u"&&process.env&&process.env.PLATFORM==="cloudflare")return"cloudflare"}catch{}try{if(typeof process<"u"&&process.env&&process.env.AWS_LAMBDA_FUNCTION_NAME)return"aws-lambda"}catch{}try{if(typeof process<"u"&&process.env&&(process.env.K_SERVICE||process.env.K_REVISION||process.env.GOOGLE_CLOUD_PROJECT))return"gcp-cloudrun"}catch{}return typeof Bun<"u"?"bun":typeof Deno<"u"&&Deno.version&&Deno.version.deno?"deno":"node"}function u(){return s!==void 0||(s=R()),s}t();t();var i;(typeof __EDGE_RUNTIME__>"u"||!__EDGE_RUNTIME__)&&(i=(await import("module")).createRequire);var o,g=()=>{if(!o){let e=u();if(i&&typeof import.meta<"u"&&import.meta.url)try{o=i(import.meta.url)}catch{}!o&&typeof globalThis.require=="function"&&(o=globalThis.require),o||(o=n=>{throw new Error(`require("${n}") is not available in this runtime (${e}).`)})}return o};function p(e){let n={},r=["KEY","SECRET","PASSWORD","TOKEN","AUTH","CREDENTIAL","APIKEY","PRIVATE","CERT","KEYSTORE"];for(let[c,a]of Object.entries(e)){if(a===void 0)continue;let f=c.toUpperCase(),m=r.some(y=>f.includes(y));n[c]=m?"[REDACTED]":a}return n}function E(e){let n=g()("node:os"),r=typeof process.memoryUsage=="function"?process.memoryUsage():{};return{runtime:e,os:process.platform,arch:process.arch,pid:process.pid,ppid:process.ppid??null,cwd:process.cwd(),uptime:process.uptime(),osVersion:n.release?.()??null,loadAvg:n.loadavg?.()??[0,0,0],memory:{rss:r.rss??null,heapTotal:r.heapTotal??null,heapUsed:r.heapUsed??null,external:r.external??null},env:p({...process.env})}}function _(){let e=typeof Deno<"u"?Deno:null,n=e&&typeof e.systemMemoryInfo=="function"?e.systemMemoryInfo():{};return{runtime:"deno",os:e?.build?.os??"unknown",arch:e?.build?.arch??"unknown",pid:e?.pid??null,ppid:e?.ppid??null,cwd:e?.cwd?.()??"",uptime:typeof performance<"u"?performance.now()/1e3:0,osVersion:e?.osRelease?.()??null,loadAvg:e?.loadavg?.()??[0,0,0],memory:{rss:n.total??null,heapTotal:null,heapUsed:null,external:null},env:p(e?.env?.toObject()??{})}}function h(){return{runtime:"unknown",os:"unknown",arch:"unknown",pid:null,ppid:null,cwd:"",uptime:0,osVersion:null,loadAvg:[0,0,0],memory:{rss:null,heapTotal:null,heapUsed:null,external:null},env:{}}}function
|
|
2
|
+
import{h as t}from"./chunk-5CIUNKHO.js";t();var s;function R(){try{if(typeof process<"u"&&process.env&&process.env.RUNTIME){let e=process.env.RUNTIME.toLowerCase();if(["node","bun","deno","cloudflare","aws-lambda","gcp-cloudrun"].includes(e))return e}}catch{}try{if(typeof globalThis<"u"&&(globalThis.cloudflare||globalThis.caches||globalThis.WebSocketPair||globalThis.__CFW__)||typeof process<"u"&&process.env&&process.env.PLATFORM==="cloudflare")return"cloudflare"}catch{}try{if(typeof process<"u"&&process.env&&process.env.AWS_LAMBDA_FUNCTION_NAME)return"aws-lambda"}catch{}try{if(typeof process<"u"&&process.env&&(process.env.K_SERVICE||process.env.K_REVISION||process.env.GOOGLE_CLOUD_PROJECT))return"gcp-cloudrun"}catch{}return typeof Bun<"u"?"bun":typeof Deno<"u"&&Deno.version&&Deno.version.deno?"deno":"node"}function u(){return s!==void 0||(s=R()),s}t();t();var i;(typeof __EDGE_RUNTIME__>"u"||!__EDGE_RUNTIME__)&&(i=(await import("module")).createRequire);var o,g=()=>{if(!o){let e=u();if(i&&typeof import.meta<"u"&&import.meta.url)try{o=i(import.meta.url)}catch{}!o&&typeof globalThis.require=="function"&&(o=globalThis.require),o||(o=n=>{throw new Error(`require("${n}") is not available in this runtime (${e}).`)})}return o};function p(e){let n={},r=["KEY","SECRET","PASSWORD","TOKEN","AUTH","CREDENTIAL","APIKEY","PRIVATE","CERT","KEYSTORE"];for(let[c,a]of Object.entries(e)){if(a===void 0)continue;let f=c.toUpperCase(),m=r.some(y=>f.includes(y));n[c]=m?"[REDACTED]":a}return n}function E(e){let n=g()("node:os"),r=typeof process.memoryUsage=="function"?process.memoryUsage():{};return{runtime:e,os:process.platform,arch:process.arch,pid:process.pid,ppid:process.ppid??null,cwd:process.cwd(),uptime:process.uptime(),osVersion:n.release?.()??null,loadAvg:n.loadavg?.()??[0,0,0],memory:{rss:r.rss??null,heapTotal:r.heapTotal??null,heapUsed:r.heapUsed??null,external:r.external??null},env:p({...process.env})}}function _(){let e=typeof Deno<"u"?Deno:null,n=e&&typeof e.systemMemoryInfo=="function"?e.systemMemoryInfo():{};return{runtime:"deno",os:e?.build?.os??"unknown",arch:e?.build?.arch??"unknown",pid:e?.pid??null,ppid:e?.ppid??null,cwd:e?.cwd?.()??"",uptime:typeof performance<"u"?performance.now()/1e3:0,osVersion:e?.osRelease?.()??null,loadAvg:e?.loadavg?.()??[0,0,0],memory:{rss:n.total??null,heapTotal:null,heapUsed:null,external:null},env:p(e?.env?.toObject()??{})}}function h(){return{runtime:"unknown",os:"unknown",arch:"unknown",pid:null,ppid:null,cwd:"",uptime:0,osVersion:null,loadAvg:[0,0,0],memory:{rss:null,heapTotal:null,heapUsed:null,external:null},env:{}}}function U(){let e=u();switch(e){case"node":case"bun":return E(e);case"deno":return _();default:return h()}}export{u as a,U as b};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as U}from"./chunk-EV26JQYW.js";import{b as wt}from"./chunk-JBN5SOGD.js";import{a as B,c as v,g as x,h as w}from"./chunk-5CIUNKHO.js";var Ae=v((cl,Et)=>{"use strict";w();var te=e=>e&&typeof e.message=="string",ve=e=>{if(!e)return;let t=e.cause;if(typeof t=="function"){let n=e.cause();return te(n)?n:void 0}else return te(t)?t:void 0},St=(e,t)=>{if(!te(e))return"";let n=e.stack||"";if(t.has(e))return n+`
|
|
3
|
+
causes have become circular...`;let r=ve(e);return r?(t.add(e),n+`
|
|
4
|
+
caused by: `+St(r,t)):n},Ar=e=>St(e,new Set),_t=(e,t,n)=>{if(!te(e))return"";let r=n?"":e.message||"";if(t.has(e))return r+": ...";let i=ve(e);if(i){t.add(e);let s=typeof e.cause=="function";return r+(s?"":": ")+_t(i,t,s)}else return r},Lr=e=>_t(e,new Set);Et.exports={isErrorLike:te,getErrorCause:ve,stackWithCauses:Ar,messageWithCauses:Lr}});var Le=v((hl,xt)=>{"use strict";w();var Tr=Symbol("circular-ref-tag"),se=Symbol("pino-raw-err-ref"),Ot=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[se]},set:function(e){this[se]=e}}});Object.defineProperty(Ot,se,{writable:!0,value:{}});xt.exports={pinoErrProto:Ot,pinoErrorSymbols:{seen:Tr,rawSymbol:se}}});var Lt=v((yl,At)=>{"use strict";w();At.exports=ke;var{messageWithCauses:kr,stackWithCauses:Ir,isErrorLike:vt}=Ae(),{pinoErrProto:Cr,pinoErrorSymbols:Br}=Le(),{seen:Te}=Br,{toString:jr}=Object.prototype;function ke(e){if(!vt(e))return e;e[Te]=void 0;let t=Object.create(Cr);t.type=jr.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=kr(e),t.stack=Ir(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(n=>ke(n)));for(let n in e)if(t[n]===void 0){let r=e[n];vt(r)?n!=="cause"&&!Object.prototype.hasOwnProperty.call(r,Te)&&(t[n]=ke(r)):t[n]=r}return delete e[Te],t.raw=e,t}});var kt=v((ml,Tt)=>{"use strict";w();Tt.exports=fe;var{isErrorLike:Ie}=Ae(),{pinoErrProto:Pr,pinoErrorSymbols:$r}=Le(),{seen:oe}=$r,{toString:Nr}=Object.prototype;function fe(e){if(!Ie(e))return e;e[oe]=void 0;let t=Object.create(Pr);t.type=Nr.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(n=>fe(n))),Ie(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,oe)&&(t.cause=fe(e.cause));for(let n in e)if(t[n]===void 0){let r=e[n];Ie(r)?Object.prototype.hasOwnProperty.call(r,oe)||(t[n]=fe(r)):t[n]=r}return delete e[oe],t.raw=e,t}});var jt=v((bl,Bt)=>{"use strict";w();Bt.exports={mapHttpRequest:Dr,reqSerializer:Ct};var Ce=Symbol("pino-raw-req-ref"),It=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[Ce]},set:function(e){this[Ce]=e}}});Object.defineProperty(It,Ce,{writable:!0,value:{}});function Ct(e){let t=e.info||e.socket,n=Object.create(It);if(n.id=typeof e.id=="function"?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let r=e.path;n.url=typeof r=="string"?r:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function Dr(e){return{req:Ct(e)}}});var Dt=v((Sl,Nt)=>{"use strict";w();Nt.exports={mapHttpResponse:Rr,resSerializer:$t};var Be=Symbol("pino-raw-res-ref"),Pt=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[Be]},set:function(e){this[Be]=e}}});Object.defineProperty(Pt,Be,{writable:!0,value:{}});function $t(e){let t=Object.create(Pt);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function Rr(e){return{res:$t(e)}}});var Pe=v((El,Rt)=>{"use strict";w();var je=Lt(),qr=kt(),le=jt(),ue=Dt();Rt.exports={err:je,errWithCause:qr,mapHttpRequest:le.mapHttpRequest,mapHttpResponse:ue.mapHttpResponse,req:le.reqSerializer,res:ue.resSerializer,wrapErrorSerializer:function(t){return t===je?t:function(r){return t(je(r))}},wrapRequestSerializer:function(t){return t===le.reqSerializer?t:function(r){return t(le.reqSerializer(r))}},wrapResponseSerializer:function(t){return t===ue.resSerializer?t:function(r){return t(ue.resSerializer(r))}}}});var $e=v((xl,qt)=>{"use strict";w();function Wr(e,t){return t}qt.exports=function(){let t=Error.prepareStackTrace;Error.prepareStackTrace=Wr;let n=new Error().stack;if(Error.prepareStackTrace=t,!Array.isArray(n))return;let r=n.slice(2),i=[];for(let s of r)s&&i.push(s.getFileName());return i}});var Kt=v((Al,Vt)=>{"use strict";w();function Ne(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let n=0;n<e.length;n++)t[n]=Ne(e[n]);return t}if(typeof e=="object"){let t=Object.create(Object.getPrototypeOf(e));for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=Ne(e[n]));return t}return e}function Wt(e){let t=[],n="",r=!1,i=!1,s="";for(let u=0;u<e.length;u++){let l=e[u];!r&&l==="."?n&&(t.push(n),n=""):l==="["?(n&&(t.push(n),n=""),r=!0):l==="]"&&r?(t.push(n),n="",r=!1,i=!1):(l==='"'||l==="'")&&r?i?l===s?(i=!1,s=""):n+=l:(i=!0,s=l):n+=l}return n&&t.push(n),t}function Ft(e,t,n){let r=e;for(let s=0;s<t.length-1;s++){let u=t[s];if(typeof r!="object"||r===null||!(u in r)||typeof r[u]!="object"||r[u]===null)return!1;r=r[u]}let i=t[t.length-1];if(i==="*"){if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=n;else if(typeof r=="object"&&r!==null)for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=n)}else typeof r=="object"&&r!==null&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function Mt(e,t){let n=e;for(let i=0;i<t.length-1;i++){let s=t[i];if(typeof n!="object"||n===null||!(s in n)||typeof n[s]!="object"||n[s]===null)return!1;n=n[s]}let r=t[t.length-1];if(r==="*"){if(Array.isArray(n))for(let i=0;i<n.length;i++)n[i]=void 0;else if(typeof n=="object"&&n!==null)for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&delete n[i]}else typeof n=="object"&&n!==null&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}var ce=Symbol("PATH_NOT_FOUND");function Fr(e,t){let n=e;for(let r of t){if(n==null||typeof n!="object"||n===null||!(r in n))return ce;n=n[r]}return n}function Mr(e,t){let n=e;for(let r of t){if(n==null||typeof n!="object"||n===null)return;n=n[r]}return n}function zr(e,t,n,r=!1){for(let i of t){let s=Wt(i);if(s.includes("*"))zt(e,s,n,i,r);else if(r)Mt(e,s);else{let u=Fr(e,s);if(u===ce)continue;let l=typeof n=="function"?n(u,s):n;Ft(e,s,l)}}}function zt(e,t,n,r,i=!1){let s=t.indexOf("*");if(s===t.length-1){let u=t.slice(0,-1),l=e;for(let f of u){if(l==null||typeof l!="object"||l===null)return;l=l[f]}if(Array.isArray(l))if(i)for(let f=0;f<l.length;f++)l[f]=void 0;else for(let f=0;f<l.length;f++){let h=[...u,f.toString()],d=typeof n=="function"?n(l[f],h):n;l[f]=d}else if(typeof l=="object"&&l!==null)if(i){let f=[];for(let h in l)Object.prototype.hasOwnProperty.call(l,h)&&f.push(h);for(let h of f)delete l[h]}else for(let f in l){let h=[...u,f],d=typeof n=="function"?n(l[f],h):n;l[f]=d}}else Vr(e,t,n,s,r,i)}function Vr(e,t,n,r,i,s=!1){let u=t.slice(0,r),l=t.slice(r+1),f=[];function h(d,c){if(c===u.length){if(Array.isArray(d))for(let m=0;m<d.length;m++)f[c]=m.toString(),h(d[m],c+1);else if(typeof d=="object"&&d!==null)for(let m in d)f[c]=m,h(d[m],c+1)}else if(c<u.length){let m=u[c];d&&typeof d=="object"&&d!==null&&m in d&&(f[c]=m,h(d[m],c+1))}else if(l.includes("*"))zt(d,l,typeof n=="function"?(y,o)=>{let g=[...f.slice(0,c),...o];return n(y,g)}:n,i,s);else if(s)Mt(d,l);else{let m=typeof n=="function"?n(Mr(d,l),[...f.slice(0,c),...l]):n;Ft(d,l,m)}}if(u.length===0)h(e,0);else{let d=e;for(let c=0;c<u.length;c++){let m=u[c];if(d==null||typeof d!="object"||d===null)return;d=d[m],f[c]=m}d!=null&&h(d,u.length)}}function Kr(e){if(e.length===0)return null;let t=new Map;for(let n of e){let r=Wt(n),i=t;for(let s=0;s<r.length;s++){let u=r[s];i.has(u)||i.set(u,new Map),i=i.get(u)}}return t}function Jr(e,t){if(!t)return e;function n(r,i,s=0){if(!i||i.size===0||r===null||typeof r!="object")return r;if(r instanceof Date)return new Date(r.getTime());if(Array.isArray(r)){let l=[];for(let f=0;f<r.length;f++){let h=f.toString();i.has(h)||i.has("*")?l[f]=n(r[f],i.get(h)||i.get("*")):l[f]=r[f]}return l}let u=Object.create(Object.getPrototypeOf(r));for(let l in r)Object.prototype.hasOwnProperty.call(r,l)&&(i.has(l)||i.has("*")?u[l]=n(r[l],i.get(l)||i.get("*")):u[l]=r[l]);return u}return n(e,t)}function Ur(e){if(typeof e!="string")throw new Error("Paths must be (non-empty) strings");if(e==="")throw new Error("Invalid redaction path ()");if(e.includes(".."))throw new Error(`Invalid redaction path (${e})`);if(e.includes(","))throw new Error(`Invalid redaction path (${e})`);let t=0,n=!1,r="";for(let i=0;i<e.length;i++){let s=e[i];if((s==='"'||s==="'")&&t>0)n?s===r&&(n=!1,r=""):(n=!0,r=s);else if(s==="["&&!n)t++;else if(s==="]"&&!n&&(t--,t<0))throw new Error(`Invalid redaction path (${e})`)}if(t!==0)throw new Error(`Invalid redaction path (${e})`)}function Gr(e){if(!Array.isArray(e))throw new TypeError("paths must be an array");for(let t of e)Ur(t)}function Hr(e={}){let{paths:t=[],censor:n="[REDACTED]",serialize:r=JSON.stringify,strict:i=!0,remove:s=!1}=e;Gr(t);let u=Kr(t);return function(f){if(i&&(f===null||typeof f!="object")&&(f==null||typeof f!="object"))return r?r(f):f;let h=Jr(f,u),d=f,c=n;return typeof n=="function"&&(c=n),zr(h,t,c,s),r===!1?(h.restore=function(){return Ne(d)},h):typeof r=="function"?r(h):JSON.stringify(h)}}Vt.exports=Hr});var Q=v((Tl,Jt)=>{"use strict";w();var Xr=Symbol("pino.setLevel"),Yr=Symbol("pino.getLevel"),Qr=Symbol("pino.levelVal"),Zr=Symbol("pino.levelComp"),ei=Symbol("pino.useLevelLabels"),ti=Symbol("pino.useOnlyCustomLevels"),ni=Symbol("pino.mixin"),ri=Symbol("pino.lsCache"),ii=Symbol("pino.chindings"),si=Symbol("pino.asJson"),oi=Symbol("pino.write"),fi=Symbol("pino.redactFmt"),li=Symbol("pino.time"),ui=Symbol("pino.timeSliceIndex"),ci=Symbol("pino.stream"),ai=Symbol("pino.stringify"),hi=Symbol("pino.stringifySafe"),di=Symbol("pino.stringifiers"),yi=Symbol("pino.end"),gi=Symbol("pino.formatOpts"),mi=Symbol("pino.messageKey"),pi=Symbol("pino.errorKey"),bi=Symbol("pino.nestedKey"),wi=Symbol("pino.nestedKeyStr"),Si=Symbol("pino.mixinMergeStrategy"),_i=Symbol("pino.msgPrefix"),Ei=Symbol("pino.wildcardFirst"),Oi=Symbol.for("pino.serializers"),xi=Symbol.for("pino.formatters"),vi=Symbol.for("pino.hooks"),Ai=Symbol.for("pino.metadata");Jt.exports={setLevelSym:Xr,getLevelSym:Yr,levelValSym:Qr,levelCompSym:Zr,useLevelLabelsSym:ei,mixinSym:ni,lsCacheSym:ri,chindingsSym:ii,asJsonSym:si,writeSym:oi,serializersSym:Oi,redactFmtSym:fi,timeSym:li,timeSliceIndexSym:ui,streamSym:ci,stringifySym:ai,stringifySafeSym:hi,stringifiersSym:di,endSym:yi,formatOptsSym:gi,messageKeySym:mi,errorKeySym:pi,nestedKeySym:bi,wildcardFirstSym:Ei,needsMetadataGsym:Ai,useOnlyCustomLevelsSym:ti,formattersSym:xi,hooksSym:vi,nestedKeyStrSym:wi,mixinMergeStrategySym:Si,msgPrefixSym:_i}});var Re=v((Il,Xt)=>{"use strict";w();var Ut=Kt(),{redactFmtSym:Li,wildcardFirstSym:ae}=Q(),De=/[^.[\]]+|\[([^[\]]*?)\]/g,Gt="[Redacted]",Ht=!1;function Ti(e,t){let{paths:n,censor:r,remove:i}=ki(e),s=n.reduce((f,h)=>{De.lastIndex=0;let d=De.exec(h),c=De.exec(h),m=d[1]!==void 0?d[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):d[0];if(m==="*"&&(m=ae),c===null)return f[m]=null,f;if(f[m]===null)return f;let{index:y}=c,o=`${h.substr(y,h.length-1)}`;return f[m]=f[m]||[],m!==ae&&f[m].length===0&&f[m].push(...f[ae]||[]),m===ae&&Object.keys(f).forEach(function(g){f[g]&&f[g].push(o)}),f[m].push(o),f},{}),u={[Li]:Ut({paths:n,censor:r,serialize:t,strict:Ht,remove:i})},l=(...f)=>t(typeof r=="function"?r(...f):r);return[...Object.keys(s),...Object.getOwnPropertySymbols(s)].reduce((f,h)=>{if(s[h]===null)f[h]=d=>l(d,[h]);else{let d=typeof r=="function"?(c,m)=>r(c,[h,...m]):r;f[h]=Ut({paths:s[h],censor:d,serialize:t,strict:Ht,remove:i})}return f},u)}function ki(e){if(Array.isArray(e))return e={paths:e,censor:Gt},e;let{paths:t,censor:n=Gt,remove:r}=e;if(Array.isArray(t)===!1)throw Error("pino \u2013 redact must contain an array of strings");return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}Xt.exports=Ti});var Zt=v((Bl,Qt)=>{"use strict";w();var Ii=()=>"",Ci=()=>`,"time":${Date.now()}`,Bi=()=>`,"time":${Math.round(Date.now()/1e3)}`,ji=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,Pi=1000000n,Yt=1000000000n,$i=BigInt(Date.now())*Pi,Ni=process.hrtime.bigint(),Di=()=>{let e=process.hrtime.bigint()-Ni,t=$i+e,n=t/Yt,r=t%Yt,i=Number(n*1000n+r/1000000n),s=new Date(i),u=s.getUTCFullYear(),l=(s.getUTCMonth()+1).toString().padStart(2,"0"),f=s.getUTCDate().toString().padStart(2,"0"),h=s.getUTCHours().toString().padStart(2,"0"),d=s.getUTCMinutes().toString().padStart(2,"0"),c=s.getUTCSeconds().toString().padStart(2,"0");return`,"time":"${u}-${l}-${f}T${h}:${d}:${c}.${r.toString().padStart(9,"0")}Z"`};Qt.exports={nullTime:Ii,epochTime:Ci,unixTime:Bi,isoTime:ji,isoTimeNano:Di}});var tn=v((Pl,en)=>{"use strict";w();function Ri(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}en.exports=qi;function qi(e,t,n){var r=n&&n.stringify||Ri,i=1;if(typeof e=="object"&&e!==null){var s=t.length+i;if(s===1)return e;var u=new Array(s);u[0]=r(e);for(var l=1;l<s;l++)u[l]=r(t[l]);return u.join(" ")}if(typeof e!="string")return e;var f=t.length;if(f===0)return e;for(var h="",d=1-i,c=-1,m=e&&e.length||0,y=0;y<m;){if(e.charCodeAt(y)===37&&y+1<m){switch(c=c>-1?c:0,e.charCodeAt(y+1)){case 100:case 102:if(d>=f||t[d]==null)break;c<y&&(h+=e.slice(c,y)),h+=Number(t[d]),c=y+2,y++;break;case 105:if(d>=f||t[d]==null)break;c<y&&(h+=e.slice(c,y)),h+=Math.floor(Number(t[d])),c=y+2,y++;break;case 79:case 111:case 106:if(d>=f||t[d]===void 0)break;c<y&&(h+=e.slice(c,y));var o=typeof t[d];if(o==="string"){h+="'"+t[d]+"'",c=y+2,y++;break}if(o==="function"){h+=t[d].name||"<anonymous>",c=y+2,y++;break}h+=r(t[d]),c=y+2,y++;break;case 115:if(d>=f)break;c<y&&(h+=e.slice(c,y)),h+=String(t[d]),c=y+2,y++;break;case 37:c<y&&(h+=e.slice(c,y)),h+="%",c=y+2,y++,d--;break}++d}++y}return c===-1?e:(c<m&&(h+=e.slice(c)),h)}});var We=v((Nl,qe)=>{"use strict";w();if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let t=function(n){if((n>0&&n<1/0)===!1)throw typeof n!="number"&&typeof n!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(e,0,0,Number(n))},e=new Int32Array(new SharedArrayBuffer(4));qe.exports=t}else{let e=function(t){if((t>0&&t<1/0)===!1)throw typeof t!="number"&&typeof t!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let r=Date.now()+Number(t);for(;r>Date.now(););};qe.exports=e}});var cn=v((Rl,un)=>{"use strict";w();var k=B("fs"),Wi=B("events"),Fi=B("util").inherits,nn=B("path"),Me=We(),Mi=B("assert"),he=100,de=Buffer.allocUnsafe(0),zi=16*1024,rn="buffer",sn="utf8",[Vi,Ki]=(process.versions.node||"0.0").split(".").map(Number),Ji=Vi>=22&&Ki>=7;function on(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function n(s,u){if(s){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount("error")>0&&t.emit("error",s)}):t.emit("error",s);return}let l=t._reopening;t.fd=u,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit("ready")):t.emit("ready"),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():l&&process.nextTick(()=>t.emit("drain")))}let r=t.append?"a":"w",i=t.mode;if(t.sync)try{t.mkdir&&k.mkdirSync(nn.dirname(e),{recursive:!0});let s=k.openSync(e,r,i);n(null,s)}catch(s){throw n(s),s}else t.mkdir?k.mkdir(nn.dirname(e),{recursive:!0},s=>{if(s)return n(s);k.open(e,r,i,n)}):k.open(e,r,i,n)}function F(e){if(!(this instanceof F))return new F(e);let{fd:t,dest:n,minLength:r,maxLength:i,maxWrite:s,periodicFlush:u,sync:l,append:f=!0,mkdir:h,retryEAGAIN:d,fsync:c,contentMode:m,mode:y}=e||{};t=t||n,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(r||0,16387),this.file=null,this.destroyed=!1,this.minLength=r||0,this.maxLength=i||0,this.maxWrite=s||zi,this._periodicFlush=u||0,this._periodicFlushTimer=void 0,this.sync=l||!1,this.writable=!0,this._fsync=c||!1,this.append=f||!1,this.mode=y,this.retryEAGAIN=d||(()=>!0),this.mkdir=h||!1;let o,g;if(m===rn)this._writingBuf=de,this.write=Hi,this.flush=Yi,this.flushSync=Zi,this._actualWrite=ts,o=()=>k.writeSync(this.fd,this._writingBuf),g=()=>k.write(this.fd,this._writingBuf,this.release);else if(m===void 0||m===sn)this._writingBuf="",this.write=Gi,this.flush=Xi,this.flushSync=Qi,this._actualWrite=es,o=()=>Buffer.isBuffer(this._writingBuf)?k.writeSync(this.fd,this._writingBuf):k.writeSync(this.fd,this._writingBuf,"utf8"),g=()=>Buffer.isBuffer(this._writingBuf)?k.write(this.fd,this._writingBuf,this.release):k.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${sn}" and "${rn}", but passed ${m}`);if(typeof t=="number")this.fd=t,process.nextTick(()=>this.emit("ready"));else if(typeof t=="string")on(t,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(p,S)=>{if(p){if((p.code==="EAGAIN"||p.code==="EBUSY")&&this.retryEAGAIN(p,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{Me(he),this.release(void 0,0)}catch(E){this.release(E)}else setTimeout(g,he);else this._writing=!1,this.emit("error",p);return}this.emit("write",S);let _=Fe(this._writingBuf,this._len,S);if(this._len=_.len,this._writingBuf=_.writingBuf,this._writingBuf.length){if(!this.sync){g();return}try{do{let E=o(),T=Fe(this._writingBuf,this._len,E);this._len=T.len,this._writingBuf=T.writingBuf}while(this._writingBuf.length)}catch(E){this.release(E);return}}this._fsync&&k.fsyncSync(this.fd);let b=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):b>this.minLength?this._actualWrite():this._ending?b>0?this._actualWrite():(this._writing=!1,ye(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(Ui,this)):this.emit("drain"))},this.on("newListener",function(p){p==="drain"&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function Fe(e,t,n){return typeof e=="string"&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function Ui(e){e.listenerCount("drain")>0&&(e._asyncDrainScheduled=!1,e.emit("drain"))}Fi(F,Wi);function fn(e,t){return e.length===0?de:e.length===1?e[0]:Buffer.concat(e,t)}function Gi(e){if(this.destroyed)throw new Error("SonicBoom destroyed");e=""+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function Hi(e){if(this.destroyed)throw new Error("SonicBoom destroyed");let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function ln(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{k.fsync(this.fd,r=>{this._flushPending=!1,e(r)})}catch(r){e(r)}this.off("error",n)},n=r=>{this._flushPending=!1,e(r),this.off("drain",t)};this.once("drain",t),this.once("error",n)}function Xi(e){if(e!=null&&typeof e!="function")throw new Error("flush cb must be a function");if(this.destroyed){let t=new Error("SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&ln.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function Yi(e){if(e!=null&&typeof e!="function")throw new Error("flush cb must be a function");if(this.destroyed){let t=new Error("SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&ln.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}F.prototype.reopen=function(e){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once("ready",()=>{t!==this.fd&&k.close(t,n=>{if(n)return this.emit("error",n)})}),on(this.file,this)};F.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():ye(this)))};function Qi(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");let e="";for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?k.writeSync(this.fd,e):k.writeSync(this.fd,e,"utf8"),n=Fe(e,this._len,t);e=n.writingBuf,this._len=n.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;Me(he)}}try{k.fsyncSync(this.fd)}catch{}}function Zi(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=de);let e=de;for(;this._bufs.length||e.length;){e.length<=0&&(e=fn(this._bufs[0],this._lens[0]));try{let t=k.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;Me(he)}}}F.prototype.destroy=function(){this.destroyed||ye(this)};function es(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||"",this.sync)try{let t=Buffer.isBuffer(this._writingBuf)?k.writeSync(this.fd,this._writingBuf):k.writeSync(this.fd,this._writingBuf,"utf8");e(null,t)}catch(t){e(t)}else k.write(this.fd,this._writingBuf,e)}function ts(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:fn(this._bufs.shift(),this._lens.shift()),this.sync)try{let t=k.writeSync(this.fd,this._writingBuf);e(null,t)}catch(t){e(t)}else Ji&&(this._writingBuf=Buffer.from(this._writingBuf)),k.write(this.fd,this._writingBuf,e)}function ye(e){if(e.fd===-1){e.once("ready",ye.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],Mi(typeof e.fd=="number",`sonic.fd must be a number, got ${typeof e.fd}`);try{k.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?k.close(e.fd,n):n()}function n(r){if(r){e.emit("error",r);return}e._ending&&!e._writing&&e.emit("finish"),e.emit("close")}}F.SonicBoom=F;F.default=F;un.exports=F});var ze=v((Wl,gn)=>{"use strict";w();var M={exit:[],beforeExit:[]},an={exit:is,beforeExit:ss},Z;function ns(){Z===void 0&&(Z=new FinalizationRegistry(os))}function rs(e){M[e].length>0||process.on(e,an[e])}function hn(e){M[e].length>0||(process.removeListener(e,an[e]),M.exit.length===0&&M.beforeExit.length===0&&(Z=void 0))}function is(){dn("exit")}function ss(){dn("beforeExit")}function dn(e){for(let t of M[e]){let n=t.deref(),r=t.fn;n!==void 0&&r(n,e)}M[e]=[]}function os(e){for(let t of["exit","beforeExit"]){let n=M[t].indexOf(e);M[t].splice(n,n+1),hn(t)}}function yn(e,t,n){if(t===void 0)throw new Error("the object can't be undefined");rs(e);let r=new WeakRef(t);r.fn=n,ns(),Z.register(t,r),M[e].push(r)}function fs(e,t){yn("exit",e,t)}function ls(e,t){yn("beforeExit",e,t)}function us(e){if(Z!==void 0){Z.unregister(e);for(let t of["exit","beforeExit"])M[t]=M[t].filter(n=>{let r=n.deref();return r&&r!==e}),hn(t)}}gn.exports={register:fs,registerBeforeExit:ls,unregister:us}});var mn=v((Ml,cs)=>{cs.exports={name:"thread-stream",version:"4.0.0",description:"A streaming way to send data to a Node.js Worker Thread",main:"index.js",types:"index.d.ts",engines:{node:">=20"},dependencies:{"real-require":"^0.2.0"},devDependencies:{"@types/node":"^22.0.0","@yao-pkg/pkg":"^6.0.0",borp:"^0.21.0",desm:"^1.3.0",eslint:"^9.39.1",fastbench:"^1.0.1",husky:"^9.0.6",neostandard:"^0.12.2","pino-elasticsearch":"^8.0.0","sonic-boom":"^4.0.1","ts-node":"^10.8.0",typescript:"~5.7.3"},scripts:{build:"tsc --noEmit",lint:"eslint",test:"npm run lint && npm run build && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'","test:ci":"npm run lint && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'","test:yarn":"npm run transpile && borp --pattern 'test/*.test.js'",transpile:"sh ./test/ts/transpile.sh",prepare:"husky install"},repository:{type:"git",url:"git+https://github.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matteocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com/mcollina/thread-stream#readme"}});var bn=v((zl,pn)=>{"use strict";w();function as(e,t,n,r,i){let s=r===1/0?1/0:Date.now()+r,u=()=>{let l=Atomics.load(e,t);if(l===n){i(null,"ok");return}if(s!==1/0&&Date.now()>s){i(null,"timed-out");return}let f=s===1/0?1e4:Math.min(1e4,Math.max(1,s-Date.now())),h=Atomics.waitAsync(e,t,l,f);h.async?h.value.then(u):setImmediate(u)};u()}function hs(e,t,n,r,i){let s=r===1/0?1/0:Date.now()+r,u=()=>{if(Atomics.load(e,t)!==n){i(null,"ok");return}if(s!==1/0&&Date.now()>s){i(null,"timed-out");return}let f=s===1/0?1e4:Math.min(1e4,Math.max(1,s-Date.now())),h=Atomics.waitAsync(e,t,n,f);h.async?h.value.then(u):setImmediate(u)};u()}pn.exports={wait:as,waitDiff:hs}});var Sn=v((Kl,wn)=>{"use strict";w();wn.exports={WRITE_INDEX:4,READ_INDEX:8}});var vn=v((Ul,xn)=>{"use strict";w();var{version:ds}=mn(),{EventEmitter:ys}=B("events"),{Worker:gs}=B("worker_threads"),{join:ms}=B("path"),{pathToFileURL:ps}=B("url"),{wait:bs}=bn(),{WRITE_INDEX:D,READ_INDEX:N}=Sn(),ws=B("buffer"),Ss=B("assert"),a=Symbol("kImpl"),_s=ws.constants.MAX_STRING_LENGTH,ne=class{constructor(t){this._value=t}deref(){return this._value}},me=class{register(){}unregister(){}},Es=process.env.NODE_V8_COVERAGE?me:global.FinalizationRegistry||me,Os=process.env.NODE_V8_COVERAGE?ne:global.WeakRef||ne,_n=new Es(e=>{e.exited||e.terminate()});function xs(e,t){let{filename:n,workerData:r}=t,s=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||ms(x,"lib","worker.js"),u=new gs(s,{...t.workerOpts,trackUnmanagedFds:!1,workerData:{filename:n.indexOf("file://")===0?n:ps(n).href,dataBuf:e[a].dataBuf,stateBuf:e[a].stateBuf,workerData:{$context:{threadStreamVersion:ds},...r}}});return u.stream=new ne(e),u.on("message",vs),u.on("exit",On),_n.register(e,u),u}function En(e){Ss(!e[a].sync),e[a].needDrain&&(e[a].needDrain=!1,e.emit("drain"))}function ge(e){let t=Atomics.load(e[a].state,D),n=e[a].data.length-t;if(n>0){if(e[a].buf.length===0){e[a].flushing=!1,e[a].ending?Ge(e):e[a].needDrain&&process.nextTick(En,e);return}let r=e[a].buf.slice(0,n),i=Buffer.byteLength(r);i<=n?(e[a].buf=e[a].buf.slice(n),pe(e,r,ge.bind(null,e))):e.flush(()=>{if(!e.destroyed){for(Atomics.store(e[a].state,N,0),Atomics.store(e[a].state,D,0),Atomics.notify(e[a].state,N);i>e[a].data.length;)n=n/2,r=e[a].buf.slice(0,n),i=Buffer.byteLength(r);e[a].buf=e[a].buf.slice(n),pe(e,r,ge.bind(null,e))}})}else if(n===0){if(t===0&&e[a].buf.length===0)return;e.flush(()=>{Atomics.store(e[a].state,N,0),Atomics.store(e[a].state,D,0),Atomics.notify(e[a].state,N),ge(e)})}else z(e,new Error("overwritten"))}function vs(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}switch(e.code){case"READY":this.stream=new Os(t),t.flush(()=>{t[a].ready=!0,t.emit("ready")});break;case"ERROR":z(t,e.err);break;case"EVENT":Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case"WARNING":process.emitWarning(e.err);break;default:z(t,new Error("this should not happen: "+e.code))}}function On(e){let t=this.stream.deref();t!==void 0&&(_n.unregister(t),t.worker.exited=!0,t.worker.off("exit",On),z(t,e!==0?new Error("the worker thread exited"):null))}var Ke=class extends ys{constructor(t={}){if(super(),t.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[a]={},this[a].stateBuf=new SharedArrayBuffer(128),this[a].state=new Int32Array(this[a].stateBuf),this[a].dataBuf=new SharedArrayBuffer(t.bufferSize||4*1024*1024),this[a].data=Buffer.from(this[a].dataBuf),this[a].sync=t.sync||!1,this[a].ending=!1,this[a].ended=!1,this[a].needDrain=!1,this[a].destroyed=!1,this[a].flushing=!1,this[a].ready=!1,this[a].finished=!1,this[a].errored=null,this[a].closed=!1,this[a].buf="",this.worker=xs(this,t),this.on("message",(n,r)=>{this.worker.postMessage(n,r)})}write(t){if(this[a].destroyed)return Je(this,new Error("the worker has exited")),!1;if(this[a].ending)return Je(this,new Error("the worker is ending")),!1;if(this[a].flushing&&this[a].buf.length+t.length>=_s)try{Ve(this),this[a].flushing=!0}catch(n){return z(this,n),!1}if(this[a].buf+=t,this[a].sync)try{return Ve(this),!0}catch(n){return z(this,n),!1}return this[a].flushing||(this[a].flushing=!0,setImmediate(ge,this)),this[a].needDrain=this[a].data.length-this[a].buf.length-Atomics.load(this[a].state,D)<=0,!this[a].needDrain}end(){this[a].destroyed||(this[a].ending=!0,Ge(this))}flush(t){if(this[a].destroyed){typeof t=="function"&&process.nextTick(t,new Error("the worker has exited"));return}let n=Atomics.load(this[a].state,D);bs(this[a].state,N,n,1/0,(r,i)=>{if(r){z(this,r),process.nextTick(t,r);return}if(i==="not-equal"){this.flush(t);return}process.nextTick(t)})}flushSync(){this[a].destroyed||(Ve(this),Ue(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[a].ready}get destroyed(){return this[a].destroyed}get closed(){return this[a].closed}get writable(){return!this[a].destroyed&&!this[a].ending}get writableEnded(){return this[a].ending}get writableFinished(){return this[a].finished}get writableNeedDrain(){return this[a].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[a].errored}};function Je(e,t){setImmediate(()=>{e.emit("error",t)})}function z(e,t){e[a].destroyed||(e[a].destroyed=!0,t&&(e[a].errored=t,Je(e,t)),e.worker.exited?setImmediate(()=>{e[a].closed=!0,e.emit("close")}):e.worker.terminate().catch(()=>{}).then(()=>{e[a].closed=!0,e.emit("close")}))}function pe(e,t,n){let r=Atomics.load(e[a].state,D),i=Buffer.byteLength(t);return e[a].data.write(t,r),Atomics.store(e[a].state,D,r+i),Atomics.notify(e[a].state,D),n(),!0}function Ge(e){if(!(e[a].ended||!e[a].ending||e[a].flushing)){e[a].ended=!0;try{e.flushSync();let t=Atomics.load(e[a].state,N);Atomics.store(e[a].state,D,-1),Atomics.notify(e[a].state,D);let n=0;for(;t!==-1;){if(Atomics.wait(e[a].state,N,t,1e3),t=Atomics.load(e[a].state,N),t===-2){z(e,new Error("end() failed"));return}if(++n===10){z(e,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{e[a].finished=!0,e.emit("finish")})}catch(t){z(e,t)}}}function Ve(e){let t=()=>{e[a].ending?Ge(e):e[a].needDrain&&process.nextTick(En,e)};for(e[a].flushing=!1;e[a].buf.length!==0;){let n=Atomics.load(e[a].state,D),r=e[a].data.length-n;if(r===0){Ue(e),Atomics.store(e[a].state,N,0),Atomics.store(e[a].state,D,0),Atomics.notify(e[a].state,N);continue}else if(r<0)throw new Error("overwritten");let i=e[a].buf.slice(0,r),s=Buffer.byteLength(i);if(s<=r)e[a].buf=e[a].buf.slice(r),pe(e,i,t);else{for(Ue(e),Atomics.store(e[a].state,N,0),Atomics.store(e[a].state,D,0),Atomics.notify(e[a].state,N);s>e[a].buf.length;)r=r/2,i=e[a].buf.slice(0,r),s=Buffer.byteLength(i);e[a].buf=e[a].buf.slice(r),pe(e,i,t)}}}function Ue(e){if(e[a].flushing)throw new Error("unable to flush while flushing");let t=Atomics.load(e[a].state,D),n=0;for(;;){let r=Atomics.load(e[a].state,N);if(r===-2)throw Error("_flushSync failed");if(r!==t)Atomics.wait(e[a].state,N,r,1e3);else break;if(++n===10)throw new Error("_flushSync took too long (10s)")}}xn.exports=Ke});var Ye=v((Hl,Tn)=>{"use strict";w();var{createRequire:As}=B("module"),{existsSync:Ls}=B("fs"),Ts=$e(),{join:He,isAbsolute:Ln,sep:ks}=B("path"),{fileURLToPath:Is}=B("url"),Cs=We(),Xe=ze(),Bs=vn();function js(e){Xe.register(e,Rs),Xe.registerBeforeExit(e,qs),e.on("close",function(){Xe.unregister(e)})}function Ps(){let e=process.execArgv;for(let t=0;t<e.length;t++){let n=e[t];if(n==="--import"||n==="--require"||n==="-r"||n.startsWith("--import=")||n.startsWith("--require=")||n.startsWith("-r="))return!0}return!1}function $s(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let n=[],r=!1;for(let i=0;i<t.length;i++){let s=t[i];if(s==="--require"||s==="-r"||s==="--import"){let u=t[i+1];if(u&&An(u)){r=!0,i++;continue}n.push(s),u&&(n.push(u),i++);continue}if(s.startsWith("--require=")||s.startsWith("-r=")||s.startsWith("--import=")){let u=s.slice(s.indexOf("=")+1);if(An(u)){r=!0;continue}}n.push(s)}return r?n.join(" "):e}function An(e){let t=Ns(e);if(!t)return!1;let n=t;if(n.startsWith("file://"))try{n=Is(n)}catch{return!1}return Ln(n)&&!Ls(n)}function Ns(e){let t=e[0],n=e[e.length-1];return t==='"'&&n==='"'||t==="'"&&n==="'"?e.slice(1,-1):e}function Ds(e,t,n,r,i){if(!n.execArgv&&Ps()&&B.main===void 0&&(n={...n,execArgv:[]}),!n.env&&process.env.NODE_OPTIONS){let f=$s(process.env.NODE_OPTIONS);f!==process.env.NODE_OPTIONS&&(n={...n,env:{...process.env,NODE_OPTIONS:f}})}n={...n,name:i};let s=new Bs({filename:e,workerData:t,workerOpts:n,sync:r});s.on("ready",u),s.on("close",function(){process.removeListener("exit",l)}),process.on("exit",l);function u(){process.removeListener("exit",l),s.unref(),n.autoEnd!==!1&&js(s)}function l(){s.closed||(s.flushSync(),Cs(100),s.end())}return s}function Rs(e){e.ref(),e.flushSync(),e.end(),e.once("close",function(){e.unref()})}function qs(e){e.flushSync()}function Ws(e){let{pipeline:t,targets:n,levels:r,dedupe:i,worker:s={},caller:u=Ts(),sync:l=!1}=e,f={...e.options},h=typeof u=="string"?[u]:u,d=typeof globalThis=="object"&&Object.prototype.hasOwnProperty.call(globalThis,"__bundlerPathsOverrides")&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides=="object"?globalThis.__bundlerPathsOverrides:Object.create(null),c=e.target;if(c&&n)throw new Error("only one of target or targets can be specified");n?(c=d["pino-worker"]||He(x,"worker.js"),f.targets=n.filter(o=>o.target).map(o=>({...o,target:y(o.target)})),f.pipelines=n.filter(o=>o.pipeline).map(o=>o.pipeline.map(g=>({...g,level:o.level,target:y(g.target)})))):t&&(c=d["pino-worker"]||He(x,"worker.js"),f.pipelines=[t.map(o=>({...o,target:y(o.target)}))]),r&&(f.levels=r),i&&(f.dedupe=i),f.pinoWillSendConfig=!0;let m=n||t?"pino.transport":c;return Ds(y(c),f,s,l,m);function y(o){if(o=d[o]||o,Ln(o)||o.indexOf("file://")===0)return o;if(o==="pino/file")return He(x,"..","file.js");let g;for(let p of h)try{let S=p==="node:repl"?process.cwd()+ks:p;g=As(S).resolve(o);break}catch{continue}if(!g)throw new Error(`unable to determine transport target for "${o}"`);return g}}Tn.exports=Ws});var Se=v((Ql,Fn)=>{"use strict";w();var Fs=B("diagnostics_channel"),kn=tn(),{mapHttpRequest:Ms,mapHttpResponse:zs}=Pe(),Ze=cn(),In=ze(),{lsCacheSym:Vs,chindingsSym:$n,writeSym:Cn,serializersSym:Nn,formatOptsSym:Bn,endSym:Ks,stringifiersSym:Dn,stringifySym:Rn,stringifySafeSym:et,wildcardFirstSym:qn,nestedKeySym:Js,formattersSym:Wn,messageKeySym:Us,errorKeySym:Gs,nestedKeyStrSym:Hs,msgPrefixSym:be}=Q(),{isMainThread:Xs}=B("worker_threads"),Ys=Ye(),[Qs]=process.versions.node.split(".").map(e=>Number(e)),jn=Fs.tracingChannel("pino_asJson"),Qe=Qs>=25?e=>JSON.stringify(e):eo;function ee(){}function Zs(e,t){if(!t)return n;return function(...i){t.call(this,i,n,e)};function n(r,...i){if(typeof r=="object"){let s=r;r!==null&&(r.method&&r.headers&&r.socket?r=Ms(r):typeof r.setHeader=="function"&&(r=zs(r)));let u;s===null&&i.length===0?u=[null]:(s=i.shift(),u=i),typeof this[be]=="string"&&s!==void 0&&s!==null&&(s=this[be]+s),this[Cn](r,kn(s,u,this[Bn]),e)}else{let s=r===void 0?i.shift():r;typeof this[be]=="string"&&s!==void 0&&s!==null&&(s=this[be]+s),this[Cn](null,kn(s,i,this[Bn]),e)}}}function eo(e){let t="",n=0,r=!1,i=255,s=e.length;if(s>100)return JSON.stringify(e);for(var u=0;u<s&&i>=32;u++)i=e.charCodeAt(u),(i===34||i===92)&&(t+=e.slice(n,u)+"\\",n=u,r=!0);return r?t+=e.slice(n):t=e,i<32?JSON.stringify(e):'"'+t+'"'}function to(e,t,n,r){if(jn.hasSubscribers===!1)return Pn.call(this,e,t,n,r);let i={instance:this,arguments};return jn.traceSync(Pn,i,this,e,t,n,r)}function Pn(e,t,n,r){let i=this[Rn],s=this[et],u=this[Dn],l=this[Ks],f=this[$n],h=this[Nn],d=this[Wn],c=this[Us],m=this[Gs],y=this[Vs][n]+r;y=y+f;let o;d.log&&(e=d.log(e));let g=u[qn],p="";for(let _ in e)if(o=e[_],Object.prototype.hasOwnProperty.call(e,_)&&o!==void 0){h[_]?o=h[_](o):_===m&&h.err&&(o=h.err(o));let b=u[_]||g;switch(typeof o){case"undefined":case"function":continue;case"number":Number.isFinite(o)===!1&&(o=null);case"boolean":b&&(o=b(o));break;case"string":o=(b||Qe)(o);break;default:o=(b||i)(o,s)}if(o===void 0)continue;let E=Qe(_);p+=","+E+":"+o}let S="";if(t!==void 0){o=h[c]?h[c](t):t;let _=u[c]||g;switch(typeof o){case"function":break;case"number":Number.isFinite(o)===!1&&(o=null);case"boolean":_&&(o=_(o)),S=',"'+c+'":'+o;break;case"string":o=(_||Qe)(o),S=',"'+c+'":'+o;break;default:o=(_||i)(o,s),S=',"'+c+'":'+o}}return this[Js]&&p?y+this[Hs]+p.slice(1)+"}"+S+l:y+p+S+l}function no(e,t){let n,r=e[$n],i=e[Rn],s=e[et],u=e[Dn],l=u[qn],f=e[Nn],h=e[Wn].bindings;t=h(t);for(let d in t)if(n=t[d],((d.length<5||d!=="level"&&d!=="serializers"&&d!=="formatters"&&d!=="customLevels")&&t.hasOwnProperty(d)&&n!==void 0)===!0){if(n=f[d]?f[d](n):n,n=(u[d]||l||i)(n,s),n===void 0)continue;r+=',"'+d+'":'+n}return r}function ro(e){return e.write!==e.constructor.prototype.write}function we(e){let t=new Ze(e);return t.on("error",n),!e.sync&&Xs&&(In.register(t,io),t.on("close",function(){In.unregister(t)})),t;function n(r){if(r.code==="EPIPE"){t.write=ee,t.end=ee,t.flushSync=ee,t.destroy=ee;return}t.removeListener("error",n),t.emit("error",r)}}function io(e,t){e.destroyed||(t==="beforeExit"?(e.flush(),e.on("drain",function(){e.end()})):e.flushSync())}function so(e){return function(n,r,i={},s){if(typeof i=="string")s=we({dest:i}),i={};else if(typeof s=="string"){if(i&&i.transport)throw Error("only one of option.transport or stream can be specified");s=we({dest:s})}else if(i instanceof Ze||i.writable||i._writableState)s=i,i={};else if(i.transport){if(i.transport instanceof Ze||i.transport.writable||i.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(i.transport.targets&&i.transport.targets.length&&i.formatters&&typeof i.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let f;i.customLevels&&(f=i.useOnlyCustomLevels?i.customLevels:Object.assign({},i.levels,i.customLevels)),s=Ys({caller:r,...i.transport,levels:f})}if(i=Object.assign({},e,i),i.serializers=Object.assign({},e.serializers,i.serializers),i.formatters=Object.assign({},e.formatters,i.formatters),i.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:u,onChild:l}=i;return u===!1&&(i.level="silent"),l||(i.onChild=ee),s||(ro(process.stdout)?s=process.stdout:s=we({fd:process.stdout.fd||1})),{opts:i,stream:s}}}function oo(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[et])(e)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function fo(e,t,n){return{level:e,bindings:t,log:n}}function lo(e){let t=Number(e);return typeof e=="string"&&Number.isFinite(t)?t:e===void 0?1:e}Fn.exports={noop:ee,buildSafeSonicBoom:we,asChindings:no,asJson:to,genLog:Zs,createArgsNormalizer:so,stringify:oo,buildFormatters:fo,normalizeDestFileDescriptor:lo}});var _e=v((eu,Mn)=>{"use strict";w();var uo={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},co={ASC:"ASC",DESC:"DESC"};Mn.exports={DEFAULT_LEVELS:uo,SORTING_ORDER:co}});var rt=v((nu,Jn)=>{"use strict";w();var{lsCacheSym:ao,levelValSym:tt,useOnlyCustomLevelsSym:ho,streamSym:yo,formattersSym:go,hooksSym:mo,levelCompSym:zn}=Q(),{noop:po,genLog:G}=Se(),{DEFAULT_LEVELS:V,SORTING_ORDER:Vn}=_e(),Kn={fatal:e=>{let t=G(V.fatal,e);return function(...n){let r=this[yo];if(t.call(this,...n),typeof r.flushSync=="function")try{r.flushSync()}catch{}}},error:e=>G(V.error,e),warn:e=>G(V.warn,e),info:e=>G(V.info,e),debug:e=>G(V.debug,e),trace:e=>G(V.trace,e)},nt=Object.keys(V).reduce((e,t)=>(e[V[t]]=t,e),{}),bo=Object.keys(nt).reduce((e,t)=>(e[t]='{"level":'+Number(t),e),{});function wo(e){let t=e[go].level,{labels:n}=e.levels,r={};for(let i in n){let s=t(n[i],Number(i));r[i]=JSON.stringify(s).slice(0,-1)}return e[ao]=r,e}function So(e,t){if(t)return!1;switch(e){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function _o(e){let{labels:t,values:n}=this.levels;if(typeof e=="number"){if(t[e]===void 0)throw Error("unknown level value"+e);e=t[e]}if(n[e]===void 0)throw Error("unknown level "+e);let r=this[tt],i=this[tt]=n[e],s=this[ho],u=this[zn],l=this[mo].logMethod;for(let f in n){if(u(n[f],i)===!1){this[f]=po;continue}this[f]=So(f,s)?Kn[f](l):G(n[f],l)}this.emit("level-change",e,i,t[r],r,this)}function Eo(e){let{levels:t,levelVal:n}=this;return t&&t.labels?t.labels[n]:""}function Oo(e){let{values:t}=this.levels,n=t[e];return n!==void 0&&this[zn](n,this[tt])}function xo(e,t,n){return e===Vn.DESC?t<=n:t>=n}function vo(e){return typeof e=="string"?xo.bind(null,e):e}function Ao(e=null,t=!1){let n=e?Object.keys(e).reduce((s,u)=>(s[e[u]]=u,s),{}):null,r=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),t?null:nt,n),i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:V,e);return{labels:r,values:i}}function Lo(e,t,n){if(typeof e=="number"){if(![].concat(Object.keys(t||{}).map(s=>t[s]),n?[]:Object.keys(nt).map(s=>+s),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}let r=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),n?null:V,t);if(!(e in r))throw Error(`default level:${e} must be included in custom levels`)}function To(e,t){let{labels:n,values:r}=e;for(let i in t){if(i in r)throw Error("levels cannot be overridden");if(t[i]in n)throw Error("pre-existing level values cannot be used for new levels")}}function ko(e){if(typeof e!="function"&&!(typeof e=="string"&&Object.values(Vn).includes(e)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}Jn.exports={initialLsCache:bo,genLsCache:wo,levelMethods:Kn,getLevel:Eo,setLevel:_o,isLevelEnabled:Oo,mappings:Ao,assertNoLevelCollisions:To,assertDefaultLevelFound:Lo,genLevelComparison:vo,assertLevelComparison:ko}});var it=v((iu,Un)=>{"use strict";w();Un.exports={version:"10.3.1"}});var tr=v((fu,er)=>{"use strict";w();var{EventEmitter:Io}=B("events"),{lsCacheSym:Co,levelValSym:Bo,setLevelSym:ot,getLevelSym:Gn,chindingsSym:Oe,mixinSym:jo,asJsonSym:Xn,writeSym:Po,mixinMergeStrategySym:$o,timeSym:No,timeSliceIndexSym:Do,streamSym:Yn,serializersSym:H,formattersSym:re,errorKeySym:Ro,messageKeySym:qo,useOnlyCustomLevelsSym:Wo,needsMetadataGsym:Fo,redactFmtSym:Mo,stringifySym:zo,formatOptsSym:Vo,stringifiersSym:Ko,msgPrefixSym:ft,hooksSym:Jo}=Q(),{getLevel:Uo,setLevel:Go,isLevelEnabled:Ho,mappings:Xo,initialLsCache:Yo,genLsCache:Qo,assertNoLevelCollisions:Zo}=rt(),{asChindings:lt,asJson:ef,buildFormatters:st,stringify:Hn,noop:Qn}=Se(),{version:tf}=it(),nf=Re(),rf=class{},Zn={constructor:rf,child:sf,bindings:of,setBindings:ff,flush:cf,isLevelEnabled:Ho,version:tf,get level(){return this[Gn]()},set level(e){this[ot](e)},get levelVal(){return this[Bo]},set levelVal(e){throw Error("levelVal is read-only")},get msgPrefix(){return this[ft]},get[Symbol.toStringTag](){return"Pino"},[Co]:Yo,[Po]:uf,[Xn]:ef,[Gn]:Uo,[ot]:Go};Object.setPrototypeOf(Zn,Io.prototype);er.exports=function(){return Object.create(Zn)};var Ee=e=>e;function sf(e,t){if(!e)throw Error("missing bindings for child Pino");let n=this[H],r=this[re],i=Object.create(this);if(t==null)return i[re].bindings!==Ee&&(i[re]=st(r.level,Ee,r.log)),i[Oe]=lt(i,e),this.onChild!==Qn&&this.onChild(i),i;if(t.hasOwnProperty("serializers")===!0){i[H]=Object.create(null);for(let h in n)i[H][h]=n[h];let l=Object.getOwnPropertySymbols(n);for(var s=0;s<l.length;s++){let h=l[s];i[H][h]=n[h]}for(let h in t.serializers)i[H][h]=t.serializers[h];let f=Object.getOwnPropertySymbols(t.serializers);for(var u=0;u<f.length;u++){let h=f[u];i[H][h]=t.serializers[h]}}else i[H]=n;if(t.hasOwnProperty("formatters")){let{level:l,bindings:f,log:h}=t.formatters;i[re]=st(l||r.level,f||Ee,h||r.log)}else i[re]=st(r.level,Ee,r.log);if(t.hasOwnProperty("customLevels")===!0&&(Zo(this.levels,t.customLevels),i.levels=Xo(t.customLevels,i[Wo]),Qo(i)),typeof t.redact=="object"&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let l=nf(i.redact,Hn),f={stringify:l[Mo]};i[zo]=Hn,i[Ko]=l,i[Vo]=f}if(typeof t.msgPrefix=="string"&&(i[ft]=(this[ft]||"")+t.msgPrefix),i[Oe]=lt(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty("customLevels")){let l=t.level||this.level;i[ot](l)}return this.onChild(i),i}function of(){let t=`{${this[Oe].substr(1)}}`,n=JSON.parse(t);return delete n.pid,delete n.hostname,n}function ff(e){let t=lt(this,e);this[Oe]=t}function lf(e,t){return Object.assign(t,e)}function uf(e,t,n){let r=this[No](),i=this[jo],s=this[Ro],u=this[qo],l=this[$o]||lf,f,h=this[Jo].streamWrite;e==null?f={}:e instanceof Error?(f={[s]:e},t===void 0&&(t=e.message)):(f=e,t===void 0&&e[u]===void 0&&e[s]&&(t=e[s].message)),i&&(f=l(f,i(f,n,this)));let d=this[Xn](f,t,n,r),c=this[Yn];c[Fo]===!0&&(c.lastLevel=n,c.lastObj=f,c.lastMsg=t,c.lastTime=r.slice(this[Do]),c.lastLogger=this),c.write(h?h(d):d)}function cf(e){if(e!=null&&typeof e!="function")throw Error("callback must be a function");let t=this[Yn];typeof t.flush=="function"?t.flush(e||Qn):e&&e()}});var sr=v((ht,ir)=>{"use strict";w();var{hasOwnProperty:ie}=Object.prototype,Y=at();Y.configure=at;Y.stringify=Y;Y.default=Y;ht.stringify=Y;ht.configure=at;ir.exports=Y;var af=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function K(e){return e.length<5e3&&!af.test(e)?`"${e}"`:JSON.stringify(e)}function ut(e,t){if(e.length>200||t)return e.sort(t);for(let n=1;n<e.length;n++){let r=e[n],i=n;for(;i!==0&&e[i-1]>r;)e[i]=e[i-1],i--;e[i]=r}return e}var hf=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function ct(e){return hf.call(e)!==void 0&&e.length!==0}function nr(e,t,n){e.length<n&&(n=e.length);let r=t===","?"":" ",i=`"0":${r}${e[0]}`;for(let s=1;s<n;s++)i+=`${t}"${s}":${r}${e[s]}`;return i}function df(e){if(ie.call(e,"circularValue")){let t=e.circularValue;if(typeof t=="string")return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function yf(e){let t;if(ie.call(e,"deterministic")&&(t=e.deterministic,typeof t!="boolean"&&typeof t!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return t===void 0?!0:t}function gf(e,t){let n;if(ie.call(e,t)&&(n=e[t],typeof n!="boolean"))throw new TypeError(`The "${t}" argument must be of type boolean`);return n===void 0?!0:n}function rr(e,t){let n;if(ie.call(e,t)){if(n=e[t],typeof n!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(n))throw new TypeError(`The "${t}" argument must be an integer`);if(n<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return n===void 0?1/0:n}function X(e){return e===1?"1 item":`${e} items`}function mf(e){let t=new Set;for(let n of e)(typeof n=="string"||typeof n=="number")&&t.add(String(n));return t}function pf(e){if(ie.call(e,"strict")){let t=e.strict;if(typeof t!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(t)return n=>{let r=`Object can not safely be stringified. Received type ${typeof n}`;throw typeof n!="function"&&(r+=` (${n.toString()})`),new Error(r)}}}function at(e){e={...e};let t=pf(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let n=df(e),r=gf(e,"bigint"),i=yf(e),s=typeof i=="function"?i:void 0,u=rr(e,"maximumDepth"),l=rr(e,"maximumBreadth");function f(y,o,g,p,S,_){let b=o[y];switch(typeof b=="object"&&b!==null&&typeof b.toJSON=="function"&&(b=b.toJSON(y)),b=p.call(o,y,b),typeof b){case"string":return K(b);case"object":{if(b===null)return"null";if(g.indexOf(b)!==-1)return n;let E="",T=",",C=_;if(Array.isArray(b)){if(b.length===0)return"[]";if(u<g.length+1)return'"[Array]"';g.push(b),S!==""&&(_+=S,E+=`
|
|
5
|
+
${_}`,T=`,
|
|
6
|
+
${_}`);let P=Math.min(b.length,l),R=0;for(;R<P-1;R++){let J=f(String(R),b,g,p,S,_);E+=J!==void 0?J:"null",E+=T}let q=f(String(R),b,g,p,S,_);if(E+=q!==void 0?q:"null",b.length-1>l){let J=b.length-l-1;E+=`${T}"... ${X(J)} not stringified"`}return S!==""&&(E+=`
|
|
7
|
+
${C}`),g.pop(),`[${E}]`}let A=Object.keys(b),I=A.length;if(I===0)return"{}";if(u<g.length+1)return'"[Object]"';let O="",j="";S!==""&&(_+=S,T=`,
|
|
8
|
+
${_}`,O=" ");let $=Math.min(I,l);i&&!ct(b)&&(A=ut(A,s)),g.push(b);for(let P=0;P<$;P++){let R=A[P],q=f(R,b,g,p,S,_);q!==void 0&&(E+=`${j}${K(R)}:${O}${q}`,j=T)}if(I>l){let P=I-l;E+=`${j}"...":${O}"${X(P)} not stringified"`,j=T}return S!==""&&j.length>1&&(E=`
|
|
9
|
+
${_}${E}
|
|
10
|
+
${C}`),g.pop(),`{${E}}`}case"number":return isFinite(b)?String(b):t?t(b):"null";case"boolean":return b===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(b);default:return t?t(b):void 0}}function h(y,o,g,p,S,_){switch(typeof o=="object"&&o!==null&&typeof o.toJSON=="function"&&(o=o.toJSON(y)),typeof o){case"string":return K(o);case"object":{if(o===null)return"null";if(g.indexOf(o)!==-1)return n;let b=_,E="",T=",";if(Array.isArray(o)){if(o.length===0)return"[]";if(u<g.length+1)return'"[Array]"';g.push(o),S!==""&&(_+=S,E+=`
|
|
11
|
+
${_}`,T=`,
|
|
12
|
+
${_}`);let I=Math.min(o.length,l),O=0;for(;O<I-1;O++){let $=h(String(O),o[O],g,p,S,_);E+=$!==void 0?$:"null",E+=T}let j=h(String(O),o[O],g,p,S,_);if(E+=j!==void 0?j:"null",o.length-1>l){let $=o.length-l-1;E+=`${T}"... ${X($)} not stringified"`}return S!==""&&(E+=`
|
|
13
|
+
${b}`),g.pop(),`[${E}]`}g.push(o);let C="";S!==""&&(_+=S,T=`,
|
|
14
|
+
${_}`,C=" ");let A="";for(let I of p){let O=h(I,o[I],g,p,S,_);O!==void 0&&(E+=`${A}${K(I)}:${C}${O}`,A=T)}return S!==""&&A.length>1&&(E=`
|
|
15
|
+
${_}${E}
|
|
16
|
+
${b}`),g.pop(),`{${E}}`}case"number":return isFinite(o)?String(o):t?t(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(o);default:return t?t(o):void 0}}function d(y,o,g,p,S){switch(typeof o){case"string":return K(o);case"object":{if(o===null)return"null";if(typeof o.toJSON=="function"){if(o=o.toJSON(y),typeof o!="object")return d(y,o,g,p,S);if(o===null)return"null"}if(g.indexOf(o)!==-1)return n;let _=S;if(Array.isArray(o)){if(o.length===0)return"[]";if(u<g.length+1)return'"[Array]"';g.push(o),S+=p;let O=`
|
|
17
|
+
${S}`,j=`,
|
|
18
|
+
${S}`,$=Math.min(o.length,l),P=0;for(;P<$-1;P++){let q=d(String(P),o[P],g,p,S);O+=q!==void 0?q:"null",O+=j}let R=d(String(P),o[P],g,p,S);if(O+=R!==void 0?R:"null",o.length-1>l){let q=o.length-l-1;O+=`${j}"... ${X(q)} not stringified"`}return O+=`
|
|
19
|
+
${_}`,g.pop(),`[${O}]`}let b=Object.keys(o),E=b.length;if(E===0)return"{}";if(u<g.length+1)return'"[Object]"';S+=p;let T=`,
|
|
20
|
+
${S}`,C="",A="",I=Math.min(E,l);ct(o)&&(C+=nr(o,T,l),b=b.slice(o.length),I-=o.length,A=T),i&&(b=ut(b,s)),g.push(o);for(let O=0;O<I;O++){let j=b[O],$=d(j,o[j],g,p,S);$!==void 0&&(C+=`${A}${K(j)}: ${$}`,A=T)}if(E>l){let O=E-l;C+=`${A}"...": "${X(O)} not stringified"`,A=T}return A!==""&&(C=`
|
|
21
|
+
${S}${C}
|
|
22
|
+
${_}`),g.pop(),`{${C}}`}case"number":return isFinite(o)?String(o):t?t(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(o);default:return t?t(o):void 0}}function c(y,o,g){switch(typeof o){case"string":return K(o);case"object":{if(o===null)return"null";if(typeof o.toJSON=="function"){if(o=o.toJSON(y),typeof o!="object")return c(y,o,g);if(o===null)return"null"}if(g.indexOf(o)!==-1)return n;let p="",S=o.length!==void 0;if(S&&Array.isArray(o)){if(o.length===0)return"[]";if(u<g.length+1)return'"[Array]"';g.push(o);let C=Math.min(o.length,l),A=0;for(;A<C-1;A++){let O=c(String(A),o[A],g);p+=O!==void 0?O:"null",p+=","}let I=c(String(A),o[A],g);if(p+=I!==void 0?I:"null",o.length-1>l){let O=o.length-l-1;p+=`,"... ${X(O)} not stringified"`}return g.pop(),`[${p}]`}let _=Object.keys(o),b=_.length;if(b===0)return"{}";if(u<g.length+1)return'"[Object]"';let E="",T=Math.min(b,l);S&&ct(o)&&(p+=nr(o,",",l),_=_.slice(o.length),T-=o.length,E=","),i&&(_=ut(_,s)),g.push(o);for(let C=0;C<T;C++){let A=_[C],I=c(A,o[A],g);I!==void 0&&(p+=`${E}${K(A)}:${I}`,E=",")}if(b>l){let C=b-l;p+=`${E}"...":"${X(C)} not stringified"`}return g.pop(),`{${p}}`}case"number":return isFinite(o)?String(o):t?t(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(o);default:return t?t(o):void 0}}function m(y,o,g){if(arguments.length>1){let p="";if(typeof g=="number"?p=" ".repeat(Math.min(g,10)):typeof g=="string"&&(p=g.slice(0,10)),o!=null){if(typeof o=="function")return f("",{"":y},[],o,p,"");if(Array.isArray(o))return h("",y,[],mf(o),p,"")}if(p.length!==0)return d("",y,[],p,"")}return c("",y,[])}return m}});var ur=v((cu,lr)=>{"use strict";w();var dt=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:fr}=_e(),bf=fr.info;function wf(e,t){e=e||[],t=t||{dedupe:!1};let n=Object.create(fr);n.silent=1/0,t.levels&&typeof t.levels=="object"&&Object.keys(t.levels).forEach(c=>{n[c]=t.levels[c]});let r={write:i,add:l,remove:f,emit:s,flushSync:u,end:h,minLevel:0,lastId:0,streams:[],clone:d,[dt]:!0,streamLevels:n};return Array.isArray(e)?e.forEach(l,r):l.call(r,e),e=null,r;function i(c){let m,y=this.lastLevel,{streams:o}=this,g=0,p;for(let S=Sf(o.length,t.dedupe);Ef(S,o.length,t.dedupe);S=_f(S,t.dedupe))if(m=o[S],m.level<=y){if(g!==0&&g!==m.level)break;if(p=m.stream,p[dt]){let{lastTime:_,lastMsg:b,lastObj:E,lastLogger:T}=this;p.lastLevel=y,p.lastTime=_,p.lastMsg=b,p.lastObj=E,p.lastLogger=T}p.write(c),t.dedupe&&(g=m.level)}else if(!t.dedupe)break}function s(...c){for(let{stream:m}of this.streams)typeof m.emit=="function"&&m.emit(...c)}function u(){for(let{stream:c}of this.streams)typeof c.flushSync=="function"&&c.flushSync()}function l(c){if(!c)return r;let m=typeof c.write=="function"||c.stream,y=c.write?c:c.stream;if(!m)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:o,streamLevels:g}=this,p;typeof c.levelVal=="number"?p=c.levelVal:typeof c.level=="string"?p=g[c.level]:typeof c.level=="number"?p=c.level:p=bf;let S={stream:y,level:p,levelVal:void 0,id:++r.lastId};return o.unshift(S),o.sort(or),this.minLevel=o[0].level,r}function f(c){let{streams:m}=this,y=m.findIndex(o=>o.id===c);return y>=0&&(m.splice(y,1),m.sort(or),this.minLevel=m.length>0?m[0].level:-1),r}function h(){for(let{stream:c}of this.streams)typeof c.flushSync=="function"&&c.flushSync(),c.end()}function d(c){let m=new Array(this.streams.length);for(let y=0;y<m.length;y++)m[y]={level:c,stream:this.streams[y].stream};return{write:i,add:l,remove:f,minLevel:c,streams:m,clone:d,emit:s,flushSync:u,[dt]:!0}}}function or(e,t){return e.level-t.level}function Sf(e,t){return t?e-1:0}function _f(e,t){return t?e-1:e+1}function Ef(e,t,n){return n?e>=0:e<t}lr.exports=wf});var ll=v((hu,W)=>{"use strict";w();var Of=B("os"),pr=Pe(),xf=$e(),vf=Re(),br=Zt(),Af=tr(),wr=Q(),{configure:Lf}=sr(),{assertDefaultLevelFound:Tf,mappings:Sr,genLsCache:kf,genLevelComparison:If,assertLevelComparison:Cf}=rt(),{DEFAULT_LEVELS:_r,SORTING_ORDER:Bf}=_e(),{createArgsNormalizer:jf,asChindings:Pf,buildSafeSonicBoom:cr,buildFormatters:$f,stringify:yt,normalizeDestFileDescriptor:ar,noop:Nf}=Se(),{version:Df}=it(),{chindingsSym:hr,redactFmtSym:Rf,serializersSym:dr,timeSym:qf,timeSliceIndexSym:Wf,streamSym:Ff,stringifySym:yr,stringifySafeSym:gt,stringifiersSym:gr,setLevelSym:Mf,endSym:zf,formatOptsSym:Vf,messageKeySym:Kf,errorKeySym:Jf,nestedKeySym:Uf,mixinSym:Gf,levelCompSym:Hf,useOnlyCustomLevelsSym:Xf,formattersSym:mr,hooksSym:Yf,nestedKeyStrSym:Qf,mixinMergeStrategySym:Zf,msgPrefixSym:el}=wr,{epochTime:Er,nullTime:tl}=br,{pid:nl}=process,rl=Of.hostname(),il=pr.err,sl={level:"info",levelComparison:Bf.ASC,levels:_r,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:nl,hostname:rl},serializers:Object.assign(Object.create(null),{err:il}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:Er,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},ol=jf(sl),fl=Object.assign(Object.create(null),pr);function mt(...e){let t={},{opts:n,stream:r}=ol(t,xf(),...e);n.level&&typeof n.level=="string"&&_r[n.level.toLowerCase()]!==void 0&&(n.level=n.level.toLowerCase());let{redact:i,crlf:s,serializers:u,timestamp:l,messageKey:f,errorKey:h,nestedKey:d,base:c,name:m,level:y,customLevels:o,levelComparison:g,mixin:p,mixinMergeStrategy:S,useOnlyCustomLevels:_,formatters:b,hooks:E,depthLimit:T,edgeLimit:C,onChild:A,msgPrefix:I}=n,O=Lf({maximumDepth:T,maximumBreadth:C}),j=$f(b.level,b.bindings,b.log),$=yt.bind({[gt]:O}),P=i?vf(i,$):{},R=i?{stringify:P[Rf]}:{stringify:$},q="}"+(s?`\r
|
|
23
|
+
`:`
|
|
24
|
+
`),J=Pf.bind(null,{[hr]:"",[dr]:u,[gr]:P,[yr]:yt,[gt]:O,[mr]:j}),xe="";c!==null&&(m===void 0?xe=J(c):xe=J(Object.assign({},c,{name:m})));let pt=l instanceof Function?l:l?Er:tl,xr=pt().indexOf(":")+1;if(_&&!o)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(p&&typeof p!="function")throw Error(`Unknown mixin type "${typeof p}" - expected "function"`);if(I&&typeof I!="string")throw Error(`Unknown msgPrefix type "${typeof I}" - expected "string"`);Tf(y,o,_);let bt=Sr(o,_);typeof r.emit=="function"&&r.emit("message",{code:"PINO_CONFIG",config:{levels:bt,messageKey:f,errorKey:h}}),Cf(g);let vr=If(g);return Object.assign(t,{levels:bt,[Hf]:vr,[Xf]:_,[Ff]:r,[qf]:pt,[Wf]:xr,[yr]:yt,[gt]:O,[gr]:P,[zf]:q,[Vf]:R,[Kf]:f,[Jf]:h,[Uf]:d,[Qf]:d?`,${JSON.stringify(d)}:{`:"",[dr]:u,[Gf]:p,[Zf]:S,[hr]:xe,[mr]:j,[Yf]:E,silent:Nf,onChild:A,[el]:I}),Object.setPrototypeOf(t,Af()),kf(t),t[Mf](y),t}W.exports=mt;W.exports.destination=(e=process.stdout.fd)=>typeof e=="object"?(e.dest=ar(e.dest||process.stdout.fd),cr(e)):cr({dest:ar(e),minLength:0});W.exports.transport=Ye();W.exports.multistream=ur();W.exports.levels=Sr();W.exports.stdSerializers=fl;W.exports.stdTimeFunctions=Object.assign({},br);W.exports.symbols=wr;W.exports.version=Df;W.exports.default=mt;W.exports.pino=mt});w();var ul=5e3,Or=class e{pinoInstance;state;context;telemetryCache=null;constructor(t,n={telemetryEnabled:!1},r={}){this.pinoInstance=t,this.state=n,this.context=r}getTelemetry(){if(!this.state.telemetryEnabled)return;let t=Date.now();return(!this.telemetryCache||t>=this.telemetryCache.expiresAt)&&(this.telemetryCache={value:wt(),expiresAt:t+ul}),this.telemetryCache.value}validate(t,n){if(typeof t!="string")throw new Error("Logger requires string message first, optional object second");if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))throw new Error("Logger requires string message first, optional object second")}trace(t,n){this.validate(t,n),this.pinoInstance.trace({...this.context,...U(n),telemetry:this.getTelemetry()},t)}debug(t,n){this.validate(t,n),this.pinoInstance.debug({...this.context,...U(n),telemetry:this.getTelemetry()},t)}info(t,n){this.validate(t,n),this.pinoInstance.info({...this.context,...U(n),telemetry:this.getTelemetry()},t)}warn(t,n){this.validate(t,n),this.pinoInstance.warn({...this.context,...U(n),telemetry:this.getTelemetry()},t)}error(t,n){this.validate(t,n),this.pinoInstance.error({...this.context,...U(n),telemetry:this.getTelemetry()},t)}fatal(t,n){this.validate(t,n),this.pinoInstance.fatal({...this.context,...U(n),telemetry:this.getTelemetry()},t)}child(t){return new e(this.pinoInstance,this.state,{...this.context,...t})}setTelemetry(t){if(t!=="on"&&t!=="off")throw new Error("setTelemetry accepts only 'on' or 'off'");this.state.telemetryEnabled=t==="on"}get level(){return this.pinoInstance.level}set level(t){this.pinoInstance.level=t}get levelVal(){return this.pinoInstance.levelVal}bindings(){return{...this.context}}silent(){this.pinoInstance.level="silent"}flush(t){typeof this.pinoInstance.flush=="function"?this.pinoInstance.flush(t):t?.()}};export{cn as a,ze as b,ll as c,Or as d};
|