@jeffchi/logger 2.5.1-alpha.0 → 3.0.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/README.md CHANGED
@@ -1,5 +1,5 @@
1
- <h1 align="center">
2
- <a href="https://github.com/poechiang/jeffchi-logger#readme" target="_blank">jeffchi-logger</a>
1
+ <h1 >
2
+ <a href="https://github.com/poechiang/jeffchi-logger#readme" target="_blank">@JeffChi/Logger</a>
3
3
  </h1>
4
4
 
5
5
  <div align="center">
@@ -7,9 +7,10 @@
7
7
  A log print output javascript tool library that can be used at the front and back ends
8
8
 
9
9
  [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg?logo=jest)](https://github.com/facebook/jest)
10
- ![test](https://github.com/vueComponent/ant-design-vue/workflows/test/badge.svg)
10
+ [![NPM Package](https://github.com/poechiang/jeffchi-logger/actions/workflows/npm-publish.yml/badge.svg?branch=main)](https://github.com/poechiang/jeffchi-logger/actions/workflows/npm-publish.yml)
11
+ [![GIT Package](https://github.com/poechiang/jeffchi-logger/actions/workflows/npm-publish-github-packages.yml/badge.svg?branch=main&event=pull_request)](https://github.com/poechiang/jeffchi-logger/actions/workflows/npm-publish-github-packages.yml)
11
12
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
12
- [![actions-cool](https://img.shields.io/badge/using-actions--cool-blue?style=flat-square)](https://github.com/actions-cool)
13
+ [![JEST Report](https://github.com/poechiang/jeffchi-logger/actions/workflows/jest-report.yml/badge.svg)](https://github.com/poechiang/jeffchi-logger/actions/workflows/jest-report.yml)
13
14
 
14
15
  </div>
15
16
 
@@ -39,7 +40,7 @@ $ yarn add @jeffchi/logger
39
40
  ## 用法
40
41
 
41
42
  ```javascript
42
- import { loggerWithTags } from '@jeffchi/logger';
43
+ import { withTags, loggerWithTags } from '@jeffchi/logger';
43
44
  import { LogLevel, LogMode } from '@jeffchi/logger/lib/interface';
44
45
  const { debug, error, info, log, warn } = loggerWithTags(
45
46
  'api', // ['api','get'] 一个或多个tag
@@ -109,8 +110,10 @@ export interface ILogOptions {
109
110
  * 浏览器环境:自动忽略该选项;
110
111
  *
111
112
  * node环境下默认 logs/xxx.log
113
+ * @deprecated 由output代替
112
114
  */
113
115
  outputFile?: string;
116
+ output?: string | LogOutputOptions;
114
117
  }
115
118
  ```
116
119
 
@@ -137,25 +140,17 @@ export interface ILogOptions {
137
140
  npm run name
138
141
  ```
139
142
 
140
- | 脚本名称 | 说明 |
141
- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
142
- | clear | 清理 `lib/` `docs/` `build/`临时目录 |
143
- | doc | 利用 typedoc 生成 api 文档,位于`docs/`目录下 |
144
- | dev | 启动开发模式 |
145
- | build | 执行构建过程 |
146
- | format | 利用 prettier 格式化 |
147
- | lint | 依赖 tslint 对代码检查 |
148
- | test | 依赖 jest 测试代码 |
149
- | push | 用指定 message 提交代码并推送至远程 |
150
- | version [`major`\|`minor`\|`patch`] | 生成新的 `主`\|`次`\|`批` 版本号,同步至无程仓库打标分支 |
151
- | release [`major`\|`minor`\|`patch`] [`-a`] | 生成新的 `主`\|`次`\|`批` 版本号,推送远程仓库后,并发布至 npm 仓 <blockquote> -a: 提交全部修改</blockquote> |
152
- | release:alpha [`major`\|`minor`\|`patch`] [`-a`] | 生成新的 `主`\|`次`\|`批` 内部版本号,推送远程仓库后,并发布至 npm 仓 <blockquote> -a: 提交全部修改</blockquote> |
153
- | release:beta [`major`\|`minor`\|`patch`] [`-a`] | 生成新的 `主`\|`次`\|`批` 公测版本号,推送远程仓库后,并发布至 npm 仓 <blockquote> -a: 提交全部修改</blockquote> |
154
- | release:rc [`major`\|`minor`\|`patch`] [`-a`] | 生成新的 `主`\|`次`\|`批` 候选版本号,推送远程仓库后,并发布至 npm 仓 <blockquote> -a: 提交全部修改</blockquote> |
155
-
156
- > ### `version` 与 `release`的区别:
157
- >
158
- > `version`只打标生成新的版本号,同步远程仓库,并不会执行最后的发布流程<br> > `release`打标生成新的版本号,同步远程仓库,并且会执行最后的发布流程
143
+ | 脚本名称 | 说明 |
144
+ | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
145
+ | clear | 清理 `lib/` `docs/` `build/`临时目录 |
146
+ | doc | 利用 typedoc 生成 api 文档,位于`docs/`目录下 |
147
+ | dev | 启动开发模式 |
148
+ | build | 执行构建过程 |
149
+ | format | 利用 prettier 格式化 |
150
+ | lint | 依赖 tslint 对代码检查 |
151
+ | test | 依赖 jest 测试代码 |
152
+ | push | 用指定 message 提交代码并推送至远程 |
153
+ | release [`<verson>`\|`patch`\|`minor`\|`major`] -- [`--alpha`\|`--beta`\|`--rc`] [`--all`] [`--otp code`] | 生成新的 `主`\|`次`\|`批` 版本号,推送远程仓库后,并发布至 npm 仓 <blockquote><li> --alpha: 预发布内部版本</li><li> --beta: 预发布公测版本</li><li> -rc: 预发布候选版本</li><li> -all: 提交全部修改</li><li> -otp `<code>`: 如果指定一次性口令,则直接发布到 npm 中心仓,否则不发布</li></blockquote> |
159
154
 
160
155
  ## License
161
156
 
package/lib/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";function t(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function e(t,e,n,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(t,n):a?a.value=n:e.set(t,n),n}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t){if(null===t||!0===t||!1===t)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function a(t,e){if(e.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+e.length+" present")}function i(t){return i="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":n(t)},i(t)}function o(t){a(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||"object"===i(t)&&"[object Date]"===e?new Date(t.getTime()):"number"==typeof t||"[object Number]"===e?new Date(t):("string"!=typeof t&&"[object String]"!==e||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function u(t,e){a(2,arguments);var n=o(t).getTime(),i=r(e);return new Date(n+i)}var s={};function l(){return s}function d(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}function c(t){return c="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":n(t)},c(t)}function h(t){return a(1,arguments),t instanceof Date||"object"===c(t)&&"[object Date]"===Object.prototype.toString.call(t)}function f(t){if(a(1,arguments),!h(t)&&"number"!=typeof t)return!1;var e=o(t);return!isNaN(Number(e))}function m(t,e){a(2,arguments);var n=r(e);return u(t,-n)}var g=864e5;function w(t){a(1,arguments);var e=1,n=o(t),r=n.getUTCDay(),i=(r<e?7:0)+r-e;return n.setUTCDate(n.getUTCDate()-i),n.setUTCHours(0,0,0,0),n}function v(t){a(1,arguments);var e=o(t),n=e.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var i=w(r),u=new Date(0);u.setUTCFullYear(n,0,4),u.setUTCHours(0,0,0,0);var s=w(u);return e.getTime()>=i.getTime()?n+1:e.getTime()>=s.getTime()?n:n-1}function b(t){a(1,arguments);var e=v(t),n=new Date(0);n.setUTCFullYear(e,0,4),n.setUTCHours(0,0,0,0);var r=w(n);return r}var y=6048e5;function p(t,e){var n,i,u,s,d,c,h,f;a(1,arguments);var m=l(),g=r(null!==(n=null!==(i=null!==(u=null!==(s=null==e?void 0:e.weekStartsOn)&&void 0!==s?s:null==e||null===(d=e.locale)||void 0===d||null===(c=d.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==u?u:m.weekStartsOn)&&void 0!==i?i:null===(h=m.locale)||void 0===h||null===(f=h.options)||void 0===f?void 0:f.weekStartsOn)&&void 0!==n?n:0);if(!(g>=0&&g<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var w=o(t),v=w.getUTCDay(),b=(v<g?7:0)+v-g;return w.setUTCDate(w.getUTCDate()-b),w.setUTCHours(0,0,0,0),w}function T(t,e){var n,i,u,s,d,c,h,f;a(1,arguments);var m=o(t),g=m.getUTCFullYear(),w=l(),v=r(null!==(n=null!==(i=null!==(u=null!==(s=null==e?void 0:e.firstWeekContainsDate)&&void 0!==s?s:null==e||null===(d=e.locale)||void 0===d||null===(c=d.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==u?u:w.firstWeekContainsDate)&&void 0!==i?i:null===(h=w.locale)||void 0===h||null===(f=h.options)||void 0===f?void 0:f.firstWeekContainsDate)&&void 0!==n?n:1);if(!(v>=1&&v<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var b=new Date(0);b.setUTCFullYear(g+1,0,v),b.setUTCHours(0,0,0,0);var y=p(b,e),T=new Date(0);T.setUTCFullYear(g,0,v),T.setUTCHours(0,0,0,0);var C=p(T,e);return m.getTime()>=y.getTime()?g+1:m.getTime()>=C.getTime()?g:g-1}function C(t,e){var n,i,o,u,s,d,c,h;a(1,arguments);var f=l(),m=r(null!==(n=null!==(i=null!==(o=null!==(u=null==e?void 0:e.firstWeekContainsDate)&&void 0!==u?u:null==e||null===(s=e.locale)||void 0===s||null===(d=s.options)||void 0===d?void 0:d.firstWeekContainsDate)&&void 0!==o?o:f.firstWeekContainsDate)&&void 0!==i?i:null===(c=f.locale)||void 0===c||null===(h=c.options)||void 0===h?void 0:h.firstWeekContainsDate)&&void 0!==n?n:1),g=T(t,e),w=new Date(0);w.setUTCFullYear(g,0,m),w.setUTCHours(0,0,0,0);var v=p(w,e);return v}var M=6048e5;function D(t,e){for(var n=t<0?"-":"",r=Math.abs(t).toString();r.length<e;)r="0"+r;return n+r}var S=function(t,e){var n=t.getUTCFullYear(),r=n>0?n:1-n;return D("yy"===e?r%100:r,e.length)},k=function(t,e){var n=t.getUTCMonth();return"M"===e?String(n+1):D(n+1,2)},x=function(t,e){return D(t.getUTCDate(),e.length)},U=function(t,e){return D(t.getUTCHours()%12||12,e.length)},P=function(t,e){return D(t.getUTCHours(),e.length)},W=function(t,e){return D(t.getUTCMinutes(),e.length)},E=function(t,e){return D(t.getUTCSeconds(),e.length)},O=function(t,e){var n=e.length,r=t.getUTCMilliseconds();return D(Math.floor(r*Math.pow(10,n-3)),e.length)},N="midnight",Y="noon",L="morning",F="afternoon",j="evening",q="night",A={G:function(t,e,n){var r=t.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if("yo"===e){var r=t.getUTCFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return S(t,e)},Y:function(t,e,n,r){var a=T(t,r),i=a>0?a:1-a;return"YY"===e?D(i%100,2):"Yo"===e?n.ordinalNumber(i,{unit:"year"}):D(i,e.length)},R:function(t,e){return D(v(t),e.length)},u:function(t,e){return D(t.getUTCFullYear(),e.length)},Q:function(t,e,n){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return D(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return D(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){var r=t.getUTCMonth();switch(e){case"M":case"MM":return k(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){var r=t.getUTCMonth();switch(e){case"L":return String(r+1);case"LL":return D(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){var i=function(t,e){a(1,arguments);var n=o(t),r=p(n,e).getTime()-C(n,e).getTime();return Math.round(r/M)+1}(t,r);return"wo"===e?n.ordinalNumber(i,{unit:"week"}):D(i,e.length)},I:function(t,e,n){var r=function(t){a(1,arguments);var e=o(t),n=w(e).getTime()-b(e).getTime();return Math.round(n/y)+1}(t);return"Io"===e?n.ordinalNumber(r,{unit:"week"}):D(r,e.length)},d:function(t,e,n){return"do"===e?n.ordinalNumber(t.getUTCDate(),{unit:"date"}):x(t,e)},D:function(t,e,n){var r=function(t){a(1,arguments);var e=o(t),n=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var r=e.getTime(),i=n-r;return Math.floor(i/g)+1}(t);return"Do"===e?n.ordinalNumber(r,{unit:"dayOfYear"}):D(r,e.length)},E:function(t,e,n){var r=t.getUTCDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){var a=t.getUTCDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return D(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){var a=t.getUTCDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return D(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){var r=t.getUTCDay(),a=0===r?7:r;switch(e){case"i":return String(a);case"ii":return D(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,n){var r,a=t.getUTCHours();switch(r=12===a?Y:0===a?N:a/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,n){var r,a=t.getUTCHours();switch(r=a>=17?j:a>=12?F:a>=4?L:q,e){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,n){if("ho"===e){var r=t.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return U(t,e)},H:function(t,e,n){return"Ho"===e?n.ordinalNumber(t.getUTCHours(),{unit:"hour"}):P(t,e)},K:function(t,e,n){var r=t.getUTCHours()%12;return"Ko"===e?n.ordinalNumber(r,{unit:"hour"}):D(r,e.length)},k:function(t,e,n){var r=t.getUTCHours();return 0===r&&(r=24),"ko"===e?n.ordinalNumber(r,{unit:"hour"}):D(r,e.length)},m:function(t,e,n){return"mo"===e?n.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):W(t,e)},s:function(t,e,n){return"so"===e?n.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):E(t,e)},S:function(t,e){return O(t,e)},X:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();if(0===a)return"Z";switch(e){case"X":return G(a);case"XXXX":case"XX":return H(a);default:return H(a,":")}},x:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"x":return G(a);case"xxxx":case"xx":return H(a);default:return H(a,":")}},O:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+R(a,":");default:return"GMT"+H(a,":")}},z:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+R(a,":");default:return"GMT"+H(a,":")}},t:function(t,e,n,r){var a=r._originalDate||t;return D(Math.floor(a.getTime()/1e3),e.length)},T:function(t,e,n,r){return D((r._originalDate||t).getTime(),e.length)}};function R(t,e){var n=t>0?"-":"+",r=Math.abs(t),a=Math.floor(r/60),i=r%60;if(0===i)return n+String(a);var o=e||"";return n+String(a)+o+D(i,2)}function G(t,e){return t%60==0?(t>0?"-":"+")+D(Math.abs(t)/60,2):H(t,e)}function H(t,e){var n=e||"",r=t>0?"-":"+",a=Math.abs(t);return r+D(Math.floor(a/60),2)+n+D(a%60,2)}var z=A,B=function(t,e){switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Q=function(t,e){switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},X={p:Q,P:function(t,e){var n,r=t.match(/(P+)(p+)?/)||[],a=r[1],i=r[2];if(!i)return B(t,e);switch(a){case"P":n=e.dateTime({width:"short"});break;case"PP":n=e.dateTime({width:"medium"});break;case"PPP":n=e.dateTime({width:"long"});break;default:n=e.dateTime({width:"full"})}return n.replace("{{date}}",B(a,e)).replace("{{time}}",Q(i,e))}},I=X,J=["D","DD"],$=["YY","YYYY"];function _(t){return-1!==J.indexOf(t)}function V(t){return-1!==$.indexOf(t)}function K(t,e,n){if("YYYY"===t)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===t)throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===t)throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===t)throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Z={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function tt(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.width?String(e.width):t.defaultWidth,r=t.formats[n]||t.formats[t.defaultWidth];return r}}var et={date:tt({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:tt({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:tt({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},nt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function rt(t){return function(e,n){var r;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&t.formattingValues){var a=t.defaultFormattingWidth||t.defaultWidth,i=null!=n&&n.width?String(n.width):a;r=t.formattingValues[i]||t.formattingValues[a]}else{var o=t.defaultWidth,u=null!=n&&n.width?String(n.width):t.defaultWidth;r=t.values[u]||t.values[o]}return r[t.argumentCallback?t.argumentCallback(e):e]}}function at(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(a);if(!i)return null;var o,u=i[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(s)?ot(s,(function(t){return t.test(u)})):it(s,(function(t){return t.test(u)}));o=t.valueCallback?t.valueCallback(l):l,o=n.valueCallback?n.valueCallback(o):o;var d=e.slice(u.length);return{value:o,rest:d}}}function it(t,e){for(var n in t)if(t.hasOwnProperty(n)&&e(t[n]))return n}function ot(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n}var ut,st={code:"en-US",formatDistance:function(t,e,n){var r,a=Z[t];return r="string"==typeof a?a:1===e?a.one:a.other.replace("{{count}}",e.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:et,formatRelative:function(t,e,n,r){return nt[t]},localize:{ordinalNumber:function(t,e){var n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:rt({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:rt({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:rt({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:rt({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:rt({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(ut={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.match(ut.matchPattern);if(!n)return null;var r=n[0],a=t.match(ut.parsePattern);if(!a)return null;var i=ut.valueCallback?ut.valueCallback(a[0]):a[0];i=e.valueCallback?e.valueCallback(i):i;var o=t.slice(r.length);return{value:i,rest:o}}),era:at({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:at({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:at({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:at({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:at({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},lt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,dt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ct=/^'([^]*?)'?$/,ht=/''/g,ft=/[a-zA-Z]/;function mt(t,e,n){var i,u,s,c,h,g,w,v,b,y,p,T,C,M,D,S,k,x;a(2,arguments);var U=String(e),P=l(),W=null!==(i=null!==(u=null==n?void 0:n.locale)&&void 0!==u?u:P.locale)&&void 0!==i?i:st,E=r(null!==(s=null!==(c=null!==(h=null!==(g=null==n?void 0:n.firstWeekContainsDate)&&void 0!==g?g:null==n||null===(w=n.locale)||void 0===w||null===(v=w.options)||void 0===v?void 0:v.firstWeekContainsDate)&&void 0!==h?h:P.firstWeekContainsDate)&&void 0!==c?c:null===(b=P.locale)||void 0===b||null===(y=b.options)||void 0===y?void 0:y.firstWeekContainsDate)&&void 0!==s?s:1);if(!(E>=1&&E<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var O=r(null!==(p=null!==(T=null!==(C=null!==(M=null==n?void 0:n.weekStartsOn)&&void 0!==M?M:null==n||null===(D=n.locale)||void 0===D||null===(S=D.options)||void 0===S?void 0:S.weekStartsOn)&&void 0!==C?C:P.weekStartsOn)&&void 0!==T?T:null===(k=P.locale)||void 0===k||null===(x=k.options)||void 0===x?void 0:x.weekStartsOn)&&void 0!==p?p:0);if(!(O>=0&&O<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!W.localize)throw new RangeError("locale must contain localize property");if(!W.formatLong)throw new RangeError("locale must contain formatLong property");var N=o(t);if(!f(N))throw new RangeError("Invalid time value");var Y=d(N),L=m(N,Y),F={firstWeekContainsDate:E,weekStartsOn:O,locale:W,_originalDate:N},j=U.match(dt).map((function(t){var e=t[0];return"p"===e||"P"===e?(0,I[e])(t,W.formatLong):t})).join("").match(lt).map((function(r){if("''"===r)return"'";var a=r[0];if("'"===a)return gt(r);var i=z[a];if(i)return null!=n&&n.useAdditionalWeekYearTokens||!V(r)||K(r,e,String(t)),null!=n&&n.useAdditionalDayOfYearTokens||!_(r)||K(r,e,String(t)),i(L,r,W.localize,F);if(a.match(ft))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return r})).join("");return j}function gt(t){var e=t.match(ct);return e?e[1].replace(ht,"'"):t}const wt=t=>"string"==typeof t||"[object String]"===(t=>Object.prototype.toString.call(t))(t),vt=Array.isArray,bt=Number.isInteger;var yt,pt,Tt,Ct,Mt,Dt,St,kt,xt,Ut,Pt,Wt=()=>{};class Et{static get cache(){return t(Et,pt,"f",Tt)}get defaultLogFile(){return`logs/${mt(Date.now(),"yyyy-MM-dd")}.log`}constructor(){yt.add(this),this.lastWrite=Date.now(),Ct.set(this,void 0),Mt.set(this,void 0),this.write=((t,e)=>{let n=null;bt(e)&&(e={wait:e});const{immediate:r,wait:a=100}=e||{};return(...e)=>{n&&clearTimeout(n),r&&!n&&t(...e),n=setTimeout((()=>{t(...e)}),a)}})((t=>this.flush(t)),1e3),e(this,Ct,new Map,"f"),Promise.all([import("fs"),import("path")]).then((([t,e])=>{if(!t)return null;const{existsSync:n,mkdirSync:r,writeFile:a}=t,{sep:i,resolve:o,join:u,dirname:s}=e;return{existsSync:n,mkdirSync:r,writeFile:a,join:u,sep:i,resolve:o,dirname:s}})).then((t=>{e(this,Mt,t,"f")}))}push(e,n){n=n||this.defaultLogFile;let r=t(this,Ct,"f").get(n);r||(r=new Set,t(this,Ct,"f").set(n,r));const a=Date.now();r.add(e).size>1e3||a-this.lastWrite>3e4?this.flush(n):this.write(n)}flush(e){t(this,Mt,"f")&&t(this,Ct,"f").forEach(((n,r)=>{if(n&&(null===e&&r===this.defaultLogFile||!e||r===e)){const e=Array.from(n);n.clear(),t(this,yt,"m",St).call(this,r,e),this.lastWrite=Date.now()}}))}}pt=Et,Ct=new WeakMap,Mt=new WeakMap,yt=new WeakSet,Dt=function(e){var n,r;const a=(null===(r=null===(n=t(this,Mt,"f"))||void 0===n?void 0:n.dirname)||void 0===r?void 0:r.call(n,e||this.defaultLogFile))||"",{existsSync:i,mkdirSync:o}=t(this,Mt,"f")||{};(null==i?void 0:i(a))||null==o||o(a)},St=function(e,n){vt(n)||(n=[n]),e=e||this.defaultLogFile,t(this,yt,"m",Dt).call(this,e);const{writeFile:r}=t(this,Mt,"f")||{};if(e&&r){const t=n.reduce(((t,{prefix:e=[],data:n})=>[...t,[...e,...n.map(JSON.stringify),"\n"].join(" ")]),[]);null==r||r(e,t.join(""),{flag:"a"},Wt)}},Tt={value:new Et},(xt=kt||(kt={})).ALL="all",xt.PRODUCTION="production",xt.DEVELOPMENET="development",xt.NONE="none",(Pt=Ut||(Ut={})).LOG="LOG",Pt.WARN="WARN",Pt.INFO="INFO",Pt.ERROR="ERROR",Pt.DEBUG="DEBUG";const Ot={date:!0,env:kt.ALL},Nt=(t,e)=>{const{date:n}=e,r=[];if(t.length&&r.unshift(t.map((t=>`[${t.toUpperCase()}]`)).join(" ")),n){const t=new Date;let e;e=wt(n)?mt(t,n):new Date(t).toISOString(),r.unshift(e)}return r},Yt=t=>("all"===t||process.env.NODE_ENV===t)&&void 0!==console;exports.loggerWithTags=(t,e)=>{vt(t)||(t=[t]);const{env:n,outputFile:r,levels:a=[],...i}={...Ot,...e||{}};return{debug:(...e)=>{const o=Nt(t,{...i});o.unshift(`[${Ut.DEBUG}]\t`),Yt(n||kt.ALL)&&console.debug(...o,...e),(null==a?void 0:a.length)&&!a.includes(Ut.DEBUG)||Et.cache.push({prefix:o,timestamp:Date.now(),data:[...e]},r)},info:(...e)=>{const o=Nt(t,{...i});o.unshift(`[${Ut.INFO}]\t`),Yt(n||kt.ALL)&&console.info(...o,...e),(null==a?void 0:a.length)&&!a.includes(Ut.INFO)||Et.cache.push({prefix:o,timestamp:Date.now(),data:[...e]},r)},log:(...e)=>{const o=Nt(t,i);o.unshift(`[${Ut.LOG}]\t`),Yt(n||kt.ALL)&&console.log(...o,...e),(null==a?void 0:a.length)&&!a.includes(Ut.LOG)||Et.cache.push({prefix:o,timestamp:Date.now(),data:[...e]},r)},warn:(...e)=>{const o=Nt(t,{...i});o.unshift(`[${Ut.WARN}]\t`);const{disableError:u}=i,s=u?console.debug:console.warn;Yt(n||kt.ALL)&&s(...o,...e),(null==a?void 0:a.length)&&!a.includes(Ut.WARN)||Et.cache.push({prefix:o,timestamp:Date.now(),data:[...e]},r)},error:(e,o)=>{const u=Nt(t,{...i});u.unshift(`[${Ut.ERROR}]\t`);const{disableThrow:s,ignoreThrow:l,disableError:d}=i,c=d?console.debug:console.error;if(Yt(n||kt.ALL)&&c(...u,e),(null==a?void 0:a.length)&&!a.includes(Ut.ERROR)||Et.cache.push({prefix:u,timestamp:Date.now(),data:[e]},r),!1===l||!1===s)throw new Error(e,{cause:o})}}};
1
+ "use strict";function t(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function e(t,e,n,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(t,n):a?a.value=n:e.set(t,n),n}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t){if(null===t||!0===t||!1===t)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function a(t,e){if(e.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+e.length+" present")}function o(t){return o="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":n(t)},o(t)}function i(t){a(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||"object"===o(t)&&"[object Date]"===e?new Date(t.getTime()):"number"==typeof t||"[object Number]"===e?new Date(t):("string"!=typeof t&&"[object String]"!==e||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function u(t,e){a(2,arguments);var n=i(t).getTime(),o=r(e);return new Date(n+o)}var s={};function l(){return s}function d(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}function c(t){return c="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":n(t)},c(t)}function f(t){return a(1,arguments),t instanceof Date||"object"===c(t)&&"[object Date]"===Object.prototype.toString.call(t)}function h(t){if(a(1,arguments),!f(t)&&"number"!=typeof t)return!1;var e=i(t);return!isNaN(Number(e))}function m(t,e){a(2,arguments);var n=r(e);return u(t,-n)}var g=864e5;function v(t){a(1,arguments);var e=1,n=i(t),r=n.getUTCDay(),o=(r<e?7:0)+r-e;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}function w(t){a(1,arguments);var e=i(t),n=e.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=v(r),u=new Date(0);u.setUTCFullYear(n,0,4),u.setUTCHours(0,0,0,0);var s=v(u);return e.getTime()>=o.getTime()?n+1:e.getTime()>=s.getTime()?n:n-1}function b(t){a(1,arguments);var e=w(t),n=new Date(0);n.setUTCFullYear(e,0,4),n.setUTCHours(0,0,0,0);var r=v(n);return r}var y=6048e5;function p(t,e){var n,o,u,s,d,c,f,h;a(1,arguments);var m=l(),g=r(null!==(n=null!==(o=null!==(u=null!==(s=null==e?void 0:e.weekStartsOn)&&void 0!==s?s:null==e||null===(d=e.locale)||void 0===d||null===(c=d.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==u?u:m.weekStartsOn)&&void 0!==o?o:null===(f=m.locale)||void 0===f||null===(h=f.options)||void 0===h?void 0:h.weekStartsOn)&&void 0!==n?n:0);if(!(g>=0&&g<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var v=i(t),w=v.getUTCDay(),b=(w<g?7:0)+w-g;return v.setUTCDate(v.getUTCDate()-b),v.setUTCHours(0,0,0,0),v}function T(t,e){var n,o,u,s,d,c,f,h;a(1,arguments);var m=i(t),g=m.getUTCFullYear(),v=l(),w=r(null!==(n=null!==(o=null!==(u=null!==(s=null==e?void 0:e.firstWeekContainsDate)&&void 0!==s?s:null==e||null===(d=e.locale)||void 0===d||null===(c=d.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==u?u:v.firstWeekContainsDate)&&void 0!==o?o:null===(f=v.locale)||void 0===f||null===(h=f.options)||void 0===h?void 0:h.firstWeekContainsDate)&&void 0!==n?n:1);if(!(w>=1&&w<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var b=new Date(0);b.setUTCFullYear(g+1,0,w),b.setUTCHours(0,0,0,0);var y=p(b,e),T=new Date(0);T.setUTCFullYear(g,0,w),T.setUTCHours(0,0,0,0);var C=p(T,e);return m.getTime()>=y.getTime()?g+1:m.getTime()>=C.getTime()?g:g-1}function C(t,e){var n,o,i,u,s,d,c,f;a(1,arguments);var h=l(),m=r(null!==(n=null!==(o=null!==(i=null!==(u=null==e?void 0:e.firstWeekContainsDate)&&void 0!==u?u:null==e||null===(s=e.locale)||void 0===s||null===(d=s.options)||void 0===d?void 0:d.firstWeekContainsDate)&&void 0!==i?i:h.firstWeekContainsDate)&&void 0!==o?o:null===(c=h.locale)||void 0===c||null===(f=c.options)||void 0===f?void 0:f.firstWeekContainsDate)&&void 0!==n?n:1),g=T(t,e),v=new Date(0);v.setUTCFullYear(g,0,m),v.setUTCHours(0,0,0,0);var w=p(v,e);return w}var M=6048e5;function S(t,e){for(var n=t<0?"-":"",r=Math.abs(t).toString();r.length<e;)r="0"+r;return n+r}var D=function(t,e){var n=t.getUTCFullYear(),r=n>0?n:1-n;return S("yy"===e?r%100:r,e.length)},k=function(t,e){var n=t.getUTCMonth();return"M"===e?String(n+1):S(n+1,2)},x=function(t,e){return S(t.getUTCDate(),e.length)},U=function(t,e){return S(t.getUTCHours()%12||12,e.length)},P=function(t,e){return S(t.getUTCHours(),e.length)},W=function(t,e){return S(t.getUTCMinutes(),e.length)},E=function(t,e){return S(t.getUTCSeconds(),e.length)},O=function(t,e){var n=e.length,r=t.getUTCMilliseconds();return S(Math.floor(r*Math.pow(10,n-3)),e.length)},N="midnight",L="noon",Y="morning",F="afternoon",j="evening",q="night",A={G:function(t,e,n){var r=t.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if("yo"===e){var r=t.getUTCFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return D(t,e)},Y:function(t,e,n,r){var a=T(t,r),o=a>0?a:1-a;return"YY"===e?S(o%100,2):"Yo"===e?n.ordinalNumber(o,{unit:"year"}):S(o,e.length)},R:function(t,e){return S(w(t),e.length)},u:function(t,e){return S(t.getUTCFullYear(),e.length)},Q:function(t,e,n){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return S(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return S(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){var r=t.getUTCMonth();switch(e){case"M":case"MM":return k(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){var r=t.getUTCMonth();switch(e){case"L":return String(r+1);case"LL":return S(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){var o=function(t,e){a(1,arguments);var n=i(t),r=p(n,e).getTime()-C(n,e).getTime();return Math.round(r/M)+1}(t,r);return"wo"===e?n.ordinalNumber(o,{unit:"week"}):S(o,e.length)},I:function(t,e,n){var r=function(t){a(1,arguments);var e=i(t),n=v(e).getTime()-b(e).getTime();return Math.round(n/y)+1}(t);return"Io"===e?n.ordinalNumber(r,{unit:"week"}):S(r,e.length)},d:function(t,e,n){return"do"===e?n.ordinalNumber(t.getUTCDate(),{unit:"date"}):x(t,e)},D:function(t,e,n){var r=function(t){a(1,arguments);var e=i(t),n=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var r=e.getTime(),o=n-r;return Math.floor(o/g)+1}(t);return"Do"===e?n.ordinalNumber(r,{unit:"dayOfYear"}):S(r,e.length)},E:function(t,e,n){var r=t.getUTCDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){var a=t.getUTCDay(),o=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return S(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){var a=t.getUTCDay(),o=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return S(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){var r=t.getUTCDay(),a=0===r?7:r;switch(e){case"i":return String(a);case"ii":return S(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,n){var r,a=t.getUTCHours();switch(r=12===a?L:0===a?N:a/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,n){var r,a=t.getUTCHours();switch(r=a>=17?j:a>=12?F:a>=4?Y:q,e){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,n){if("ho"===e){var r=t.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return U(t,e)},H:function(t,e,n){return"Ho"===e?n.ordinalNumber(t.getUTCHours(),{unit:"hour"}):P(t,e)},K:function(t,e,n){var r=t.getUTCHours()%12;return"Ko"===e?n.ordinalNumber(r,{unit:"hour"}):S(r,e.length)},k:function(t,e,n){var r=t.getUTCHours();return 0===r&&(r=24),"ko"===e?n.ordinalNumber(r,{unit:"hour"}):S(r,e.length)},m:function(t,e,n){return"mo"===e?n.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):W(t,e)},s:function(t,e,n){return"so"===e?n.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):E(t,e)},S:function(t,e){return O(t,e)},X:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();if(0===a)return"Z";switch(e){case"X":return G(a);case"XXXX":case"XX":return H(a);default:return H(a,":")}},x:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"x":return G(a);case"xxxx":case"xx":return H(a);default:return H(a,":")}},O:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+R(a,":");default:return"GMT"+H(a,":")}},z:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+R(a,":");default:return"GMT"+H(a,":")}},t:function(t,e,n,r){var a=r._originalDate||t;return S(Math.floor(a.getTime()/1e3),e.length)},T:function(t,e,n,r){return S((r._originalDate||t).getTime(),e.length)}};function R(t,e){var n=t>0?"-":"+",r=Math.abs(t),a=Math.floor(r/60),o=r%60;if(0===o)return n+String(a);var i=e||"";return n+String(a)+i+S(o,2)}function G(t,e){return t%60==0?(t>0?"-":"+")+S(Math.abs(t)/60,2):H(t,e)}function H(t,e){var n=e||"",r=t>0?"-":"+",a=Math.abs(t);return r+S(Math.floor(a/60),2)+n+S(a%60,2)}var z=A,B=function(t,e){switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Q=function(t,e){switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},X={p:Q,P:function(t,e){var n,r=t.match(/(P+)(p+)?/)||[],a=r[1],o=r[2];if(!o)return B(t,e);switch(a){case"P":n=e.dateTime({width:"short"});break;case"PP":n=e.dateTime({width:"medium"});break;case"PPP":n=e.dateTime({width:"long"});break;default:n=e.dateTime({width:"full"})}return n.replace("{{date}}",B(a,e)).replace("{{time}}",Q(o,e))}},I=X,$=["D","DD"],J=["YY","YYYY"];function _(t){return-1!==$.indexOf(t)}function V(t){return-1!==J.indexOf(t)}function K(t,e,n){if("YYYY"===t)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===t)throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===t)throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===t)throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Z={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function tt(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.width?String(e.width):t.defaultWidth,r=t.formats[n]||t.formats[t.defaultWidth];return r}}var et={date:tt({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:tt({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:tt({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},nt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function rt(t){return function(e,n){var r;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&t.formattingValues){var a=t.defaultFormattingWidth||t.defaultWidth,o=null!=n&&n.width?String(n.width):a;r=t.formattingValues[o]||t.formattingValues[a]}else{var i=t.defaultWidth,u=null!=n&&n.width?String(n.width):t.defaultWidth;r=t.values[u]||t.values[i]}return r[t.argumentCallback?t.argumentCallback(e):e]}}function at(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=e.match(a);if(!o)return null;var i,u=o[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(s)?it(s,(function(t){return t.test(u)})):ot(s,(function(t){return t.test(u)}));i=t.valueCallback?t.valueCallback(l):l,i=n.valueCallback?n.valueCallback(i):i;var d=e.slice(u.length);return{value:i,rest:d}}}function ot(t,e){for(var n in t)if(t.hasOwnProperty(n)&&e(t[n]))return n}function it(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n}var ut,st={code:"en-US",formatDistance:function(t,e,n){var r,a=Z[t];return r="string"==typeof a?a:1===e?a.one:a.other.replace("{{count}}",e.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:et,formatRelative:function(t,e,n,r){return nt[t]},localize:{ordinalNumber:function(t,e){var n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:rt({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:rt({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:rt({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:rt({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:rt({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(ut={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.match(ut.matchPattern);if(!n)return null;var r=n[0],a=t.match(ut.parsePattern);if(!a)return null;var o=ut.valueCallback?ut.valueCallback(a[0]):a[0];o=e.valueCallback?e.valueCallback(o):o;var i=t.slice(r.length);return{value:o,rest:i}}),era:at({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:at({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:at({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:at({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:at({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},lt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,dt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ct=/^'([^]*?)'?$/,ft=/''/g,ht=/[a-zA-Z]/;function mt(t,e,n){var o,u,s,c,f,g,v,w,b,y,p,T,C,M,S,D,k,x;a(2,arguments);var U=String(e),P=l(),W=null!==(o=null!==(u=null==n?void 0:n.locale)&&void 0!==u?u:P.locale)&&void 0!==o?o:st,E=r(null!==(s=null!==(c=null!==(f=null!==(g=null==n?void 0:n.firstWeekContainsDate)&&void 0!==g?g:null==n||null===(v=n.locale)||void 0===v||null===(w=v.options)||void 0===w?void 0:w.firstWeekContainsDate)&&void 0!==f?f:P.firstWeekContainsDate)&&void 0!==c?c:null===(b=P.locale)||void 0===b||null===(y=b.options)||void 0===y?void 0:y.firstWeekContainsDate)&&void 0!==s?s:1);if(!(E>=1&&E<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var O=r(null!==(p=null!==(T=null!==(C=null!==(M=null==n?void 0:n.weekStartsOn)&&void 0!==M?M:null==n||null===(S=n.locale)||void 0===S||null===(D=S.options)||void 0===D?void 0:D.weekStartsOn)&&void 0!==C?C:P.weekStartsOn)&&void 0!==T?T:null===(k=P.locale)||void 0===k||null===(x=k.options)||void 0===x?void 0:x.weekStartsOn)&&void 0!==p?p:0);if(!(O>=0&&O<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!W.localize)throw new RangeError("locale must contain localize property");if(!W.formatLong)throw new RangeError("locale must contain formatLong property");var N=i(t);if(!h(N))throw new RangeError("Invalid time value");var L=d(N),Y=m(N,L),F={firstWeekContainsDate:E,weekStartsOn:O,locale:W,_originalDate:N},j=U.match(dt).map((function(t){var e=t[0];return"p"===e||"P"===e?(0,I[e])(t,W.formatLong):t})).join("").match(lt).map((function(r){if("''"===r)return"'";var a=r[0];if("'"===a)return gt(r);var o=z[a];if(o)return null!=n&&n.useAdditionalWeekYearTokens||!V(r)||K(r,e,String(t)),null!=n&&n.useAdditionalDayOfYearTokens||!_(r)||K(r,e,String(t)),o(Y,r,W.localize,F);if(a.match(ht))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return r})).join("");return j}function gt(t){var e=t.match(ct);return e?e[1].replace(ft,"'"):t}const vt=t=>"string"==typeof t||"[object String]"===(t=>Object.prototype.toString.call(t))(t),wt=Array.isArray,bt=Number.isInteger,yt=(t,e)=>{let n=null;bt(e)&&(e={wait:e});const{immediate:r,wait:a=100}=e||{};return(...e)=>{n&&clearTimeout(n),r&&!n&&t(...e),n=setTimeout((()=>{t(...e)}),a)}};var pt,Tt,Ct,Mt,St,Dt,kt,xt,Ut,Pt,Wt,Et=()=>{};class Ot{static get cache(){return t(Ot,Tt,"f",Ct)}get defaultLogFile(){return`logs/${mt(Date.now(),"yyyy-MM-dd")}.log`}constructor(){pt.add(this),this.lastWrite=Date.now(),Mt.set(this,void 0),St.set(this,void 0),e(this,Mt,new Map,"f"),Promise.all([import("fs"),import("path")]).then((([t,e])=>{if(!t)return null;const{existsSync:n,mkdirSync:r,writeFile:a}=t,{sep:o,resolve:i,join:u,dirname:s}=e;return{existsSync:n,mkdirSync:r,writeFile:a,join:u,sep:o,resolve:i,dirname:s}})).then((t=>{e(this,St,t,"f")}))}push(e,n){var r;let a=n.file||this.defaultLogFile;if(n.groupByLevel){const t=e.prefix||[],n=null===(r=t.splice(1,1))||void 0===r?void 0:r[0];a=a.replace(/\.log$/,`.${n.replace(/\[|\]/g,"").toLowerCase()}.log`),e.prefix=t}let o=t(this,Mt,"f").get(a);o||(o={Set:new Set,writer:yt((t=>this.flush(t)),1e3)},t(this,Mt,"f").set(a,o));const i=Date.now();o.Set.add(e).size>1e3||i-this.lastWrite>3e4?this.flush(a):o.writer(a)}flush(e){t(this,St,"f")&&t(this,Mt,"f").forEach(((n,r)=>{if(n&&(null===e&&r===this.defaultLogFile||!e||r===e)){const e=Array.from(n.Set);n.Set.clear(),t(this,pt,"m",kt).call(this,r,e),this.lastWrite=Date.now()}}))}}Tt=Ot,Mt=new WeakMap,St=new WeakMap,pt=new WeakSet,Dt=function(e){var n,r;const a=(null===(r=null===(n=t(this,St,"f"))||void 0===n?void 0:n.dirname)||void 0===r?void 0:r.call(n,e||this.defaultLogFile))||"",{existsSync:o,mkdirSync:i}=t(this,St,"f")||{};(null==o?void 0:o(a))||null==i||i(a)},kt=function(e,n){if(wt(n)||(n=[n]),!e)throw new Error("output log file is missed");t(this,pt,"m",Dt).call(this,e);const{writeFile:r}=t(this,St,"f")||{};if(e&&r){const t=n.reduce(((t,{prefix:e=[],data:n})=>[...t,[...e,...n.map(JSON.stringify),"\n"].join(" ")]),[]);null==r||r(e,t.join(""),{flag:"a"},Et)}},Ct={value:new Ot},(Ut=xt||(xt={})).ALL="all",Ut.PRODUCTION="production",Ut.DEVELOPMENET="development",Ut.NONE="none",(Wt=Pt||(Pt={})).LOG="LOG",Wt.WARN="WARN",Wt.INFO="INFO",Wt.ERROR="ERROR",Wt.DEBUG="DEBUG";const Nt={date:!0,env:xt.ALL},Lt=(t,e)=>{const{date:n}=e,r=[];if(t.length&&r.unshift(t.map((t=>`[${t.toUpperCase()}]`)).join(" ")),n){const t=new Date;let e;e=vt(n)?mt(t,n):new Date(t).toISOString(),r.unshift(e)}return r},Yt=t=>("all"===t||process.env.NODE_ENV===t)&&void 0!==console,Ft=(t,e)=>{wt(t)||(t=[t]);const{env:n,outputFile:r,output:a,levels:o=[],...i}={...Nt,...e||{}},u=vt(a)?{file:a}:a||{file:r};return{debug:(...e)=>{const[r,...a]=Lt(t,{...i}),s=[r,`[${Pt.DEBUG}]`,...a];Yt(n||xt.ALL)&&console.debug(...s,...e),(null==o?void 0:o.length)&&!o.includes(Pt.DEBUG)||Ot.cache.push({prefix:s,data:[...e]},u)},info:(...e)=>{const[r,...a]=Lt(t,{...i}),s=[r,`[${Pt.INFO}]`,...a];Yt(n||xt.ALL)&&console.info(...s,...e),(null==o?void 0:o.length)&&!o.includes(Pt.INFO)||Ot.cache.push({prefix:s,data:[...e]},u)},log:(...e)=>{const[r,...a]=Lt(t,{...i}),s=[r,`[${Pt.LOG}]`,...a];Yt(n||xt.ALL)&&console.log(...s,...e),(null==o?void 0:o.length)&&!o.includes(Pt.LOG)||Ot.cache.push({prefix:s,data:[...e]},u)},warn:(...e)=>{const[r,...a]=Lt(t,{...i}),s=[r,`[${Pt.WARN}]`,...a],{disableError:l}=i,d=l?console.debug:console.warn;Yt(n||xt.ALL)&&d(...s,...e),(null==o?void 0:o.length)&&!o.includes(Pt.WARN)||Ot.cache.push({prefix:s,data:[...e]},u)},error:(e,r)=>{const[a,...s]=Lt(t,{...i}),l=[a,`[${Pt.ERROR}]`,...s],{disableThrow:d,ignoreThrow:c,disableError:f}=i,h=f?console.debug:console.error;if(Yt(n||xt.ALL)&&h(...l,e),(null==o?void 0:o.length)&&!o.includes(Pt.ERROR)||Ot.cache.push({prefix:l,data:[e]},u),!1===c||!1===d)throw new Error(e,{cause:r})}}},jt=Ft;exports.loggerWithTags=Ft,exports.withTags=jt;
package/lib/index.d.ts CHANGED
@@ -3,8 +3,17 @@
3
3
  * @default LogMode.ALL
4
4
  */
5
5
  declare enum LogMode {
6
+ /**
7
+ * 默认,所有模式下都会打印输出
8
+ */
6
9
  ALL = "all",
10
+ /**
11
+ * 仅开发模式启用日志打印输出
12
+ */
7
13
  PRODUCTION = "production",
14
+ /**
15
+ * 仅生产模式下启用日志打印输出
16
+ */
8
17
  DEVELOPMENET = "development",
9
18
  NONE = "none"
10
19
  }
@@ -20,6 +29,16 @@ declare enum LogLevel {
20
29
  }
21
30
  /** 日志标签 */
22
31
  type LogTags = string | string[];
32
+ type LogOutputOptions = {
33
+ /**
34
+ * 基于当前工程根目录下的日志输出文件
35
+ */
36
+ file: string;
37
+ /**
38
+ * 日志文件是否按日志级别分组,如果设置分组,则在日志文件中不在输出表示级别的tag:[LOG][INFO][WARN][ERROR]等,日志文件名称对应添加*.(log|info|warn|error).log
39
+ */
40
+ groupByLevel?: boolean;
41
+ };
23
42
  /** 日志配置选项 */
24
43
  interface ILogOptions {
25
44
  /** 日志级别
@@ -64,8 +83,10 @@ interface ILogOptions {
64
83
  * 浏览器环境:自动忽略该选项;
65
84
  *
66
85
  * node环境下默认 logs/xxx.log
86
+ * @deprecated 由output代替
67
87
  */
68
88
  outputFile?: string;
89
+ output?: string | LogOutputOptions;
69
90
  }
70
91
  interface ILogger {
71
92
  debug: (...rest: any[]) => void;
@@ -75,6 +96,19 @@ interface ILogger {
75
96
  error: (msg: string) => void;
76
97
  }
77
98
 
99
+ /**
100
+ * 出口方法,
101
+ * @param tags 标签或标签列表,统一转换为大写输出
102
+ * @param options ILogOptions
103
+ * @returns
104
+ * @deprecated 由 withTags代替
105
+ */
78
106
  declare const loggerWithTags: (tags: LogTags, options?: ILogOptions) => ILogger;
107
+ /**
108
+ * 新增总出口方法,原方法loggerWithTags废弃
109
+ * @param options ILogOptions
110
+ * @returns
111
+ */
112
+ declare const withTags: (tags: LogTags, options?: ILogOptions) => ILogger;
79
113
 
80
- export { loggerWithTags };
114
+ export { loggerWithTags, withTags };
package/lib/index.mjs CHANGED
@@ -1 +1 @@
1
- function t(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function e(t,e,n,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(t,n):a?a.value=n:e.set(t,n),n}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t){if(null===t||!0===t||!1===t)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function a(t,e){if(e.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+e.length+" present")}function i(t){return i="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":n(t)},i(t)}function o(t){a(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||"object"===i(t)&&"[object Date]"===e?new Date(t.getTime()):"number"==typeof t||"[object Number]"===e?new Date(t):("string"!=typeof t&&"[object String]"!==e||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function u(t,e){a(2,arguments);var n=o(t).getTime(),i=r(e);return new Date(n+i)}var s={};function l(){return s}function d(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}function c(t){return c="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":n(t)},c(t)}function h(t){return a(1,arguments),t instanceof Date||"object"===c(t)&&"[object Date]"===Object.prototype.toString.call(t)}function f(t){if(a(1,arguments),!h(t)&&"number"!=typeof t)return!1;var e=o(t);return!isNaN(Number(e))}function m(t,e){a(2,arguments);var n=r(e);return u(t,-n)}var g=864e5;function w(t){a(1,arguments);var e=1,n=o(t),r=n.getUTCDay(),i=(r<e?7:0)+r-e;return n.setUTCDate(n.getUTCDate()-i),n.setUTCHours(0,0,0,0),n}function v(t){a(1,arguments);var e=o(t),n=e.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var i=w(r),u=new Date(0);u.setUTCFullYear(n,0,4),u.setUTCHours(0,0,0,0);var s=w(u);return e.getTime()>=i.getTime()?n+1:e.getTime()>=s.getTime()?n:n-1}function b(t){a(1,arguments);var e=v(t),n=new Date(0);n.setUTCFullYear(e,0,4),n.setUTCHours(0,0,0,0);var r=w(n);return r}var y=6048e5;function p(t,e){var n,i,u,s,d,c,h,f;a(1,arguments);var m=l(),g=r(null!==(n=null!==(i=null!==(u=null!==(s=null==e?void 0:e.weekStartsOn)&&void 0!==s?s:null==e||null===(d=e.locale)||void 0===d||null===(c=d.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==u?u:m.weekStartsOn)&&void 0!==i?i:null===(h=m.locale)||void 0===h||null===(f=h.options)||void 0===f?void 0:f.weekStartsOn)&&void 0!==n?n:0);if(!(g>=0&&g<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var w=o(t),v=w.getUTCDay(),b=(v<g?7:0)+v-g;return w.setUTCDate(w.getUTCDate()-b),w.setUTCHours(0,0,0,0),w}function T(t,e){var n,i,u,s,d,c,h,f;a(1,arguments);var m=o(t),g=m.getUTCFullYear(),w=l(),v=r(null!==(n=null!==(i=null!==(u=null!==(s=null==e?void 0:e.firstWeekContainsDate)&&void 0!==s?s:null==e||null===(d=e.locale)||void 0===d||null===(c=d.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==u?u:w.firstWeekContainsDate)&&void 0!==i?i:null===(h=w.locale)||void 0===h||null===(f=h.options)||void 0===f?void 0:f.firstWeekContainsDate)&&void 0!==n?n:1);if(!(v>=1&&v<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var b=new Date(0);b.setUTCFullYear(g+1,0,v),b.setUTCHours(0,0,0,0);var y=p(b,e),T=new Date(0);T.setUTCFullYear(g,0,v),T.setUTCHours(0,0,0,0);var C=p(T,e);return m.getTime()>=y.getTime()?g+1:m.getTime()>=C.getTime()?g:g-1}function C(t,e){var n,i,o,u,s,d,c,h;a(1,arguments);var f=l(),m=r(null!==(n=null!==(i=null!==(o=null!==(u=null==e?void 0:e.firstWeekContainsDate)&&void 0!==u?u:null==e||null===(s=e.locale)||void 0===s||null===(d=s.options)||void 0===d?void 0:d.firstWeekContainsDate)&&void 0!==o?o:f.firstWeekContainsDate)&&void 0!==i?i:null===(c=f.locale)||void 0===c||null===(h=c.options)||void 0===h?void 0:h.firstWeekContainsDate)&&void 0!==n?n:1),g=T(t,e),w=new Date(0);w.setUTCFullYear(g,0,m),w.setUTCHours(0,0,0,0);var v=p(w,e);return v}var M=6048e5;function D(t,e){for(var n=t<0?"-":"",r=Math.abs(t).toString();r.length<e;)r="0"+r;return n+r}var S=function(t,e){var n=t.getUTCFullYear(),r=n>0?n:1-n;return D("yy"===e?r%100:r,e.length)},k=function(t,e){var n=t.getUTCMonth();return"M"===e?String(n+1):D(n+1,2)},x=function(t,e){return D(t.getUTCDate(),e.length)},U=function(t,e){return D(t.getUTCHours()%12||12,e.length)},P=function(t,e){return D(t.getUTCHours(),e.length)},W=function(t,e){return D(t.getUTCMinutes(),e.length)},E=function(t,e){return D(t.getUTCSeconds(),e.length)},O=function(t,e){var n=e.length,r=t.getUTCMilliseconds();return D(Math.floor(r*Math.pow(10,n-3)),e.length)},N="midnight",Y="noon",L="morning",F="afternoon",j="evening",q="night",A={G:function(t,e,n){var r=t.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if("yo"===e){var r=t.getUTCFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return S(t,e)},Y:function(t,e,n,r){var a=T(t,r),i=a>0?a:1-a;return"YY"===e?D(i%100,2):"Yo"===e?n.ordinalNumber(i,{unit:"year"}):D(i,e.length)},R:function(t,e){return D(v(t),e.length)},u:function(t,e){return D(t.getUTCFullYear(),e.length)},Q:function(t,e,n){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return D(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return D(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){var r=t.getUTCMonth();switch(e){case"M":case"MM":return k(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){var r=t.getUTCMonth();switch(e){case"L":return String(r+1);case"LL":return D(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){var i=function(t,e){a(1,arguments);var n=o(t),r=p(n,e).getTime()-C(n,e).getTime();return Math.round(r/M)+1}(t,r);return"wo"===e?n.ordinalNumber(i,{unit:"week"}):D(i,e.length)},I:function(t,e,n){var r=function(t){a(1,arguments);var e=o(t),n=w(e).getTime()-b(e).getTime();return Math.round(n/y)+1}(t);return"Io"===e?n.ordinalNumber(r,{unit:"week"}):D(r,e.length)},d:function(t,e,n){return"do"===e?n.ordinalNumber(t.getUTCDate(),{unit:"date"}):x(t,e)},D:function(t,e,n){var r=function(t){a(1,arguments);var e=o(t),n=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var r=e.getTime(),i=n-r;return Math.floor(i/g)+1}(t);return"Do"===e?n.ordinalNumber(r,{unit:"dayOfYear"}):D(r,e.length)},E:function(t,e,n){var r=t.getUTCDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){var a=t.getUTCDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return D(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){var a=t.getUTCDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return D(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){var r=t.getUTCDay(),a=0===r?7:r;switch(e){case"i":return String(a);case"ii":return D(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,n){var r,a=t.getUTCHours();switch(r=12===a?Y:0===a?N:a/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,n){var r,a=t.getUTCHours();switch(r=a>=17?j:a>=12?F:a>=4?L:q,e){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,n){if("ho"===e){var r=t.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return U(t,e)},H:function(t,e,n){return"Ho"===e?n.ordinalNumber(t.getUTCHours(),{unit:"hour"}):P(t,e)},K:function(t,e,n){var r=t.getUTCHours()%12;return"Ko"===e?n.ordinalNumber(r,{unit:"hour"}):D(r,e.length)},k:function(t,e,n){var r=t.getUTCHours();return 0===r&&(r=24),"ko"===e?n.ordinalNumber(r,{unit:"hour"}):D(r,e.length)},m:function(t,e,n){return"mo"===e?n.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):W(t,e)},s:function(t,e,n){return"so"===e?n.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):E(t,e)},S:function(t,e){return O(t,e)},X:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();if(0===a)return"Z";switch(e){case"X":return G(a);case"XXXX":case"XX":return H(a);default:return H(a,":")}},x:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"x":return G(a);case"xxxx":case"xx":return H(a);default:return H(a,":")}},O:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+R(a,":");default:return"GMT"+H(a,":")}},z:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+R(a,":");default:return"GMT"+H(a,":")}},t:function(t,e,n,r){var a=r._originalDate||t;return D(Math.floor(a.getTime()/1e3),e.length)},T:function(t,e,n,r){return D((r._originalDate||t).getTime(),e.length)}};function R(t,e){var n=t>0?"-":"+",r=Math.abs(t),a=Math.floor(r/60),i=r%60;if(0===i)return n+String(a);var o=e||"";return n+String(a)+o+D(i,2)}function G(t,e){return t%60==0?(t>0?"-":"+")+D(Math.abs(t)/60,2):H(t,e)}function H(t,e){var n=e||"",r=t>0?"-":"+",a=Math.abs(t);return r+D(Math.floor(a/60),2)+n+D(a%60,2)}var z=A,B=function(t,e){switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Q=function(t,e){switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},X={p:Q,P:function(t,e){var n,r=t.match(/(P+)(p+)?/)||[],a=r[1],i=r[2];if(!i)return B(t,e);switch(a){case"P":n=e.dateTime({width:"short"});break;case"PP":n=e.dateTime({width:"medium"});break;case"PPP":n=e.dateTime({width:"long"});break;default:n=e.dateTime({width:"full"})}return n.replace("{{date}}",B(a,e)).replace("{{time}}",Q(i,e))}},I=X,J=["D","DD"],$=["YY","YYYY"];function _(t){return-1!==J.indexOf(t)}function V(t){return-1!==$.indexOf(t)}function K(t,e,n){if("YYYY"===t)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===t)throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===t)throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===t)throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Z={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function tt(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.width?String(e.width):t.defaultWidth,r=t.formats[n]||t.formats[t.defaultWidth];return r}}var et={date:tt({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:tt({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:tt({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},nt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function rt(t){return function(e,n){var r;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&t.formattingValues){var a=t.defaultFormattingWidth||t.defaultWidth,i=null!=n&&n.width?String(n.width):a;r=t.formattingValues[i]||t.formattingValues[a]}else{var o=t.defaultWidth,u=null!=n&&n.width?String(n.width):t.defaultWidth;r=t.values[u]||t.values[o]}return r[t.argumentCallback?t.argumentCallback(e):e]}}function at(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(a);if(!i)return null;var o,u=i[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(s)?ot(s,(function(t){return t.test(u)})):it(s,(function(t){return t.test(u)}));o=t.valueCallback?t.valueCallback(l):l,o=n.valueCallback?n.valueCallback(o):o;var d=e.slice(u.length);return{value:o,rest:d}}}function it(t,e){for(var n in t)if(t.hasOwnProperty(n)&&e(t[n]))return n}function ot(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n}var ut,st={code:"en-US",formatDistance:function(t,e,n){var r,a=Z[t];return r="string"==typeof a?a:1===e?a.one:a.other.replace("{{count}}",e.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:et,formatRelative:function(t,e,n,r){return nt[t]},localize:{ordinalNumber:function(t,e){var n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:rt({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:rt({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:rt({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:rt({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:rt({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(ut={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.match(ut.matchPattern);if(!n)return null;var r=n[0],a=t.match(ut.parsePattern);if(!a)return null;var i=ut.valueCallback?ut.valueCallback(a[0]):a[0];i=e.valueCallback?e.valueCallback(i):i;var o=t.slice(r.length);return{value:i,rest:o}}),era:at({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:at({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:at({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:at({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:at({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},lt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,dt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ct=/^'([^]*?)'?$/,ht=/''/g,ft=/[a-zA-Z]/;function mt(t,e,n){var i,u,s,c,h,g,w,v,b,y,p,T,C,M,D,S,k,x;a(2,arguments);var U=String(e),P=l(),W=null!==(i=null!==(u=null==n?void 0:n.locale)&&void 0!==u?u:P.locale)&&void 0!==i?i:st,E=r(null!==(s=null!==(c=null!==(h=null!==(g=null==n?void 0:n.firstWeekContainsDate)&&void 0!==g?g:null==n||null===(w=n.locale)||void 0===w||null===(v=w.options)||void 0===v?void 0:v.firstWeekContainsDate)&&void 0!==h?h:P.firstWeekContainsDate)&&void 0!==c?c:null===(b=P.locale)||void 0===b||null===(y=b.options)||void 0===y?void 0:y.firstWeekContainsDate)&&void 0!==s?s:1);if(!(E>=1&&E<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var O=r(null!==(p=null!==(T=null!==(C=null!==(M=null==n?void 0:n.weekStartsOn)&&void 0!==M?M:null==n||null===(D=n.locale)||void 0===D||null===(S=D.options)||void 0===S?void 0:S.weekStartsOn)&&void 0!==C?C:P.weekStartsOn)&&void 0!==T?T:null===(k=P.locale)||void 0===k||null===(x=k.options)||void 0===x?void 0:x.weekStartsOn)&&void 0!==p?p:0);if(!(O>=0&&O<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!W.localize)throw new RangeError("locale must contain localize property");if(!W.formatLong)throw new RangeError("locale must contain formatLong property");var N=o(t);if(!f(N))throw new RangeError("Invalid time value");var Y=d(N),L=m(N,Y),F={firstWeekContainsDate:E,weekStartsOn:O,locale:W,_originalDate:N},j=U.match(dt).map((function(t){var e=t[0];return"p"===e||"P"===e?(0,I[e])(t,W.formatLong):t})).join("").match(lt).map((function(r){if("''"===r)return"'";var a=r[0];if("'"===a)return gt(r);var i=z[a];if(i)return null!=n&&n.useAdditionalWeekYearTokens||!V(r)||K(r,e,String(t)),null!=n&&n.useAdditionalDayOfYearTokens||!_(r)||K(r,e,String(t)),i(L,r,W.localize,F);if(a.match(ft))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return r})).join("");return j}function gt(t){var e=t.match(ct);return e?e[1].replace(ht,"'"):t}const wt=t=>"string"==typeof t||"[object String]"===(t=>Object.prototype.toString.call(t))(t),vt=Array.isArray,bt=Number.isInteger;var yt,pt,Tt,Ct,Mt,Dt,St,kt,xt,Ut,Pt,Wt=()=>{};class Et{static get cache(){return t(Et,pt,"f",Tt)}get defaultLogFile(){return`logs/${mt(Date.now(),"yyyy-MM-dd")}.log`}constructor(){yt.add(this),this.lastWrite=Date.now(),Ct.set(this,void 0),Mt.set(this,void 0),this.write=((t,e)=>{let n=null;bt(e)&&(e={wait:e});const{immediate:r,wait:a=100}=e||{};return(...e)=>{n&&clearTimeout(n),r&&!n&&t(...e),n=setTimeout((()=>{t(...e)}),a)}})((t=>this.flush(t)),1e3),e(this,Ct,new Map,"f"),Promise.all([import("fs"),import("path")]).then((([t,e])=>{if(!t)return null;const{existsSync:n,mkdirSync:r,writeFile:a}=t,{sep:i,resolve:o,join:u,dirname:s}=e;return{existsSync:n,mkdirSync:r,writeFile:a,join:u,sep:i,resolve:o,dirname:s}})).then((t=>{e(this,Mt,t,"f")}))}push(e,n){n=n||this.defaultLogFile;let r=t(this,Ct,"f").get(n);r||(r=new Set,t(this,Ct,"f").set(n,r));const a=Date.now();r.add(e).size>1e3||a-this.lastWrite>3e4?this.flush(n):this.write(n)}flush(e){t(this,Mt,"f")&&t(this,Ct,"f").forEach(((n,r)=>{if(n&&(null===e&&r===this.defaultLogFile||!e||r===e)){const e=Array.from(n);n.clear(),t(this,yt,"m",St).call(this,r,e),this.lastWrite=Date.now()}}))}}pt=Et,Ct=new WeakMap,Mt=new WeakMap,yt=new WeakSet,Dt=function(e){var n,r;const a=(null===(r=null===(n=t(this,Mt,"f"))||void 0===n?void 0:n.dirname)||void 0===r?void 0:r.call(n,e||this.defaultLogFile))||"",{existsSync:i,mkdirSync:o}=t(this,Mt,"f")||{};(null==i?void 0:i(a))||null==o||o(a)},St=function(e,n){vt(n)||(n=[n]),e=e||this.defaultLogFile,t(this,yt,"m",Dt).call(this,e);const{writeFile:r}=t(this,Mt,"f")||{};if(e&&r){const t=n.reduce(((t,{prefix:e=[],data:n})=>[...t,[...e,...n.map(JSON.stringify),"\n"].join(" ")]),[]);null==r||r(e,t.join(""),{flag:"a"},Wt)}},Tt={value:new Et},(xt=kt||(kt={})).ALL="all",xt.PRODUCTION="production",xt.DEVELOPMENET="development",xt.NONE="none",(Pt=Ut||(Ut={})).LOG="LOG",Pt.WARN="WARN",Pt.INFO="INFO",Pt.ERROR="ERROR",Pt.DEBUG="DEBUG";const Ot={date:!0,env:kt.ALL},Nt=(t,e)=>{const{date:n}=e,r=[];if(t.length&&r.unshift(t.map((t=>`[${t.toUpperCase()}]`)).join(" ")),n){const t=new Date;let e;e=wt(n)?mt(t,n):new Date(t).toISOString(),r.unshift(e)}return r},Yt=t=>("all"===t||process.env.NODE_ENV===t)&&void 0!==console,Lt=(t,e)=>{vt(t)||(t=[t]);const{env:n,outputFile:r,levels:a=[],...i}={...Ot,...e||{}};return{debug:(...e)=>{const o=Nt(t,{...i});o.unshift(`[${Ut.DEBUG}]\t`),Yt(n||kt.ALL)&&console.debug(...o,...e),(null==a?void 0:a.length)&&!a.includes(Ut.DEBUG)||Et.cache.push({prefix:o,timestamp:Date.now(),data:[...e]},r)},info:(...e)=>{const o=Nt(t,{...i});o.unshift(`[${Ut.INFO}]\t`),Yt(n||kt.ALL)&&console.info(...o,...e),(null==a?void 0:a.length)&&!a.includes(Ut.INFO)||Et.cache.push({prefix:o,timestamp:Date.now(),data:[...e]},r)},log:(...e)=>{const o=Nt(t,i);o.unshift(`[${Ut.LOG}]\t`),Yt(n||kt.ALL)&&console.log(...o,...e),(null==a?void 0:a.length)&&!a.includes(Ut.LOG)||Et.cache.push({prefix:o,timestamp:Date.now(),data:[...e]},r)},warn:(...e)=>{const o=Nt(t,{...i});o.unshift(`[${Ut.WARN}]\t`);const{disableError:u}=i,s=u?console.debug:console.warn;Yt(n||kt.ALL)&&s(...o,...e),(null==a?void 0:a.length)&&!a.includes(Ut.WARN)||Et.cache.push({prefix:o,timestamp:Date.now(),data:[...e]},r)},error:(e,o)=>{const u=Nt(t,{...i});u.unshift(`[${Ut.ERROR}]\t`);const{disableThrow:s,ignoreThrow:l,disableError:d}=i,c=d?console.debug:console.error;if(Yt(n||kt.ALL)&&c(...u,e),(null==a?void 0:a.length)&&!a.includes(Ut.ERROR)||Et.cache.push({prefix:u,timestamp:Date.now(),data:[e]},r),!1===l||!1===s)throw new Error(e,{cause:o})}}};export{Lt as loggerWithTags};
1
+ function t(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function e(t,e,n,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(t,n):a?a.value=n:e.set(t,n),n}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t){if(null===t||!0===t||!1===t)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function a(t,e){if(e.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+e.length+" present")}function o(t){return o="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":n(t)},o(t)}function i(t){a(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||"object"===o(t)&&"[object Date]"===e?new Date(t.getTime()):"number"==typeof t||"[object Number]"===e?new Date(t):("string"!=typeof t&&"[object String]"!==e||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function u(t,e){a(2,arguments);var n=i(t).getTime(),o=r(e);return new Date(n+o)}var s={};function l(){return s}function d(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}function c(t){return c="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":n(t)},c(t)}function f(t){return a(1,arguments),t instanceof Date||"object"===c(t)&&"[object Date]"===Object.prototype.toString.call(t)}function h(t){if(a(1,arguments),!f(t)&&"number"!=typeof t)return!1;var e=i(t);return!isNaN(Number(e))}function m(t,e){a(2,arguments);var n=r(e);return u(t,-n)}var g=864e5;function v(t){a(1,arguments);var e=1,n=i(t),r=n.getUTCDay(),o=(r<e?7:0)+r-e;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}function w(t){a(1,arguments);var e=i(t),n=e.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=v(r),u=new Date(0);u.setUTCFullYear(n,0,4),u.setUTCHours(0,0,0,0);var s=v(u);return e.getTime()>=o.getTime()?n+1:e.getTime()>=s.getTime()?n:n-1}function b(t){a(1,arguments);var e=w(t),n=new Date(0);n.setUTCFullYear(e,0,4),n.setUTCHours(0,0,0,0);var r=v(n);return r}var y=6048e5;function p(t,e){var n,o,u,s,d,c,f,h;a(1,arguments);var m=l(),g=r(null!==(n=null!==(o=null!==(u=null!==(s=null==e?void 0:e.weekStartsOn)&&void 0!==s?s:null==e||null===(d=e.locale)||void 0===d||null===(c=d.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==u?u:m.weekStartsOn)&&void 0!==o?o:null===(f=m.locale)||void 0===f||null===(h=f.options)||void 0===h?void 0:h.weekStartsOn)&&void 0!==n?n:0);if(!(g>=0&&g<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var v=i(t),w=v.getUTCDay(),b=(w<g?7:0)+w-g;return v.setUTCDate(v.getUTCDate()-b),v.setUTCHours(0,0,0,0),v}function T(t,e){var n,o,u,s,d,c,f,h;a(1,arguments);var m=i(t),g=m.getUTCFullYear(),v=l(),w=r(null!==(n=null!==(o=null!==(u=null!==(s=null==e?void 0:e.firstWeekContainsDate)&&void 0!==s?s:null==e||null===(d=e.locale)||void 0===d||null===(c=d.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==u?u:v.firstWeekContainsDate)&&void 0!==o?o:null===(f=v.locale)||void 0===f||null===(h=f.options)||void 0===h?void 0:h.firstWeekContainsDate)&&void 0!==n?n:1);if(!(w>=1&&w<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var b=new Date(0);b.setUTCFullYear(g+1,0,w),b.setUTCHours(0,0,0,0);var y=p(b,e),T=new Date(0);T.setUTCFullYear(g,0,w),T.setUTCHours(0,0,0,0);var C=p(T,e);return m.getTime()>=y.getTime()?g+1:m.getTime()>=C.getTime()?g:g-1}function C(t,e){var n,o,i,u,s,d,c,f;a(1,arguments);var h=l(),m=r(null!==(n=null!==(o=null!==(i=null!==(u=null==e?void 0:e.firstWeekContainsDate)&&void 0!==u?u:null==e||null===(s=e.locale)||void 0===s||null===(d=s.options)||void 0===d?void 0:d.firstWeekContainsDate)&&void 0!==i?i:h.firstWeekContainsDate)&&void 0!==o?o:null===(c=h.locale)||void 0===c||null===(f=c.options)||void 0===f?void 0:f.firstWeekContainsDate)&&void 0!==n?n:1),g=T(t,e),v=new Date(0);v.setUTCFullYear(g,0,m),v.setUTCHours(0,0,0,0);var w=p(v,e);return w}var M=6048e5;function S(t,e){for(var n=t<0?"-":"",r=Math.abs(t).toString();r.length<e;)r="0"+r;return n+r}var D=function(t,e){var n=t.getUTCFullYear(),r=n>0?n:1-n;return S("yy"===e?r%100:r,e.length)},k=function(t,e){var n=t.getUTCMonth();return"M"===e?String(n+1):S(n+1,2)},x=function(t,e){return S(t.getUTCDate(),e.length)},U=function(t,e){return S(t.getUTCHours()%12||12,e.length)},P=function(t,e){return S(t.getUTCHours(),e.length)},W=function(t,e){return S(t.getUTCMinutes(),e.length)},E=function(t,e){return S(t.getUTCSeconds(),e.length)},O=function(t,e){var n=e.length,r=t.getUTCMilliseconds();return S(Math.floor(r*Math.pow(10,n-3)),e.length)},N="midnight",L="noon",Y="morning",F="afternoon",j="evening",q="night",A={G:function(t,e,n){var r=t.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if("yo"===e){var r=t.getUTCFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return D(t,e)},Y:function(t,e,n,r){var a=T(t,r),o=a>0?a:1-a;return"YY"===e?S(o%100,2):"Yo"===e?n.ordinalNumber(o,{unit:"year"}):S(o,e.length)},R:function(t,e){return S(w(t),e.length)},u:function(t,e){return S(t.getUTCFullYear(),e.length)},Q:function(t,e,n){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return S(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return S(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){var r=t.getUTCMonth();switch(e){case"M":case"MM":return k(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){var r=t.getUTCMonth();switch(e){case"L":return String(r+1);case"LL":return S(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){var o=function(t,e){a(1,arguments);var n=i(t),r=p(n,e).getTime()-C(n,e).getTime();return Math.round(r/M)+1}(t,r);return"wo"===e?n.ordinalNumber(o,{unit:"week"}):S(o,e.length)},I:function(t,e,n){var r=function(t){a(1,arguments);var e=i(t),n=v(e).getTime()-b(e).getTime();return Math.round(n/y)+1}(t);return"Io"===e?n.ordinalNumber(r,{unit:"week"}):S(r,e.length)},d:function(t,e,n){return"do"===e?n.ordinalNumber(t.getUTCDate(),{unit:"date"}):x(t,e)},D:function(t,e,n){var r=function(t){a(1,arguments);var e=i(t),n=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var r=e.getTime(),o=n-r;return Math.floor(o/g)+1}(t);return"Do"===e?n.ordinalNumber(r,{unit:"dayOfYear"}):S(r,e.length)},E:function(t,e,n){var r=t.getUTCDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){var a=t.getUTCDay(),o=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return S(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){var a=t.getUTCDay(),o=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return S(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){var r=t.getUTCDay(),a=0===r?7:r;switch(e){case"i":return String(a);case"ii":return S(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,n){var r,a=t.getUTCHours();switch(r=12===a?L:0===a?N:a/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,n){var r,a=t.getUTCHours();switch(r=a>=17?j:a>=12?F:a>=4?Y:q,e){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,n){if("ho"===e){var r=t.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return U(t,e)},H:function(t,e,n){return"Ho"===e?n.ordinalNumber(t.getUTCHours(),{unit:"hour"}):P(t,e)},K:function(t,e,n){var r=t.getUTCHours()%12;return"Ko"===e?n.ordinalNumber(r,{unit:"hour"}):S(r,e.length)},k:function(t,e,n){var r=t.getUTCHours();return 0===r&&(r=24),"ko"===e?n.ordinalNumber(r,{unit:"hour"}):S(r,e.length)},m:function(t,e,n){return"mo"===e?n.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):W(t,e)},s:function(t,e,n){return"so"===e?n.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):E(t,e)},S:function(t,e){return O(t,e)},X:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();if(0===a)return"Z";switch(e){case"X":return G(a);case"XXXX":case"XX":return H(a);default:return H(a,":")}},x:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"x":return G(a);case"xxxx":case"xx":return H(a);default:return H(a,":")}},O:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+R(a,":");default:return"GMT"+H(a,":")}},z:function(t,e,n,r){var a=(r._originalDate||t).getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+R(a,":");default:return"GMT"+H(a,":")}},t:function(t,e,n,r){var a=r._originalDate||t;return S(Math.floor(a.getTime()/1e3),e.length)},T:function(t,e,n,r){return S((r._originalDate||t).getTime(),e.length)}};function R(t,e){var n=t>0?"-":"+",r=Math.abs(t),a=Math.floor(r/60),o=r%60;if(0===o)return n+String(a);var i=e||"";return n+String(a)+i+S(o,2)}function G(t,e){return t%60==0?(t>0?"-":"+")+S(Math.abs(t)/60,2):H(t,e)}function H(t,e){var n=e||"",r=t>0?"-":"+",a=Math.abs(t);return r+S(Math.floor(a/60),2)+n+S(a%60,2)}var z=A,B=function(t,e){switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Q=function(t,e){switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},X={p:Q,P:function(t,e){var n,r=t.match(/(P+)(p+)?/)||[],a=r[1],o=r[2];if(!o)return B(t,e);switch(a){case"P":n=e.dateTime({width:"short"});break;case"PP":n=e.dateTime({width:"medium"});break;case"PPP":n=e.dateTime({width:"long"});break;default:n=e.dateTime({width:"full"})}return n.replace("{{date}}",B(a,e)).replace("{{time}}",Q(o,e))}},I=X,$=["D","DD"],J=["YY","YYYY"];function _(t){return-1!==$.indexOf(t)}function V(t){return-1!==J.indexOf(t)}function K(t,e,n){if("YYYY"===t)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===t)throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===t)throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===t)throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Z={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function tt(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.width?String(e.width):t.defaultWidth,r=t.formats[n]||t.formats[t.defaultWidth];return r}}var et={date:tt({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:tt({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:tt({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},nt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function rt(t){return function(e,n){var r;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&t.formattingValues){var a=t.defaultFormattingWidth||t.defaultWidth,o=null!=n&&n.width?String(n.width):a;r=t.formattingValues[o]||t.formattingValues[a]}else{var i=t.defaultWidth,u=null!=n&&n.width?String(n.width):t.defaultWidth;r=t.values[u]||t.values[i]}return r[t.argumentCallback?t.argumentCallback(e):e]}}function at(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=e.match(a);if(!o)return null;var i,u=o[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(s)?it(s,(function(t){return t.test(u)})):ot(s,(function(t){return t.test(u)}));i=t.valueCallback?t.valueCallback(l):l,i=n.valueCallback?n.valueCallback(i):i;var d=e.slice(u.length);return{value:i,rest:d}}}function ot(t,e){for(var n in t)if(t.hasOwnProperty(n)&&e(t[n]))return n}function it(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n}var ut,st={code:"en-US",formatDistance:function(t,e,n){var r,a=Z[t];return r="string"==typeof a?a:1===e?a.one:a.other.replace("{{count}}",e.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:et,formatRelative:function(t,e,n,r){return nt[t]},localize:{ordinalNumber:function(t,e){var n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:rt({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:rt({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:rt({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:rt({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:rt({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(ut={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.match(ut.matchPattern);if(!n)return null;var r=n[0],a=t.match(ut.parsePattern);if(!a)return null;var o=ut.valueCallback?ut.valueCallback(a[0]):a[0];o=e.valueCallback?e.valueCallback(o):o;var i=t.slice(r.length);return{value:o,rest:i}}),era:at({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:at({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:at({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:at({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:at({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},lt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,dt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ct=/^'([^]*?)'?$/,ft=/''/g,ht=/[a-zA-Z]/;function mt(t,e,n){var o,u,s,c,f,g,v,w,b,y,p,T,C,M,S,D,k,x;a(2,arguments);var U=String(e),P=l(),W=null!==(o=null!==(u=null==n?void 0:n.locale)&&void 0!==u?u:P.locale)&&void 0!==o?o:st,E=r(null!==(s=null!==(c=null!==(f=null!==(g=null==n?void 0:n.firstWeekContainsDate)&&void 0!==g?g:null==n||null===(v=n.locale)||void 0===v||null===(w=v.options)||void 0===w?void 0:w.firstWeekContainsDate)&&void 0!==f?f:P.firstWeekContainsDate)&&void 0!==c?c:null===(b=P.locale)||void 0===b||null===(y=b.options)||void 0===y?void 0:y.firstWeekContainsDate)&&void 0!==s?s:1);if(!(E>=1&&E<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var O=r(null!==(p=null!==(T=null!==(C=null!==(M=null==n?void 0:n.weekStartsOn)&&void 0!==M?M:null==n||null===(S=n.locale)||void 0===S||null===(D=S.options)||void 0===D?void 0:D.weekStartsOn)&&void 0!==C?C:P.weekStartsOn)&&void 0!==T?T:null===(k=P.locale)||void 0===k||null===(x=k.options)||void 0===x?void 0:x.weekStartsOn)&&void 0!==p?p:0);if(!(O>=0&&O<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!W.localize)throw new RangeError("locale must contain localize property");if(!W.formatLong)throw new RangeError("locale must contain formatLong property");var N=i(t);if(!h(N))throw new RangeError("Invalid time value");var L=d(N),Y=m(N,L),F={firstWeekContainsDate:E,weekStartsOn:O,locale:W,_originalDate:N},j=U.match(dt).map((function(t){var e=t[0];return"p"===e||"P"===e?(0,I[e])(t,W.formatLong):t})).join("").match(lt).map((function(r){if("''"===r)return"'";var a=r[0];if("'"===a)return gt(r);var o=z[a];if(o)return null!=n&&n.useAdditionalWeekYearTokens||!V(r)||K(r,e,String(t)),null!=n&&n.useAdditionalDayOfYearTokens||!_(r)||K(r,e,String(t)),o(Y,r,W.localize,F);if(a.match(ht))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return r})).join("");return j}function gt(t){var e=t.match(ct);return e?e[1].replace(ft,"'"):t}const vt=t=>"string"==typeof t||"[object String]"===(t=>Object.prototype.toString.call(t))(t),wt=Array.isArray,bt=Number.isInteger,yt=(t,e)=>{let n=null;bt(e)&&(e={wait:e});const{immediate:r,wait:a=100}=e||{};return(...e)=>{n&&clearTimeout(n),r&&!n&&t(...e),n=setTimeout((()=>{t(...e)}),a)}};var pt,Tt,Ct,Mt,St,Dt,kt,xt,Ut,Pt,Wt,Et=()=>{};class Ot{static get cache(){return t(Ot,Tt,"f",Ct)}get defaultLogFile(){return`logs/${mt(Date.now(),"yyyy-MM-dd")}.log`}constructor(){pt.add(this),this.lastWrite=Date.now(),Mt.set(this,void 0),St.set(this,void 0),e(this,Mt,new Map,"f"),Promise.all([import("fs"),import("path")]).then((([t,e])=>{if(!t)return null;const{existsSync:n,mkdirSync:r,writeFile:a}=t,{sep:o,resolve:i,join:u,dirname:s}=e;return{existsSync:n,mkdirSync:r,writeFile:a,join:u,sep:o,resolve:i,dirname:s}})).then((t=>{e(this,St,t,"f")}))}push(e,n){var r;let a=n.file||this.defaultLogFile;if(n.groupByLevel){const t=e.prefix||[],n=null===(r=t.splice(1,1))||void 0===r?void 0:r[0];a=a.replace(/\.log$/,`.${n.replace(/\[|\]/g,"").toLowerCase()}.log`),e.prefix=t}let o=t(this,Mt,"f").get(a);o||(o={Set:new Set,writer:yt((t=>this.flush(t)),1e3)},t(this,Mt,"f").set(a,o));const i=Date.now();o.Set.add(e).size>1e3||i-this.lastWrite>3e4?this.flush(a):o.writer(a)}flush(e){t(this,St,"f")&&t(this,Mt,"f").forEach(((n,r)=>{if(n&&(null===e&&r===this.defaultLogFile||!e||r===e)){const e=Array.from(n.Set);n.Set.clear(),t(this,pt,"m",kt).call(this,r,e),this.lastWrite=Date.now()}}))}}Tt=Ot,Mt=new WeakMap,St=new WeakMap,pt=new WeakSet,Dt=function(e){var n,r;const a=(null===(r=null===(n=t(this,St,"f"))||void 0===n?void 0:n.dirname)||void 0===r?void 0:r.call(n,e||this.defaultLogFile))||"",{existsSync:o,mkdirSync:i}=t(this,St,"f")||{};(null==o?void 0:o(a))||null==i||i(a)},kt=function(e,n){if(wt(n)||(n=[n]),!e)throw new Error("output log file is missed");t(this,pt,"m",Dt).call(this,e);const{writeFile:r}=t(this,St,"f")||{};if(e&&r){const t=n.reduce(((t,{prefix:e=[],data:n})=>[...t,[...e,...n.map(JSON.stringify),"\n"].join(" ")]),[]);null==r||r(e,t.join(""),{flag:"a"},Et)}},Ct={value:new Ot},(Ut=xt||(xt={})).ALL="all",Ut.PRODUCTION="production",Ut.DEVELOPMENET="development",Ut.NONE="none",(Wt=Pt||(Pt={})).LOG="LOG",Wt.WARN="WARN",Wt.INFO="INFO",Wt.ERROR="ERROR",Wt.DEBUG="DEBUG";const Nt={date:!0,env:xt.ALL},Lt=(t,e)=>{const{date:n}=e,r=[];if(t.length&&r.unshift(t.map((t=>`[${t.toUpperCase()}]`)).join(" ")),n){const t=new Date;let e;e=vt(n)?mt(t,n):new Date(t).toISOString(),r.unshift(e)}return r},Yt=t=>("all"===t||process.env.NODE_ENV===t)&&void 0!==console,Ft=(t,e)=>{wt(t)||(t=[t]);const{env:n,outputFile:r,output:a,levels:o=[],...i}={...Nt,...e||{}},u=vt(a)?{file:a}:a||{file:r};return{debug:(...e)=>{const[r,...a]=Lt(t,{...i}),s=[r,`[${Pt.DEBUG}]`,...a];Yt(n||xt.ALL)&&console.debug(...s,...e),(null==o?void 0:o.length)&&!o.includes(Pt.DEBUG)||Ot.cache.push({prefix:s,data:[...e]},u)},info:(...e)=>{const[r,...a]=Lt(t,{...i}),s=[r,`[${Pt.INFO}]`,...a];Yt(n||xt.ALL)&&console.info(...s,...e),(null==o?void 0:o.length)&&!o.includes(Pt.INFO)||Ot.cache.push({prefix:s,data:[...e]},u)},log:(...e)=>{const[r,...a]=Lt(t,{...i}),s=[r,`[${Pt.LOG}]`,...a];Yt(n||xt.ALL)&&console.log(...s,...e),(null==o?void 0:o.length)&&!o.includes(Pt.LOG)||Ot.cache.push({prefix:s,data:[...e]},u)},warn:(...e)=>{const[r,...a]=Lt(t,{...i}),s=[r,`[${Pt.WARN}]`,...a],{disableError:l}=i,d=l?console.debug:console.warn;Yt(n||xt.ALL)&&d(...s,...e),(null==o?void 0:o.length)&&!o.includes(Pt.WARN)||Ot.cache.push({prefix:s,data:[...e]},u)},error:(e,r)=>{const[a,...s]=Lt(t,{...i}),l=[a,`[${Pt.ERROR}]`,...s],{disableThrow:d,ignoreThrow:c,disableError:f}=i,h=f?console.debug:console.error;if(Yt(n||xt.ALL)&&h(...l,e),(null==o?void 0:o.length)&&!o.includes(Pt.ERROR)||Ot.cache.push({prefix:l,data:[e]},u),!1===c||!1===d)throw new Error(e,{cause:r})}}},jt=Ft;export{Ft as loggerWithTags,jt as withTags};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeffchi/logger",
3
- "version": "2.5.1-alpha.0",
3
+ "version": "3.0.0",
4
4
  "main": "lib/index.cjs",
5
5
  "module": "lib/index.mjs",
6
6
  "types": "lib/index.d.ts",
@@ -37,13 +37,7 @@
37
37
  "push": "git commit -m",
38
38
  "postpush": "git push",
39
39
  "prepublishOnly": "npm run test main && npm run lint",
40
- "preversion": "npm run lint",
41
- "version": "npm run format && git add -A src",
42
- "postversion": "git push && git push --tags",
43
- "release": "cross-env-shell standard-version --prerelease $npm_config_pre --release-as ",
44
- "postrelease": "git push --follow-tags && npm publish --tag $npm_config_pre",
45
- "release:all": "cross-env-shell standard-version -a --prerelease %npm_config_pre% --release-as ",
46
- "postrelease:all": "git push --follow-tags && npm publish $npm_config_pre"
40
+ "release": "node release"
47
41
  },
48
42
  "author": "jeffery·chiang",
49
43
  "license": "MIT",
@@ -60,7 +54,7 @@
60
54
  ],
61
55
  "standard-version": {
62
56
  "scripts": {
63
- "prerelease": "npm run format && git add -A ."
57
+ "prerelease": "npm run lint && npm run format && git add -A ."
64
58
  }
65
59
  },
66
60
  "peerDependencies": {
@@ -77,6 +71,7 @@
77
71
  "@rollup/plugin-typescript": "^11.0.0",
78
72
  "@types/jest": "^29.2.5",
79
73
  "@types/node": "^18.11.18",
74
+ "@types/standard-version": "^7.0.1",
80
75
  "babel-preset-env": "^1.7.0",
81
76
  "commitizen": "^4.2.6",
82
77
  "cross-env": "^7.0.3",
@@ -90,6 +85,7 @@
90
85
  "rollup-plugin-esbuild": "^5.0.0",
91
86
  "rollup-plugin-typescript2": "^0.34.1",
92
87
  "rollup-plugin-visualizer": "^5.9.0",
88
+ "shelljs": "^0.8.5",
93
89
  "standard-version": "^9.5.0",
94
90
  "ts-jest": "^29.0.5",
95
91
  "tslib": "^2.4.1",