analogger 2.1.1 → 2.2.1

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
@@ -303,7 +303,10 @@ Display the browser native message box if run from it; otherwise, it displays th
303
303
  | requiredLogLevel | "LOG" | "LOG" / "INFO" / "WARN" / "ERROR" | _Define the log level from which the system can show a log entry_ |
304
304
  | enableDate | false | boolean | _Show date + time (instead of time only)_ |
305
305
  | logToLocalStorage | false | boolean | _Persist logs in browser localStorage_ |
306
- | logToLocalStorageMax | 50 | number | _Max entries to keep in localStorage_ |
306
+ | logToLocalStorageMax | 50 | number | _Max entries to keep in localStorage_ |
307
+ | logToLocalStorageSize | 10000 | number | _Max size in bytes for localStorage logs_ |
308
+ | logToRemoteMaxEntries | undefined | number | _Number of entries to keep before relaying the data to the remote_ |
309
+ | logToRemoteDebounce | undefined | number | _Time in ms between two posts where the data can be sent to the server_ |
307
310
  | compressArchives | false | boolean | _If true, rotates log files into a .tar.gz archive_ |
308
311
  | compressionLevel | 1 | number | _Gzip compression level (0-9)_ |
309
312
  | addArchiveTimestamp | true | boolean | _Appends a consistent timestamp to rotated files_ |
@@ -347,6 +350,13 @@ anaLogger.setOptions({logToRemote: true});
347
350
 
348
351
  // Use your remote server (You are responsible for the back-end implementation)
349
352
  anaLogger.setOptions({logToRemoteUrl: "http://your.server.com/data"});
353
+
354
+ // Batch remote logs (Send when 10 entries are reached OR after 5 seconds)
355
+ anaLogger.setOptions({
356
+ logToRemote: true,
357
+ logToRemoteMaxEntries: 10,
358
+ logToRemoteDebounce: 5000
359
+ });
350
360
  ```
351
361
 
352
362
  > Your server must support the POST method.
@@ -1210,7 +1220,8 @@ You can now persist logs in the browser's Local Storage. This is useful for debu
1210
1220
  // Enable local storage logging
1211
1221
  anaLogger.setOptions({
1212
1222
  logToLocalStorage: true,
1213
- logToLocalStorageMax: 100 // Keep last 100 logs
1223
+ logToLocalStorageMax: 100, // Keep last 100 logs
1224
+ logToLocalStorageSize: 50000 // Limit to 50KB
1214
1225
  });
1215
1226
 
1216
1227
  // Restore logs from previous session after page reload
package/ana-logger.d.cts CHANGED
@@ -114,8 +114,10 @@ declare class ____AnaLogger {
114
114
  */
115
115
  isBrowser(): boolean;
116
116
  resetLogger(): void;
117
+ remoteBuffer: any[];
118
+ remoteTimer: NodeJS.Timeout;
117
119
  resetOptions(): void;
118
- setOptions({ contextLenMax, idLenMax, lidLenMax, symbolLenMax, enableTrace, messageLenMax, hideLog, hideError, hideHookMessage, hidePassingTests, logToDom, logToFile, logMaxSize, logMaxArchives, logIndexArchive, addArchiveTimestamp, addArchiveIndex, compressArchives, compressionLevel, logToRemote, logToRemoteUrl, logToRemoteBinaryUrl, loopback, requiredLogLevel, oneConsolePerContext, silent, enableDate, logToLocalStorage, logToLocalStorageMax, protocol, host, port, pathname, binarypathname, loadHtmlToImage }?: any): void;
120
+ setOptions({ contextLenMax, idLenMax, lidLenMax, symbolLenMax, enableTrace, messageLenMax, hideLog, hideError, hideHookMessage, hidePassingTests, logToDom, logToFile, logMaxSize, logMaxArchives, logIndexArchive, addArchiveTimestamp, addArchiveIndex, compressArchives, compressionLevel, logToRemote, logToRemoteUrl, logToRemoteBinaryUrl, loopback, requiredLogLevel, oneConsolePerContext, silent, enableDate, logToLocalStorage, logToLocalStorageMax, logToLocalStorageSize, logToRemoteMaxEntries, logToRemoteDebounce, protocol, host, port, pathname, binarypathname, loadHtmlToImage }?: any): void;
119
121
  EOL: string;
120
122
  updateOptions(options: any): void;
121
123
  getOptions(): {
@@ -268,7 +270,9 @@ declare class ____AnaLogger {
268
270
  args?: any;
269
271
  }): void;
270
272
  writeLogToFile(text: any): void;
271
- writeLogToRemote(...data: any[]): any;
273
+ writeLogToRemote(...data: any[]): void;
274
+ flushRemoteLogs(): void;
275
+ performRemotePost(data: any): any;
272
276
  writeLogToLocalStorage(context: any, ...args: any[]): void;
273
277
  restoreLogs(): void;
274
278
  /**
@@ -930,6 +930,11 @@ class ____AnaLogger
930
930
  this.options.enableDate = undefined;
931
931
  this.options.logToLocalStorage = undefined;
932
932
  this.options.logToLocalStorageMax = 50;
933
+ this.options.logToLocalStorageSize = 10000;
934
+ this.options.logToRemoteMaxEntries = undefined;
935
+ this.options.logToRemoteDebounce = undefined;
936
+ this.remoteBuffer = [];
937
+ this.remoteTimer = null;
933
938
  }
934
939
 
935
940
  resetOptions()
@@ -967,6 +972,9 @@ class ____AnaLogger
967
972
  enableDate = undefined,
968
973
  logToLocalStorage = undefined,
969
974
  logToLocalStorageMax = 50,
975
+ logToLocalStorageSize = 10000,
976
+ logToRemoteMaxEntries = undefined,
977
+ logToRemoteDebounce = undefined,
970
978
  /** Remote - all optional **/
971
979
  protocol = undefined,
972
980
  host = undefined,
@@ -994,6 +1002,9 @@ class ____AnaLogger
994
1002
  this.options.enableTrace = enableTrace;
995
1003
 
996
1004
  this.options.logToLocalStorageMax = logToLocalStorageMax;
1005
+ this.options.logToLocalStorageSize = logToLocalStorageSize;
1006
+ this.options.logToRemoteMaxEntries = logToRemoteMaxEntries;
1007
+ this.options.logToRemoteDebounce = logToRemoteDebounce;
997
1008
 
998
1009
  if (loadHtmlToImage) {
999
1010
  const code = getHtmlToImage();
@@ -1986,6 +1997,58 @@ class ____AnaLogger
1986
1997
  }
1987
1998
 
1988
1999
  writeLogToRemote(...data)
2000
+ {
2001
+ try
2002
+ {
2003
+ if (this.options.logToRemoteMaxEntries === undefined && this.options.logToRemoteDebounce === undefined)
2004
+ {
2005
+ this.performRemotePost([...data]);
2006
+ return;
2007
+ }
2008
+
2009
+ this.remoteBuffer.push([...data]);
2010
+
2011
+ if (this.options.logToRemoteMaxEntries !== undefined && this.remoteBuffer.length >= this.options.logToRemoteMaxEntries)
2012
+ {
2013
+ this.flushRemoteLogs();
2014
+ return;
2015
+ }
2016
+
2017
+ if (this.options.logToRemoteDebounce !== undefined && !this.remoteTimer)
2018
+ {
2019
+ this.remoteTimer = setTimeout(() =>
2020
+ {
2021
+ this.flushRemoteLogs();
2022
+ }, this.options.logToRemoteDebounce);
2023
+ }
2024
+ }
2025
+ catch (e)
2026
+ {
2027
+ /* istanbul ignore next */
2028
+ ____AnaLogger.Console.error("LOG_TO_REMOTE_FAILURE: ", e.message);
2029
+ }
2030
+ }
2031
+
2032
+ flushRemoteLogs()
2033
+ {
2034
+ if (this.remoteTimer)
2035
+ {
2036
+ clearTimeout(this.remoteTimer);
2037
+ this.remoteTimer = null;
2038
+ }
2039
+
2040
+ if (this.remoteBuffer.length === 0)
2041
+ {
2042
+ return;
2043
+ }
2044
+
2045
+ const dataToFlush = [...this.remoteBuffer];
2046
+ this.remoteBuffer = [];
2047
+
2048
+ this.performRemotePost(dataToFlush);
2049
+ }
2050
+
2051
+ performRemotePost(data)
1989
2052
  {
1990
2053
  try
1991
2054
  {
@@ -1995,8 +2058,7 @@ class ____AnaLogger
1995
2058
  return null;
1996
2059
  }
1997
2060
 
1998
- const entry = [...data];
1999
- const stringified = JSON.stringify(entry);
2061
+ const stringified = JSON.stringify(data);
2000
2062
  fetch(urlDest, {
2001
2063
  method : "post",
2002
2064
  body : stringified,
@@ -2008,7 +2070,7 @@ class ____AnaLogger
2008
2070
  catch (e)
2009
2071
  {
2010
2072
  /* istanbul ignore next */
2011
- ____AnaLogger.Console.error("LOG_TO_REMOTE_FAILURE: ", e.message);
2073
+ ____AnaLogger.Console.error("REMOTE_POST_FAILURE: ", e.message);
2012
2074
  }
2013
2075
  }
2014
2076
 
@@ -2044,7 +2106,16 @@ class ____AnaLogger
2044
2106
  history = history.slice(history.length - max);
2045
2107
  }
2046
2108
 
2047
- localStorage.setItem(key, JSON.stringify(history));
2109
+ const maxSize = this.options.logToLocalStorageSize || 10000;
2110
+ let serialized = JSON.stringify(history);
2111
+
2112
+ while (serialized.length > maxSize && history.length > 1)
2113
+ {
2114
+ history.shift();
2115
+ serialized = JSON.stringify(history);
2116
+ }
2117
+
2118
+ localStorage.setItem(key, serialized);
2048
2119
  }
2049
2120
  catch (e)
2050
2121
  {
@@ -1,9 +1,9 @@
1
- var Ye=Object.defineProperty;var Je=(o,e,t)=>e in o?Ye(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var m=(o,e,t)=>(Je(o,typeof e!="symbol"?e+"":e,t),t),re=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var y=(o,e,t)=>(re(o,e,"read from private field"),t?t.call(o):e.get(o)),A=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},oe=(o,e,t,n)=>(re(o,e,"write to private field"),n?n.call(o,t):e.set(o,t),t);var ie=(o,e,t)=>(re(o,e,"access private method"),t);var pe={Foreground:38,Background:48},R="\x1B[1D",me="\x1B[0m"+R,z={Bold:"\x1B[1m"+R,Underline:"\x1B[4m"+R,Reversed:"\x1B[7m"+R},Xe={Bold:"\x1B[1m"+R,Underline:"\x1B[4m"+R,Reversed:"\x1B[7m"+R},se={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Ke(o){return!!se[o]}var ye=(o,e,t)=>o===e&&e===t?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(e/255*5)+Math.round(t/255*5),be=o=>{let e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;o=o.replace(e,function(n,r,i,s){return r+r+i+i+s+s});let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return t?{red:parseInt(t[1],16),blue:parseInt(t[2],16),green:parseInt(t[3],16)}:{}},ve=function({red:o,green:e,blue:t}){let n=o<<16|e<<8|t<<0;return"#"+(16777216+n).toString(16).slice(1)},Le=function(o){let e=o.matchAll(/\d+/g),t=[];for(let n of e){let r=parseInt(n[0]);if(r>255)return null;t.push(r)}return t.length!==3?null:{red:t[0],green:t[1],blue:t[2]}},Qe=function(o){let e=Le(o);return e&&ve(e)},W=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e},Ee=({hue:o,saturation:e,lightness:t})=>{let n,r,i;if(e===0)n=r=i=t;else{let s=t<.5?t*(1+e):t+e-t*e,a=2*t-s;n=W(a,s,o+1/3),r=W(a,s,o),i=W(a,s,o-1/3)}return{red:Math.round(n*255),blue:Math.round(i*255),green:Math.round(r*255)}},Te=o=>{let e=o.toLowerCase();return typeof se[e]<"u"?se[e]:""};function D({red:o,blue:e,green:t},n=!0){if(o===void 0||e===void 0||t===void 0)return"";let r=ye(o,e,t);return`\x1B[${n?pe.Foreground:pe.Background};5;`+r+"m "+R}function M(o,e=!0){let{red:t,green:n,blue:r}=be(o);return D({red:t,green:n,blue:r},e)}function Y({hue:o,saturation:e,lightness:t},n){let{red:r,green:i,blue:s}=Ee({hue:o,saturation:e,lightness:t});return D({red:r,green:i,blue:s},n)}function ae(o,e=!0){try{let t;return o=o||"",o?((typeof o=="string"||o instanceof String)&&(o=o.trim()),Ke(o)?(t=Te(o),M(t,e)):typeof o=="object"&&!!o.red&&!!o.blue&&!!o.green?D(o,e):typeof o=="object"&&!!o.hue&&!!o.saturation&&!!o.lightness?Y(o,e):o.startsWith("#")?M(o,e):(o=o.toString(),/^[\da-fA-F]+$/.test(o)?M("#"+o,e):"")):""}catch(t){console.error("TO_ANSI_INVALID_ARGUMENT_ERROR",t.message)}}function J(o,{fg:e,bg:t,isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){let s=!1,a="";return e&&(s=!0,a=a+e),t&&(s=!0,a=a+t),n&&(s=!0,a=a+z.Underline),r&&(s=!0,a=a+z.Bold),i&&(s=!0,a=a+z.Reversed),s?a+o+me:o}function Ze(o,{fg:e={},bg:t={},isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=D({...e})),t&&(t=D({...t},!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function et(o,{fg:e="",bg:t="",isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=Y({...e})),t&&(t=Y({...t},!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function tt(o,{fg:e="",bg:t="",isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=M(e)),t&&(t=M(t,!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function nt(o,e=null){if(!e)return o;let{fg:t="",bg:n="",isUnderline:r=!1,isBold:i=!1,isReversed:s=!1}=e;return t&&(t=ae(t)),n&&(n=ae(n,!1)),J(o,{fg:t,bg:n,isUnderline:r,isBold:i,isReversed:s})}var X={fromRgb:D,fromHexa:M,fromHsl:Y,fromColor:ae,getTextFromRgb:Ze,getTextFromHsl:et,getTextFromHex:tt,getTextFromColor:nt,colorNameToHex:Te,hslToRgb:Ee,hexToRgb:be,rgbToHex:ve,rgbToAnsi256:ye,rgbStringToRgb:Le,rgbStringToHex:Qe,hue2rgb:W,RESET:me,FONT_STYLE:z,STYLE:Xe};var we={COLOR_TABLE:["#d2466e","#FFA07A","#FF7F50","#FF6347","#FFE4B5","#ADFF2F","#808000","#40E0D0","#1E90FF","#EE82EE","#708090","#DEB887","#FE642E","#210B61","#088A4B","#5E610B","#FA8258","#088A68","#B40431"],SYSTEM:{BROWSER:"BROWSER",NODE:"NODE"}},k=we.COLOR_TABLE,$=we.SYSTEM,le=2e3,ce="analogger-removed-notif",ue="analogger-header",fe="analogger-view",de="analogger-footer",Se="to-esm-line",K={TOP:"TOP",BOTTOM:"BOTTOM"},Oe="ANALOGGER",Q={DEFAULT_FORMAT:"FORMAT1"};var{parse:Lt,stringify:rt}=JSON,{keys:Et}=Object,ot=String,it="string";var Ae="object",st=(o,e)=>e;var xe=(o,e,t)=>{let n=ot(e.push(t)-1);return o.set(t,n),n};var Re=(o,e,t)=>{let n=e&&typeof e===Ae?(d,h)=>d===""||-1<e.indexOf(d)?h:void 0:e||st,r=new Map,i=[],s=[],a=+xe(r,i,n.call({"":o},"",o)),u=!a;for(;a<i.length;)u=!0,s[a]=rt(i[a++],f,t);return"["+s.join(",")+"]";function f(d,h){if(u)return u=!u,h;let g=n.call(this,d,h);switch(typeof g){case Ae:if(g===null)return g;case it:return r.get(g)||xe(r,i,g)}return g}};var E={moduleName:"analogger",protocol:"http://",host:"localhost",port:12e3,pathname:"analogger",binarypathname:"uploaded",loopback:"localhost",consoleDomId:"#analogger",logFilename:"./analogger.log"},T={ALL:"ALL",USER:"USER",NONE:"NONE"},b={FATAL:5e3,ERROR:4e3,WARN:3e3,INFO:2e3,LOG:1e3,DEBUG:500,ALL:200,OFF:0,INHERIT:-1},Ce={LOCAL:"local",GLOBAL:"global"},B={DEFAULT:{contextName:"DEFAULT",logLevel:b.LOG,symbol:"check"},LOG:{contextName:"LOG",logLevel:b.LOG,symbol:"check"},DEBUG:{contextName:"DEBUG",logLevel:b.DEBUG},INFO:{contextName:"INFO",logLevel:b.INFO,color:"#B18904",symbol:"diamonds"},WARN:{contextName:"WARN",logLevel:b.WARN,color:k[0],symbol:"cross"},ERROR:{contextName:"ERROR",logLevel:b.ERROR},CRITICAL:{contextName:"CRITICAL",logLevel:b.CRITICAL}},at=`
2
- `,Z={airplane:"\u2708",anchor:"\u2693",announcement:"\u{1F4E2}",arrow_backward:"\u25C0",arrow_double_up:"\u23EB",arrow_double_down:"\u23EC",arrow_forward:"\u25B6",arrow_lower_right:"\u2198",arrow_lower_left:"\u2199",arrow_right_hook:"\u21AA",arrow_up_down:"\u2195",arrow_upper_left:"\u2196",arrow_upper_right:"\u2197",ballot_box_with_check:"\u2611",biohazard:"\u2623",black_circle:"\u23FA",black_medium_small_square:"\u25FE",black_medium_square:"\u25FC",black_nib:"\u2712",black_small_square:"\u25AA",black_square:"\u23F9",chains:"\u26D3",check:"\u2714",chess_pawn:"\u265F",cloud_and_rain:"\u26C8",clubs:"\u2663",coffee:"\u2615",computer:"\u{1F4BB}",computer_disk:"\u{1F4BD}",computer_mouse:"\u{1F5B1}\uFE0F",copyright:"\xA9",cross:"\u274C",desktop_computer:"\u{1F5A5}\uFE0F",diamonds:"\u2666",divisions_ign:"\u2797",double_triangle_right:"\u23ED",double_triangle_left:"\u23EE",email:"\u2709",eject:"\u23CF",envelope:"\u2709\uFE0F",exclamation_mark:"\u2757",fast_forward:"\u23E9",female_sign:"\u2640",fire:"\u{1F525}",fist:"\u270A",floppy_disk:"\u{1F4BE}",fuel_pump:"\u26FD",gear:"\u2699",hammer_and_pick:"\u2692",hand:"\u270B",hearts:"\u2665",identification_card:"\u{1F194}",infinity:"\u267E",information:"\u2139",information_source:"\u2139\uFE0F",key:"\u{1F511}",left_right_arrow:"\u2194",leftwards_arrow_with_hook:"\u21A9",lock:"\u{1F512}",male_sign:"\u2642",minus_sign:"\u2796",money_bag:"\u{1F4B0}",no_entry:"\u26D4",old_key:"\u{1F5DD}\uFE0F",partly_sunny:"\u26C5",pencil:"\u270F",phone:"\u260E",pile_of_poo:"\u{1F4A9}",plus_sign:"\u2795",question:"\u2754",radioactive:"\u2622",raised_hand:"\u270B",recycle:"\u267B",registered:"\xAE",relaxed:"\u263A",rewind:"\u23EA",scissors:"\u2702",settings:"\u2699\uFE0F",shield:"\u{1F6E1}\uFE0F",screen_with_curl:"\u{1F4DC}",snowman:"\u2603",spades:"\u2660",sparkles:"\u2728",speech_bubble:"\u{1F4AC}",squared_cancellation_mark:"\u274E",star:"\u2B50",sunny:"\u2600",tent:"\u26FA",thought_balloon:"\u{1F4AD}",trademark:"\u2122",triangle_with_vertical_bar:"\u23EF",umbrella:"\u2614",unlock:"\u{1F513}",vertical_bars:"\u23F8",watch:"\u231A",white_frowning_face:"\u2639",white_medium_square:"\u25FB",white_medium_small_square:"\u25FD",white_small_square:"\u25AB",wheelchair:"\u267F",white_circle:"\u26AA",white_square_containing_black_small_square:"\u25FD",writing_hand:"\u270D"};function lt(o){try{let e=path.extname(o),t=path.basename(o,e),n=path.dirname(o),r=o.slice(0,o.length-e.length);return{extension:e,filePath:r,basename:t,dirname:n}}catch(e){console.error("FILEPATH_EXT_FAILURE: ",e.message)}return{extension:".log",filePath:o}}function ct(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function ut(o,e,t,n,r,i,s){fs.readdir(o,(a,u)=>{if(a){s(a,null);return}let f=[],d=0,h=(p,L)=>{if(!fs.existsSync(p)){L(null,null);return}fs.unlink(p,O=>{O?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${O}`):f.push(p),d++,d===u.length&&L(null,f)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let L=path.join(o,p);r&&ht(L,r,i),h(L,s)}else d++,d===u.length&&s(null,f)};u.length===0?s(null,f):u.forEach(g,i)})}function ft(o,e={}){let t=document.createElement("script");t.textContent=o;for(let n in e)t.setAttribute(n,e[n]);document.head.appendChild(t),t.remove()}function dt(){let o=[];return o.push(`!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).htmlToImage={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}a((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var r,i=(r=0,function(){return r+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(r)});function o(t){for(var e=[],n=0,r=t.length;n<r;n++)e.push(t[n]);return e}var u=null;function c(t){return void 0===t&&(t={}),u||(u=t.includeStyleProperties?t.includeStyleProperties:o(window.getComputedStyle(document.documentElement)))}function a(t,e){var n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function s(t,e){void 0===e&&(e={});var n,r,i,o=e.width||(r=a(n=t,"border-left-width"),i=a(n,"border-right-width"),n.clientWidth+r+i),u=e.height||function(t){var e=a(t,"border-top-width"),n=a(t,"border-bottom-width");return t.clientHeight+e+n}(t);return{width:o,height:u}}var l=16384;function f(t,e){return void 0===e&&(e={}),t.toBlob?new Promise((function(n){t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((function(n){for(var r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=r.length,o=new Uint8Array(i),u=0;u<i;u+=1)o[u]=r.charCodeAt(u);n(new Blob([o],{type:e.type?e.type:"image/png"}))}))}function h(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){r.decode().then((function(){requestAnimationFrame((function(){return e(r)}))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t}))}function d(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(t)})).then(encodeURIComponent).then((function(t){return"data:image/svg+xml;charset=utf-8,".concat(t)}))]}))}))}function v(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u;return n(this,(function(n){return e="http://www.w3.org/2000/svg",o=document.createElementNS(e,"svg"),u=document.createElementNS(e,"foreignObject"),o.setAttribute("width","".concat(r)),o.setAttribute("height","".concat(i)),o.setAttribute("viewBox","0 0 ".concat(r," ").concat(i)),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),o.appendChild(u),u.appendChild(t),[2,d(o)]}))}))}var p=function(t,e){if(t instanceof e)return!0;var n=Object.getPrototypeOf(t);return null!==n&&(n.constructor.name===e.name||p(n,e))};function g(t,e,n,r){var i=".".concat(t,":").concat(e),o=n.cssText?function(t){var e=t.getPropertyValue("content");return"".concat(t.cssText," content: '").concat(e.replace(/'|"/g,""),"';")}(n):function(t,e){return c(e).map((function(e){var n=t.getPropertyValue(e),r=t.getPropertyPriority(e);return"".concat(e,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n,r);return document.createTextNode("".concat(i,"{").concat(o,"}"))}function m(t,e,n,r){var o=window.getComputedStyle(t,n),u=o.getPropertyValue("content");if(""!==u&&"none"!==u){var c=i();try{e.className="".concat(e.className," ").concat(c)}catch(t){return}var a=document.createElement("style");a.appendChild(g(c,n,o,r)),e.appendChild(a)}}var w="application/font-woff",y="image/jpeg",b={woff:w,woff2:w,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:y,jpeg:y,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function S(t){var e=function(t){var e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return b[e]||""}function E(t){return-1!==t.search(/^(data:)/)}function x(t,e){return"data:".concat(e,";base64,").concat(t)}function C(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return[4,fetch(t,r)];case 1:if(404===(e=n.sent()).status)throw new Error('Resource "'.concat(e.url,'" not found'));return[4,e.blob()];case 2:return o=n.sent(),[2,new Promise((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(){try{t(i({res:e,result:r.result}))}catch(t){n(t)}},r.readAsDataURL(o)}))]}}))}))}var P={};function R(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u,c,a;return n(this,(function(n){switch(n.label){case 0:if(e=function(t,e,n){var r=t.replace(/\\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\\//,"")),e?"[".concat(e,"]").concat(r):r}(t,r,i.includeQueryParams),null!=P[e])return[2,P[e]];i.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+(new Date).getTime()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,C(t,i.fetchRequestInit,(function(t){var e=t.res,n=t.result;return r||(r=e.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n)}))];case 2:return u=n.sent(),o=x(u,r),[3,4];case 3:return c=n.sent(),o=i.imagePlaceholder||"",a="Failed to fetch resource: ".concat(t),c&&(a="string"==typeof c?c:c.message),a&&console.warn(a),[3,4];case 4:return P[e]=o,[2,o]}}))}))}function T(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"data:,"===(e=t.toDataURL())?[2,t.cloneNode(!1)]:[2,h(e)]}))}))}function A(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return t.currentSrc?(e=document.createElement("canvas"),i=e.getContext("2d"),e.width=t.clientWidth,e.height=t.clientHeight,null==i||i.drawImage(t,0,0,e.width,e.height),[2,h(e.toDataURL())]):(o=t.poster,u=S(o),[4,R(o,u,r)]);case 1:return[2,h(n.sent())]}}))}))}function k(t,r){var i;return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(null===(i=null==t?void 0:t.contentDocument)||void 0===i?void 0:i.body)?[4,I(t.contentDocument.body,r,!0)]:[3,2];case 1:return[2,e.sent()];case 2:return[3,4];case 3:return e.sent(),[3,4];case 4:return[2,t.cloneNode(!1)]}}))}))}var L=function(t){return null!=t.tagName&&"SVG"===t.tagName.toUpperCase()};function N(t,e,n){return p(e,Element)&&(function(t,e,n){var r=e.style;if(r){var i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):c(n).forEach((function(n){var o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){var u=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o="".concat(u,"px")}p(t,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&e.getAttribute("d")&&(o="path(".concat(e.getAttribute("d"),")")),r.setProperty(n,o,i.getPropertyPriority(n))}))}}(t,e,n),function(t,e,n){m(t,e,":before",n),m(t,e,":after",n)}(t,e,n),function(t,e){p(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),p(t,HTMLInputElement)&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(p(t,HTMLSelectElement)){var n=e,r=Array.from(n.children).find((function(e){return t.value===e.getAttribute("value")}));r&&r.setAttribute("selected","")}}(t,e)),e}function I(t,r,i){return e(this,void 0,void 0,(function(){return n(this,(function(u){return i||!r.filter||r.filter(t)?[2,Promise.resolve(t).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){return p(t,HTMLCanvasElement)?[2,T(t)]:p(t,HTMLVideoElement)?[2,A(t,r)]:p(t,HTMLIFrameElement)?[2,k(t,r)]:[2,t.cloneNode(L(t))]}))}))}(t,r)})).then((function(i){return function(t,r,i){var u,c;return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return L(r)?[2,r]:(e=[],0===(e=null!=(a=t).tagName&&"SLOT"===a.tagName.toUpperCase()&&t.assignedNodes?o(t.assignedNodes()):p(t,HTMLIFrameElement)&&(null===(u=t.contentDocument)||void 0===u?void 0:u.body)?o(t.contentDocument.body.childNodes):o((null!==(c=t.shadowRoot)&&void 0!==c?c:t).childNodes)).length||p(t,HTMLVideoElement)?[2,r]:[4,e.reduce((function(t,e){return t.then((function(){return I(e,i)})).then((function(t){t&&r.appendChild(t)}))}),Promise.resolve())]);case 1:return n.sent(),[2,r]}var a}))}))}(t,i,r)})).then((function(e){return N(t,e,r)})).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c,a,s,l,f,h,d,v,p;return n(this,(function(n){switch(n.label){case 0:if(0===(e=t.querySelectorAll?t.querySelectorAll("use"):[]).length)return[2,t];i={},p=0,n.label=1;case 1:return p<e.length?(o=e[p],(u=o.getAttribute("xlink:href"))?(c=t.querySelector(u),a=document.querySelector(u),c||!a||i[u]?[3,3]:(s=i,l=u,[4,I(a,r,!0)])):[3,3]):[3,4];case 2:s[l]=n.sent(),n.label=3;case 3:return p++,[3,1];case 4:if((f=Object.values(i)).length){for(h="http://www.w3.org/1999/xhtml",(d=document.createElementNS(h,"svg")).setAttribute("xmlns",h),d.style.position="absolute",d.style.width="0",d.style.height="0",d.style.overflow="hidden",d.style.display="none",v=document.createElementNS(h,"defs"),d.appendChild(v),p=0;p<f.length;p++)v.appendChild(f[p]);t.appendChild(d)}return[2,t]}}))}))}(t,r)}))]:[2,null]}))}))}var D=/url\\((['"]?)([^'"]+?)\\1\\)/g,H=/url\\([^)]+\\)\\s*format\\((["']?)([^"']+)\\1\\)/g,M=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function F(t,r,i,o,u){return e(this,void 0,void 0,(function(){var e,c,a,s;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),e=i?function(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}(r,i):r,c=S(r),a=void 0,u?[4,u(e)]:[3,2];case 1:return s=n.sent(),a=x(s,c),[3,4];case 2:return[4,R(e,c,o)];case 3:a=n.sent(),n.label=4;case 4:return[2,t.replace((l=r,f=l.replace(/([.*+?^$`),o.push(`{}()|\\[\\]\\/\\\\])/g,"\\\\$1"),new RegExp("(url\\\\(['\\"]?)(".concat(f,")(['\\"]?\\\\))"),"g")),"$1".concat(a,"$3"))];case 5:return n.sent(),[3,6];case 6:return[2,t]}var l,f}))}))}function V(t){return-1!==t.search(D)}function q(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){return V(t)?(e=function(t,e){var n=e.preferredFontFormat;return n?t.replace(M,(function(t){for(;;){var e=H.exec(t)||[],r=e[0],i=e[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):t}(t,i),o=function(t){var e=[];return t.replace(D,(function(t,n,r){return e.push(r),t})),e.filter((function(t){return!E(t)}))}(e),[2,o.reduce((function(t,e){return t.then((function(t){return F(t,e,r,i)}))}),Promise.resolve(e))]):[2,t]}))}))}function U(t,r,i){var o;return e(this,void 0,void 0,(function(){var e,u;return n(this,(function(n){switch(n.label){case 0:return(e=null===(o=r.style)||void 0===o?void 0:o.getPropertyValue(t))?[4,q(e,null,i)]:[3,2];case 1:return u=n.sent(),r.style.setProperty(t,u,r.style.getPropertyPriority(t)),[2,!0];case 2:return[2,!1]}}))}))}function j(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,U("background",t,r)];case 1:return n.sent()?[3,3]:[4,U("background-image",t,r)];case 2:n.sent(),n.label=3;case 3:return[4,U("mask",t,r)];case 4:return(i=n.sent())?[3,6]:[4,U("-webkit-mask",t,r)];case 5:i=n.sent(),n.label=6;case 6:return(e=i)?[3,8]:[4,U("mask-image",t,r)];case 7:e=n.sent(),n.label=8;case 8:return e?[3,10]:[4,U("-webkit-mask-image",t,r)];case 9:n.sent(),n.label=10;case 10:return[2]}}))}))}function O(t,r){return e(this,void 0,void 0,(function(){var e,i,o;return n(this,(function(n){switch(n.label){case 0:return(e=p(t,HTMLImageElement))&&!E(t.src)||p(t,SVGImageElement)&&!E(t.href.baseVal)?[4,R(i=e?t.src:t.href.baseVal,S(i),r)]:[2];case 1:return o=n.sent(),[4,new Promise((function(n,i){t.onload=n,t.onerror=r.onImageErrorHandler?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{n(r.onImageErrorHandler.apply(r,t))}catch(t){i(t)}}:i;var u=t;u.decode&&(u.decode=n),"lazy"===u.loading&&(u.loading="eager"),e?(t.srcset="",t.src=o):t.href.baseVal=o}))];case 2:return n.sent(),[2]}}))}))}function B(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return e=o(t.childNodes),i=e.map((function(t){return z(t,r)})),[4,Promise.all(i).then((function(){return t}))];case 1:return n.sent(),[2]}}))}))}function z(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return p(t,Element)?[4,j(t,r)]:[3,4];case 1:return e.sent(),[4,O(t,r)];case 2:return e.sent(),[4,B(t,r)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}var W={};function $(t){return e(this,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:return null!=(e=W[t])?[2,e]:[4,fetch(t)];case 1:return[4,n.sent().text()];case 2:return r=n.sent(),e={url:t,cssText:r},W[t]=e,[2,e]}}))}))}function G(t,r){return e(this,void 0,void 0,(function(){var i,o,u,c,a=this;return n(this,(function(s){return i=t.cssText,o=/url\\(["']?([^"')]+)["']?\\)/g,u=i.match(/url\\([^)]+\\)/g)||[],c=u.map((function(u){return e(a,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=u.replace(o,"$1")).startsWith("https://")||(e=new URL(e,t.url).href),[2,C(e,r.fetchRequestInit,(function(t){var e=t.result;return i=i.replace(u,"url(".concat(e,")")),[u,e]}))]}))}))})),[2,Promise.all(c).then((function(){return i}))]}))}))}function _(t){if(null==t)return[];for(var e=[],n=t.replace(/(\\/\\*[\\s\\S]*?\\*\\/)/gi,""),r=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");;){if(null===(u=r.exec(n)))break;e.push(u[0])}n=n.replace(r,"");for(var i=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,o=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");;){var u;if(null===(u=i.exec(n))){if(null===(u=o.exec(n)))break;i.lastIndex=o.lastIndex}else o.lastIndex=i.lastIndex;e.push(u[0])}return e}function J(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){return e=[],i=[],t.forEach((function(e){if("cssRules"in e)try{o(e.cssRules||[]).forEach((function(t,n){if(t.type===CSSRule.IMPORT_RULE){var o=n+1,u=$(t.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){try{e.insertRule(t,t.startsWith("@import")?o+=1:e.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}}))})).catch((function(t){console.error("Error loading remote css",t.toString())}));i.push(u)}}))}catch(o){var n=t.find((function(t){return null==t.href}))||document.styleSheets[0];null!=e.href&&i.push($(e.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){n.insertRule(t,n.cssRules.length)}))})).catch((function(t){console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",o)}})),[2,Promise.all(i).then((function(){return t.forEach((function(t){if("cssRules"in t)try{o(t.cssRules||[]).forEach((function(t){e.push(t)}))}catch(e){console.error("Error while reading CSS rules from ".concat(t.href),e)}})),e}))]}))}))}function Q(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return V(t.style.getPropertyValue("src"))}))}function X(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");return[4,J(o(t.ownerDocument.styleSheets),r)];case 1:return[2,Q(e.sent())]}}))}))}function K(t){return t.trim().replace(/["']/g,"")}function Y(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,X(t,r)];case 1:return e=n.sent(),i=function(t){var e=new Set;return function t(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((function(t){e.add(K(t))})),Array.from(n.children).forEach((function(e){e instanceof HTMLElement&&t(e)}))}(t),e}(t),[4,Promise.all(e.filter((function(t){return i.has(K(t.style.fontFamily))})).map((function(t){var e=t.parentStyleSheet?t.parentStyleSheet.href:null;return q(t.cssText,e,r)})))];case 2:return[2,n.sent().join("\\n")]}}))}))}function Z(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c;return n(this,(function(n){switch(n.label){case 0:return null==r.fontEmbedCSS?[3,1]:(i=r.fontEmbedCSS,[3,5]);case 1:return r.skipFonts?(o=null,[3,4]):[3,2];case 2:return[4,Y(t,r)];case 3:o=n.sent(),n.label=4;case 4:i=o,n.label=5;case 5:return(e=i)&&(u=document.createElement("style"),c=document.createTextNode(e),u.appendChild(c),t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),[2]}}))}))}function tt(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,I(t,r,!0)];case 1:return[4,Z(u=n.sent(),r)];case 2:return n.sent(),[4,z(u,r)];case 3:return n.sent(),function(t,e){var n=t.style;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width="".concat(e.width,"px")),e.height&&(n.height="".concat(e.height,"px"));var r=e.style;null!=r&&Object.keys(r).forEach((function(t){n[t]=r[t]}))}(u,r),[4,v(u,i,o)];case 4:return[2,n.sent()]}}))}))}function et(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u,c,a,f,d,v;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,tt(t,r)];case 1:return[4,h(n.sent())];case 2:return u=n.sent(),c=document.createElement("canvas"),a=c.getContext("2d"),f=r.pixelRatio||function(){var t,e;try{e=process}catch(t){}var n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),d=r.canvasWidth||i,v=r.canvasHeight||o,c.width=d*f,c.height=v*f,r.skipAutoScale||function(t){(t.width>l||t.height>l)&&(t.width>l&&t.height>l?t.width>t.height?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l):t.width>l?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l))}(c),c.style.width="".concat(d),c.style.height="".concat(v),r.backgroundColor&&(a.fillStyle=r.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(u,0,0,c.width,c.height),[2,c]}}))}))}t.getFontEmbedCSS=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Y(t,r)]}))}))},t.toBlob=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[4,f(e.sent())];case 2:return[2,e.sent()]}}))}))},t.toCanvas=et,t.toJpeg=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL("image/jpeg",r.quality||1)]}}))}))},t.toPixelData=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,et(t,r)];case 1:return u=n.sent(),[2,u.getContext("2d").getImageData(0,0,i,o).data]}}))}))},t.toPng=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL()]}}))}))},t.toSvg=tt}));`),o.join("")}function ht(o,e,t=1){try{if(!fs.existsSync(o))return;if(!fs.existsSync(e)){let r=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-init-"));try{let i=path.join(r,path.basename(o));fs.copyFileSync(o,i),c({sync:!0,gzip:{level:t},file:e,cwd:r,portable:!0},[path.basename(o)])}finally{fs.rmSync(r,{recursive:!0,force:!0})}return}let n=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-append-"));try{x({file:e,cwd:n,sync:!0});let r=path.join(n,path.basename(o));fs.copyFileSync(o,r),c({gzip:!0,file:e,cwd:n,sync:!0,portable:!0},fs.readdirSync(n))}finally{fs.rmSync(n,{recursive:!0,force:!0})}}catch(n){console.error(`ARCHIVE_FAILURE: ${n.message}`)}}function he(){try{let e=new Error().stack,t="ana-logger",n=!1,r=null,i,s=[];if(e){let a=e.split(`
3
- `),u=null;if(a.length>=3){let f=0;for(let d=0,h=a.length;d<h;d++){let g=a[d],p=g.split(":");if(p.length<3){s.push(g);continue}if(f=d,u=p[p.length-3],g.indexOf(t)===-1)break;if(g.indexOf("getInvocationLine")===-1){n=!0,t=u.split(/[\\/]/).pop();break}break}for(let d=f+1,h=a.length;d<h;d++){let g=a[d];if(g.indexOf(u)>-1)continue;let p=g.split(":");if(p.length<3)continue;i=s.join(`
4
- `)+a.slice(d).join(`
5
- `);let L=parseInt(p.pop()),O=parseInt(p.pop()),P=p.pop(),I=p.pop().split(" "),V=null;for(let _=0;_<I.length;_++){let H=I[_];if(!!H&&H.indexOf("at")!==0){V=H;break}}r={file:P,line:O,col:L,method:V,isMinified:n,stack:i};break}return r}}}catch{}return null}function Ne(o=8){try{let e=he();if(!e)return`LID${Date.now()}`;let n=e.method.split(".")[0].toUpperCase().substring(0,3);if(n.length>=o)return n.substring(0,o);let r=`${n}:${e.line}`;if(r.length>=o)return r=r.replaceAll(":",""),r.substring(0,o);let i=`${n}:${e.line}:${e.col}`;return i.length>o?i.substring(0,o).endsWith(":")?`${n}${e.line}:${e.col}`.substring(0,o):i.substring(0,o):`${n}${e.line}:${e.col}`.substring(0,o)}catch{return`ERR_LID${Date.now()}`}}function Fe(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?$.NODE:$.BROWSER}var gt=Fe();function pt(){return gt===$.NODE}var mt=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],G,S,C,F,w,ee,Ie,te,Me,l=class{constructor({name:e="default"}={}){A(this,ee);A(this,te);m(this,"system","");m(this,"instanceId","");m(this,"instanceName","");m(this,"logIndex",0);m(this,"logCounter",0);A(this,S,[]);A(this,C,{...T});A(this,F,{});m(this,"activeTargets",[Object.values(T)]);m(this,"indexColor",0);m(this,"format","");m(this,"keepLog",!1);m(this,"logHistory",[]);m(this,"$containers",null);m(this,"options",{hideHookMessage:!1});A(this,w,{log:!1,info:!1,warn:!1,error:!1});m(this,"originalFormatFunction");m(this,"forceLidOn",!1);m(this,"resolveLineCall",!1);m(this,"resolveErrorLineCall",!1);m(this,"removeDomOldEntries",e=>{if(e.childElementCount>le){let n=Math.ceil(le/10);for(let r=0;r<n;++r)e.removeChild(e.firstChild);return n}return 0});m(this,"scrollDivToBottom",e=>{let t=e.scrollHeight-(e.clientHeight+e.scrollTop),n=e.clientHeight||e.offsetHeight;t>n/2||(e.scrollTop=e.scrollHeight)});this.system=Fe(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=e,this.instanceId=l.instanceCount+"-"+Date.now(),y(l,G)[l.instanceCount]=this,++l.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),l.Console||(l.Console={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug,table:console.table}),this.rawLog=l.Console.log,this.rawInfo=l.Console.info,this.rawWarn=l.Console.warn,this.rawError=l.Console.error,this.ALIGN=l.ALIGN,this.ENVIRONMENT_TYPE=l.ENVIRONMENT_TYPE,ie(this,te,Me).call(this),this.resetLogHistory()}getName(){return this.instanceName}getId(){return this.instanceId}forceLid(e=!0){this.forceLidOn=!!e}forceResolveLineCall(e=!0){this.resolveLineCall=!!e}forceResolveErrorLineCall(e=!0){this.resolveErrorLineCall=!!e}importLids(e){for(let t in e){let n=e[t]||{};n.lid=n.lid||t,n.callCount=0,n.callTimes=[],l.lidTable[t]=n}l.lidTableOn=!0}loadLids(e){e=e||{},this.importLids(e)}convertTimestampToDate(e){let t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),u=String(t.getSeconds()).padStart(2,"0"),f=String(t.getMilliseconds()).padStart(3,"0");return`${n}-${r}-${i} ${s}:${a}:${u}.${f}`}getLids(){let e={...De.lidTable};for(let t in e){let n=e[t]||{};if(n.callTimes.length){n.dates=[];for(let r=0;r<n.callTimes.length;++r){let i=n.callTimes[r],s=this.convertTimestampToDate(i);n.dates.push(s)}}}return e}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}addToLogHistory(e){e=e||{},this.logHistory.push(Object.assign({},e))}getLogHistory(e=!0,t=at){let n=this.logHistory||[],r=[];return n.forEach(i=>{let{text:s}=i;r.push(s)}),e?r.join(t):r}getRawLogHistory(){return this.logHistory||[]}hasSeenLid(e){this.logHistory=this.logHistory||[];for(let t=0;t<this.logHistory.length;++t){let r=(this.logHistory[t]||{}).context||{};if(e===r.lid)return!0}return!1}forceEnvironment(e){this.forcedSystem=e}isNode(){return this&&this.forcedSystem?this.forcedSystem===$.NODE:pt()}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=12,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logMaxSize=0,this.options.logMaxArchives=3,this.options.logIndexArchive=0,this.options.logToRemote=void 0,this.options.addArchiveTimestamp=!0,this.options.addArchiveIndex=!0,this.options.logToRemoteUrl=void 0,this.options.logToRemoteBinaryUrl=void 0,this.options.compressArchives=!1,this.options.compressionLevel=1,this.options.protocol=void 0,this.options.host=void 0,this.options.port=void 0,this.options.pathname=void 0,this.options.binarypathname=void 0,this.options.enableDate=void 0,this.options.logToLocalStorage=void 0,this.options.logToLocalStorageMax=50}resetOptions(){this.resetLogger()}setOptions({contextLenMax:e=10,idLenMax:t=5,lidLenMax:n=6,symbolLenMax:r=2,enableTrace:i=!0,messageLenMax:s=void 0,hideLog:a=void 0,hideError:u=void 0,hideHookMessage:f=void 0,hidePassingTests:d=void 0,logToDom:h=void 0,logToFile:g=void 0,logMaxSize:p=0,logMaxArchives:L=3,logIndexArchive:O=0,addArchiveTimestamp:P=!0,addArchiveIndex:q=!0,compressArchives:I=!1,compressionLevel:V=1,logToRemote:_=void 0,logToRemoteUrl:H=void 0,logToRemoteBinaryUrl:ke=void 0,loopback:Pe=E.loopback,requiredLogLevel:_e=b.LOG,oneConsolePerContext:He=void 0,silent:ge=void 0,enableDate:Ue=void 0,logToLocalStorage:je=void 0,logToLocalStorageMax:$e=50,protocol:Be=void 0,host:Ge=void 0,port:qe=void 0,pathname:Ve=void 0,binarypathname:ze=void 0,loadHtmlToImage:We=!1}=null){if(this.options.contextLenMax=e,this.options.idLenMax=t,this.options.lidLenMax=n,this.options.messageLenMax=s,this.options.symbolLenMax=r,this.options.logMaxSize=p,this.options.logMaxArchives=L,this.options.logIndexArchive=O,this.options.addArchiveTimestamp=P,this.options.addArchiveIndex=q,this.options.compressArchives=I,this.options.compressionLevel=V,this.options.requiredLogLevel=_e,this.options.enableTrace=i,this.options.logToLocalStorageMax=$e,We){let N=dt();ft(N)}let ne;ge!==void 0?ne=!!ge:a!==void 0&&(ne=!!a),[{hideLog:ne},{oneConsolePerContext:He},{hideError:u},{enableDate:Ue},{hideHookMessage:f},{hidePassingTests:d},{logToRemote:_},{logToLocalStorage:je}].forEach(N=>{let U=Object.keys(N)[0],j=N[U];j!==void 0&&(this.options[U]=!!j)}),[{logToRemoteBinaryUrl:ke},{logToRemoteUrl:H},{loopback:Pe},{protocol:Be},{host:Ge},{port:qe},{pathname:Ve},{binarypathname:ze}].forEach(N=>{let U=Object.keys(N)[0],j=N[U];j!==void 0&&(this.options[U]=j)}),this.options.logToRemote&&!this.options.logToRemoteUrl&&(this.options.logToRemoteUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.pathname})),this.options.logToRemote&&!this.options.logToRemoteBinaryUrl&&(this.options.logToRemoteBinaryUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.binarypathname||E.binarypathname})),h===!1?this.options.logToDom=!1:h!==void 0&&(this.options.logToDom=h===!0?E.consoleDomId:h),g===!1?this.options.logToFile=!1:g!==void 0&&(this.isBrowser()||(this.options.logToFile=g||E.logFilename),l.Console.log("LogToFile is not supported in this environment. "))}updateOptions(e){this.setOptions({...this.options,...e})}getOptions(){return this.options}truncateMessage(e="",{fit:t=0,align:n=l.ALIGN.LEFT,ellipsis:r="..."}={}){return e=""+e,t&&e.length>t&&(e=e.substring(0,t-r.length)+r),e=n===l.ALIGN.LEFT?e.padEnd(t," "):e.padStart(t," "),e}onBuildLog({contextName:e,message:t="",lid:n="",symbol:r=""}={}){try{let i="",s=t.split(/\n/g);for(let a=0;a<s.length;++a){let u=s[a],f=new Date,d=("0"+f.getHours()).slice(-2)+":"+("0"+f.getMinutes()).slice(-2)+":"+("0"+f.getSeconds()).slice(-2);this.options.enableDate&&(d=f.getFullYear().toString().slice(-2)+"-"+(f.getMonth()+1).toString().padStart(2,"0")+"-"+f.getDate().toString().padStart(2,"0")+" "+d),d=this.truncateMessage(d,{fit:this.options.timeLenMax}),a>0&&(e="",n=""),e=this.truncateMessage(e,{fit:this.options.contextLenMax,align:l.ALIGN.RIGHT}),n=this.truncateMessage(n,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(u=this.truncateMessage(u,{fit:this.options.messageLenMax})),r=this.truncateMessage(r,{fit:this.options.symbolLenMax}),a<=0?i+=`[${d}] ${e}: (${n}) ${r} ${u}`:a<s.length-1?(i+=`
6
- `,i+=`[${d}] ${e} ${n} ${u}`):u&&(i+=`
7
- `,i+=`[${d}] ${e} ${n} ${u}`)}return i}catch(i){l.Console.error(`ANALOGGER_FAILURE_1001: ${i.message}`)}return""}onErrorForUserTarget(e,...t){this.errorUserTargetHandler(e,...t)}onError(e,...t){e.target===y(this,C).USER&&this.onErrorForUserTarget(e,...t)}onDisplayLog(...e){this.log(...e)}assistStask(e){try{let t=e.stack.split(`
8
- `),n=[];for(let r=0;r<t.length;++r){let i=t[r];n.push(i)}return n}catch(t){l.Console.error(`ANALOGGER_FAILURE_1002: ${t.message}`)}return e.message}onDisplayError(...e){try{let t=-1,n=null;for(let r=0;r<e.length;++r){let i=e[r];if(i instanceof Error&&i.stack){t=r,n=this.assistStask(i)||[];break}}if(!n){this.error(...e);return}for(let r=0;r<n.length;++r)e[t]=n[r],this.error(...e)}catch(t){l.Console.error(`ANALOGGER_FAILURE_1003: ${t.message}`)}}setLogFormat(e){if(typeof e!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=e.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(e){this.errorTargetHandler=e.bind(this)}setErrorHandlerForUserTarget(e){this.errorUserTargetHandler=e.bind(this)}isContextValid(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null?e.hasOwnProperty("contextName")&&e.hasOwnProperty("target"):!1}setDefaultContext(e){this.setContext(B.DEFAULT.contextName,e)}generateDefaultContext(){let e=y(this,S)[B.DEFAULT.contextName]||{};return e=Object.assign({},{lid:"",contextName:B.DEFAULT.contextName,target:T.ALL,symbol:"\u26A1",color:k[1],logLevel:b.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=k[this.indexColor++%(k.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=B.ERROR.contextName,e.name=e.contextName,e.color=k[0],e.symbol="\u274C",e.error=!0,e.logLevel=b.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=ie(this,ee,Ie).call(this,t),y(this,S)[e]=t}getContext(e){return y(this,S)[e]}setContexts(e){Object.keys(e).forEach(n=>{let r=e[n]||{};this.setContext(n,r),e[n]=y(this,S)[n]})}getContexts(){return Object.freeze(y(this,S))}setTargets(e={}){let t={};if(Array.isArray(e))try{for(let n=0;n<e.length;++n){let r=e[n];if(typeof r=="string"||r instanceof String)t[r]=r;else if(typeof r=="object"){let i=null;for(let s in r){let a=r[s];if(s=s.trim(),!s){console.error("Invalid target");break}if(typeof a=="string"||a instanceof String){a=a.trim(),i=[s,a];break}if(typeof a=="number")break}i&&(t[i[0]]=i[1])}}}catch(n){console.error({lid:4321},n.message)}else t=e;oe(this,C,Object.assign({},t,{...T}))}addTargets(e){let t=y(this,C),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(y(this,C))}setActiveTargets(e=null){if(e==null){this.activeTargets=[T.ALL];return}if(typeof e=="function"&&(e=e.call(this)),e===null){this.activeTargets=[T.ALL];return}else if(typeof e=="string"||e instanceof String)e=e.split(",");else if(typeof e=="function")e=e.call(this);else if(typeof e=="object")e=Object.values(e);else if(!Array.isArray(e))return;let t=[];for(let n=0;n<e.length;++n){let r=e[n].trim();Object.values(y(this,C)).includes(r)&&t.push(r)}this.activeTargets=t}getActiveTargets(){return this.activeTargets}getActiveTarget(){return(this.getActiveTargets()||[])[0]||T.NONE}setActiveTarget(e){this.activeTargets=[],this.setActiveTargets(e);let t=this.activeTargets[0]||T.NONE;this.activeTargets=[t]}setLogLevel(e,t){y(this,F)[e]=t}getLogLevel(e){return y(this,F)[e]}setLogLevels(e){oe(this,F,e)}getLogLevels(){return Object.freeze(y(this,F))}isTargetAllowed(e){return e===T.NONE?!1:e===T.ALL||this.getActiveTarget()===T.ALL?!0:this.activeTargets.includes(e)}getCurrentTime(){let e=new Date,t=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),r=String(e.getSeconds()).padStart(2,"0");return`${t}:${n}:${r}`}getCurrentDate(){let e=new Date,t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear()).slice(-2);return`${t}-${n}-${r}`}setColumns(e,t,n){let r=1,i=!1;for(let a in t){if(!["contextName","symbol","lid","text","enableDate","enableTime"].includes(a))continue;let u=t[a];a==="enableDate"&&(u=this.getCurrentDate()+" "+this.getCurrentTime()),a==="enableTime"&&(u=this.getCurrentTime());let f=document.createElement("span");f.classList.add("analogger-col",`analogger-col-${a}`,`analogger-col-${r}`),++r,a!=="enableDate"&&a!=="enableTime"?(f.textContent=u,e.append(f)):(f.textContent=`[${u}]`,i=f)}i&&(i.classList.add("analogger-col","analogger-col-time","analogger-col-0"),e.prepend(i));let s=document.createElement("span");s.classList.add("analogger-col","analogger-col-text",`analogger-col-${r}`),s.textContent=n,e.append(s);for(let a=1;a<=3;++a)s=document.createElement("span"),s.classList.add("analogger-col","analogger-col-extra",`analogger-extra-${a}`),e.append(s)}checkOnLoggingToDom(e,t){try{let n=e.onLoggingToDom;return typeof n!="function"?void 0:n.call(this,e,t)}catch{}}addLineToDom(e,t,{context:n,addType:r,message:i,text:s,args:a}){if(this.checkOnLoggingToDom(n,{message:i,text:s,args:a,logCounter:this.logCounter,$view:e,$line:t,addType:r})===!1)return;if(r===K.BOTTOM?e.append(t):e.insertBefore(t,e.firstChild),this.removeDomOldEntries(e)){if(e.getElementsByClassName(ce).length)return;this.showRemovedNotification(n);return}this.scrollDivToBottom(e)}showRemovedNotification(e){e.contextName=Oe,e.symbol="\u{1F5D1}",e.color="orange",e.className=ce,clearTimeout(this.timerAddLineToDomID),this.timerAddLineToDomID=setTimeout(()=>{this.timerAddLineToDomID=null,this.writeLogToDom(e,"",{addType:K.TOP,message:"Oldest entries removed"})},500)}writeLogToDom(e,t,{addType:n=K.BOTTOM,message:r="",args:i=null}={}){this.$containers=this.$containers||document.querySelectorAll(this.options.logToDom),t=r||t;for(let s=0;s<this.$containers.length;++s){let a=this.$containers[s],u=a.querySelector("."+ue);u||(u=document.createElement("div"),u.classList.add(ue),u.append(document.createElement("span")),u.append(document.createElement("span")),u.append(document.createElement("span")),a.append(u));let f=a.querySelector("."+fe);f||(f=document.createElement("div"),f.classList.add(fe),a.append(f));let d=a.querySelector("."+de);d||(d=document.createElement("div"),d.classList.add(de),d.append(document.createElement("span")),d.append(document.createElement("span")),d.append(document.createElement("span")),a.append(d));let h=document.createElement("div");h.classList.add(Se),e.className&&h.classList.add(e.className),h.style.color=e.color,this.setColumns(h,e,t,i),setTimeout(function(g,p,{addType:L,context:O,message:P,text:q,args:I}){this.addLineToDom(g,p,{addType:L,context:O,message:P,text:q,args:I})}.bind(this,f,h,{addType:n,context:e,message:r,text:t,args:i}),0)}}writeLogToFile(e){try{if(!fs.existsSync(this.options.logToFilePath)){let t=path.dirname(this.options.logToFilePath);fs.existsSync(t)||fs.mkdirSync(t,{recursive:!0}),fs.writeFileSync(this.options.logToFilePath,"")}if(this.options.logMaxSize&&fs.statSync(this.options.logToFilePath).size>this.options.logMaxSize){this.options.logIndexArchive<this.options.logMaxArchives?++this.options.logIndexArchive:this.options.logIndexArchive=1;let r=this.options.logMaxArchives.toString().length+1,{filePath:i,extension:s,basename:a,dirname:u}=lt(this.options.logToFilePath),f,d;f=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(r,"0"):"",d=this.options.addArchiveTimestamp?"."+ct():"";let h=`${i}${d}${f}${s}`,g=this.options.compressArchives?`${i}.tar.gz`:"";ut(u,a,f,s,g,this.options.compressionLevel,p=>{p&&console.error("DELETION_FAILURE: Failed to delete some files")}),fs.renameSync(this.options.logToFilePath,h),fs.writeFileSync(this.options.logToFilePath,"")}fs.appendFileSync(this.options.logToFilePath,e+this.EOL)}catch(t){l.Console.error("LOG_TO_FILE_FAILURE: ",t.message)}}writeLogToRemote(...e){try{let t=this.generateLogToRemoteUrl(this.options.logToRemoteUrl);if(!t)return null;let n=[...e],r=JSON.stringify(n);fetch(t,{method:"post",body:r,headers:{"Content-Type":"application/json"}}).then(i=>i.json()).catch(()=>null)}catch(t){l.Console.error("LOG_TO_REMOTE_FAILURE: ",t.message)}}writeLogToLocalStorage(e,...t){try{if(!this.isBrowser()||!window.localStorage)return;let n=`analogger_history_${this.instanceName}`,r=[];try{let s=localStorage.getItem(n);s&&(r=JSON.parse(s))}catch{r=[]}r.push({context:e,args:t});let i=this.options.logToLocalStorageMax||50;r.length>i&&(r=r.slice(r.length-i)),localStorage.setItem(n,JSON.stringify(r))}catch(n){l.Console.error("LOG_TO_LOCAL_STORAGE_FAILURE: ",n.message)}}restoreLogs(){try{if(!this.isBrowser()||!window.localStorage)return;let e=`analogger_history_${this.instanceName}`,t=localStorage.getItem(e);if(!t)return;let n=JSON.parse(t);if(!Array.isArray(n))return;let r=this.options.logToLocalStorage;this.options.logToLocalStorage=!1,n.forEach(i=>{let{context:s,args:a}=i;s&&(s.symbol="floppy_disk"),this.processOutput(s,...a)}),this.options.logToLocalStorage=r}catch(e){l.Console.error("RESTORE_LOGS_FAILURE: ",e.message)}}uploadDataToRemote(e,t=null,n=null){try{if(!this.options.logToRemote)return;let r=this.generateLogToRemoteUrl(this.options.logToRemoteBinaryUrl,{pathname:E.binarypathname});if(!r)return null;let i=e;t&&(i=JSON.stringify({raw:e,context:t})),fetch(r,{method:"post",body:i}).then(s=>s.json()).then(s=>n&&n(s)).catch(s=>s)}catch(r){l.Console.error("BINARY_TO_REMOTE_FAILURE: ",r.message)}}stringifyEntry(e){let t;try{t=JSON.stringify(e)}catch{}if(!t)try{t=Re(e)}catch{}return t}convertEntry(e){try{if(e==null||e==="")return e;if(typeof e=="boolean")return e;if(typeof e=="symbol"||typeof e=="number")return e;if(typeof e=="string"||myVar instanceof e)return e;if(e instanceof Date)return e}catch{}return this.stringifyEntry(e)}convertArgumentsToText(e){let t=[],n,r=e.length;for(let i=0;i<r;++i){let s,a=e[i];s=this.convertEntry(a),t.push(s)}return n=t.join("\u2022"),n}writeToConsole(e,t){let n=[e];this.isBrowser()&&n.push(`color: ${t.color}`);let r=t.contextLevel||b.LOG;r>=b.ERROR?l.Console.error(...n):r>=b.WARN?l.Console.warn(...n):r>=b.INFO?l.Console.info(...n):r>=b.LOG?l.Console.log(...n):r>=b.DEBUG&&l.Console.debug(...n)}checkPlugins(e,{message:t,text:n,args:r,logCounter:i}){try{if(!Object.keys(l.pluginTable).length)return;let s=!0;for(let a in e){let u=e[a];if(!u)continue;let f=l.pluginTable[a];if(!f||typeof f!="object")continue;let{callback:d,methodName:h,type:g}=f;if(typeof d!="function")continue;d.call(this,e,{message:t,text:n,args:r,logCounter:i,methodName:h,type:g,pluginOptions:u})===!1&&(s=!1)}return s}catch{}}checkOnLogging(e,t,n,r){if(!!r)try{let i=e[r];return typeof i!="function"?void 0:i.call(this,t,n)}catch{}}isContextMessagePattern(e){return/\{\{[^}]+}}/.test(e)}transformContextMessage(e,t){let n=e;for(let r in t){let i=`{{${r}}}`,s=t[r];n=n.replaceAll(i,s)}return n}processOutput(e={},...t){try{let n="";if(l.lidTableOn&&e.lid){let f=l.lidTable[e.lid];f?(e.message=e.message||f.message,f.callCount=f.callCount||0,++f.callCount,f.callTimes.push(Date.now())):l.lidTable[e.lid]={...e,message:t[0],lid:e.lid,callCount:1,callTimes:[Date.now()]}}if(e.message&&(this.isContextMessagePattern(e.message)&&t.length>=1&&typeof t[0]=="object"&&(e.message=this.transformContextMessage(e.message,t[0]),t.shift()),t.unshift(e.message)),this.applySymbolByName(e),this.checkOnLogging(e,e,t,"onContext"),!this.isTargetAllowed(e.target)||e.logLevel===b.OFF||this.options.requiredLogLevel>e.logLevel)return;let r=this.checkOnLogging(e,t[0],arguments,"onMessage");r!==void 0&&(arguments[1]=r);let i=t;n=this.convertArgumentsToText(i);let s="",a=this.format({...e,message:n});this.keepLog&&this.addToLogHistory({context:e,message:n,text:a}),++this.logCounter;let u=this.checkOnLogging(e,a,{message:n,args:i,logCounter:this.logCounter},"onOutput");if(u===!1||((typeof u=="string"||u instanceof String)&&(a=u),u=this.checkPlugins(e,{message:n,text:a,args:i,logCounter:this.logCounter}),u===!1)||(this.options.logToRemote&&this.writeLogToRemote(e,...i),this.options.logToLocalStorage&&this.writeLogToLocalStorage(e,...i),this.isBrowser()?(e.environnment=l.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(e,a,{message:n,args:i}),s=`%c${a}`):(e.environnment=l.ENVIRONMENT_TYPE.NODE,s=X.getTextFromColor(a,{fg:e.color,bg:e.bgColor,isBold:e.bold,isUnderline:e.underline,isReversed:e.reversed}),this.options.logToFile&&this.writeLogToFile(a)),this.options.hideLog||e.hideLog||e.silent))return;this.writeToConsole(s,e),this.errorTargetHandler(e,i)}catch{}}isExtendedOptionsPassed(e){return typeof e!="object"?!1:e.hasOwnProperty("context")||e.hasOwnProperty("target")||e.hasOwnProperty("color")||e.hasOwnProperty("contextName")||e.hasOwnProperty("raw")||e.hasOwnProperty("lid")}stringToObject(e){try{if(e=e.trim(),e.startsWith("{")&&e.endsWith("}")&&(e=e.slice(1,-1).trim()),!e)return{};let t={},n=e.split(",");for(let r of n){let i=r.trim().split(":");if(i.length<2){if(i.length===2){let d=i[0].trim().replace(/^['"]|['"]$/g,"");t[d]=i[1].trim().replace(/^['"]|['"]$/g,"")}else if(i.length===1&&Object.keys(t).length>0){let d=Object.keys(t).pop();t[d]instanceof Array?t[d].push(i[0].trim().replace(/^['"]|['"]$/g,"")):t[d]=[t[d],i[0].trim().replace(/^['"]|['"]$/g,"")]}continue}let s=i[0],a=i.slice(1).join(":"),u=s.trim().replace(/^['"]|['"]$/g,""),f=a.trim().replace(/^['"]|['"]$/g,"");!isNaN(f)&&!isNaN(parseFloat(f))?t[u]=parseFloat(f):t[u]=f}return t}catch{return null}}extractContextFromInput(e){if(typeof e=="string"||e instanceof String){if(e.toLowerCase().indexOf("lid:")!==0)return e;let t=this.stringToObject(e);t&&(e=t)}if(typeof e=="object"&&!Array.isArray(e)&&e!==null&&this.isExtendedOptionsPassed(e)){if(e.contextName){let t=y(this,S)[e.contextName];t&&(e=Object.assign({},t,e))}e.target||(e.target=this.getActiveTarget())}return e}listSymbols(){for(let e in Z)console.rawLog(Z[e]+` ${e} `)}applySymbolByName(e){try{e.symbol&&Z[e.symbol]&&(e.symbol=Z[e.symbol])}catch{}}convertToContext(e,t){e=e||t;let n=e;if(e.context&&typeof e.context=="object"){let r=Object.assign({},e);delete r.context,n=Object.assign({},e.context,r)}return n=Object.assign({},t,n),delete n.context,n}log(e,...t){if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateDefaultContext();this.processOutput.apply(this,[s,e,...t]);return}(!t||!t.length)&&(t=[e]),e={lid:Ne(this.options.lidLenMax)}}let n=this.generateDefaultContext(),r=this.convertToContext(e,n);if(r.raw){l.Console.log(...t);return}this.resolveLineCall&&(this.resolveErrorLineCall||(r.stack=he())),this.processOutput.apply(this,[r,...t])}error(e,...t){if(this.options.hideError)return;if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateErrorContext();this.processOutput.apply(this,[s,e,...t]);return}e={lid:Ne(this.options.lidLenMax)}}let n=this.generateErrorContext(),r=this.convertToContext(e,n);this.resolveErrorLineCall&&(r.stack=he()),this.log(r,...t),this.options.enableTrace&&console.trace(...t)}overrideError(){this.options.hideHookMessage||l.Console.log("AnaLogger: Hook placed on console.error"),y(this,w).error=!0,console.error=this.onDisplayError.bind(this)}attachConsole(){try{return console.rawLog=l.Console.log,console.raw=l.Console.log,console.rawInfo=l.Console.info,console.rawWarn=l.Console.warn,console.rawError=l.Console.error,console.logHistory=this.logHistory,console.logHistory=this.logHistory,mt.forEach(e=>{console[e]=function(...t){this[e](...t)}.bind(this)}),!0}catch(e){console.error({lid:4321},e.message)}return!1}overrideConsole({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){this.options.hideHookMessage||l.Console.log("AnaLogger: Hook placed on console.log"),[{log:e},{info:t},{warn:n}].forEach(function(i){let s=Object.keys(i)[0];i[s]&&(y(this,w)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),r&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=l.Console.error,y(this,w).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){e&&(console.log=l.Console.log,y(this,w).log=!1),t&&(console.info=l.Console.info,y(this,w).info=!1),n&&(console.warn=l.Console.warn,y(this,w).warn=!1),r&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!y(this,w).log){l.Console.table(...e);return}let t=console.log;console.log=l.Console.log,l.Console.table(...e),console.log=t}takeScreenshot(e={selector:"body",quality:.95,canvasHeight:480,canvasWidth:640}){return new Promise((t,n)=>{if(!this.isBrowser())return;let r="";if(!htmlToImage){r="MISSING_HTML_IMAGE_LIBRARY: htmlToImage is not defined. Please install it first.",l.Console.error(r),n(new Error);return}let{selector:i,quality:s,canvasHeight:a,canvasWidth:u}=e,f=document.querySelector(i),d={quality:s,canvasHeight:a,canvasWidth:u};htmlToImage.toPng(f,d).then(function(h,g){this.uploadDataToRemote(g,h,p=>{t({imageData:g,serverResponse:p})})}.bind(this,e)).catch(function(h){r=`IMAGE_PROCESSING_FAILURE: ${h.message}`,l.Console.error(r),n(new Error(r))})})}alert(...e){if(!this.isBrowser())return this.log(...e);let t;if(e&&(e[0]&&e[0].hasOwnProperty("lid")||this.isContextValid(e[0]))){let n=this.generateDefaultContext();t=this.convertToContext(e[0],n).lid+": "+e.slice(1).join(" | ")}else t=e.join(" | ");alert(t)}assert(e,t=!0,...n){let r;try{return typeof e=="function"?(r=e(...n),r!==t?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):e!==t?(this.error("Assert failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)}catch{this.error("Unexpected error in assert")}return!1}applyAnalogFormatting({activeTarget:e="",override:t=!1}={}){try{let r={STANDARD:null,TEST:{color:"#B18904",symbol:"diamonds"}};return this.setDefaultContext(r.DEFAULT),e&&this.setActiveTarget(e),this.setOptions({silent:!1,hideError:!1,hideHookMessage:!0,lidLenMax:6}),t&&(this.overrideConsole(),this.overrideError()),!0}catch(n){console.error({lid:3249},n.message)}return!1}applyPredefinedFormat(e=Q.DEFAULT_FORMAT,{activeTarget:t="",override:n=!1}={}){if(e===Q.DEFAULT_FORMAT)return this.applyAnalogFormatting({activeTarget:t,override:n})}static generateInstance(){return new l}static getInstance(e=0){return l.instanceCount?y(l,G)[e]:null}static generateMainInstance(){let e=l.getInstance();return e||new l}static startLogger(){l.generateMainInstance().applyPredefinedFormat(Q.DEFAULT_FORMAT,{override:!0})}static stopLogger(){let e=l.generateMainInstance();e.removeOverride(),e.removeOverrideError()}convertToUrl({protocol:e=E.protocol,host:t=E.host,port:n=E.port,pathname:r=E.pathname}={}){let i=new URL("http://localhost");return i.protocol=e,i.host=t,i.port=n,r&&(i.pathname=r),i.toString()}generateLogToRemoteUrl(e=null,{pathname:t=E.pathname}={}){if(typeof e=="string"||e instanceof String)return e;if(!this.isBrowser())return null;let n=this.options.protocol||window.location.protocol+"//",r=this.options.host||window.location.host||E.host,i=this.options.port||E.port;return t=this.options.pathname||t,this.convertToUrl({protocol:n,host:r,port:i,pathname:t})}addPlugin(e,t,n=""){n=n||e,this[e]=t,l.pluginTable[n]={type:Ce.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){l[e]=t,l.pluginTable[n]={type:Ce.GLOBAL,methodName:e,callback:t}}getPluginList(){return Object.keys(l.pluginTable)}validatePlugin(e){return l.pluginTable[e]?!0:(console.warn(`The plugin ${e} is not registered`),!1)}},v=l;G=new WeakMap,S=new WeakMap,C=new WeakMap,F=new WeakMap,w=new WeakMap,ee=new WeakSet,Ie=function(e){let t=this.generateNewContext(),n=Object.assign({},t,e);return n.color.toLowerCase().indexOf("rgb")>-1?n.color=X.rgbStringToHex(n.color):n.color.indexOf("#")===-1&&(n.color=X.colorNameToHex(n.color)),n},te=new WeakSet,Me=function(){try{this.setTargets(T),this.setLogLevels(b),this.setContexts(B)}catch(e){console.error({lid:4321},e.message)}return!1},A(v,G,[]),m(v,"Console",null),m(v,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m(v,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),m(v,"instanceCount",0),m(v,"pluginTable",{}),m(v,"lidTable",{}),m(v,"lidTableOn",!1);var De=v,xt=De,Rt=v.generateMainInstance();var Ct=v;export{Ct as AnaLogger,B as DEFAULT_LOG_CONTEXTS,b as DEFAULT_LOG_LEVELS,T as DEFAULT_LOG_TARGETS,Rt as anaLogger,xt as default};
1
+ var Ke=Object.defineProperty;var Qe=(o,e,t)=>e in o?Ke(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var m=(o,e,t)=>(Qe(o,typeof e!="symbol"?e+"":e,t),t),re=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var y=(o,e,t)=>(re(o,e,"read from private field"),t?t.call(o):e.get(o)),A=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},oe=(o,e,t,n)=>(re(o,e,"write to private field"),n?n.call(o,t):e.set(o,t),t);var ie=(o,e,t)=>(re(o,e,"access private method"),t);var pe={Foreground:38,Background:48},R="\x1B[1D",me="\x1B[0m"+R,V={Bold:"\x1B[1m"+R,Underline:"\x1B[4m"+R,Reversed:"\x1B[7m"+R},Ze={Bold:"\x1B[1m"+R,Underline:"\x1B[4m"+R,Reversed:"\x1B[7m"+R},se={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function et(o){return!!se[o]}var ye=(o,e,t)=>o===e&&e===t?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(e/255*5)+Math.round(t/255*5),be=o=>{let e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;o=o.replace(e,function(n,r,i,s){return r+r+i+i+s+s});let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return t?{red:parseInt(t[1],16),blue:parseInt(t[2],16),green:parseInt(t[3],16)}:{}},ve=function({red:o,green:e,blue:t}){let n=o<<16|e<<8|t<<0;return"#"+(16777216+n).toString(16).slice(1)},Le=function(o){let e=o.matchAll(/\d+/g),t=[];for(let n of e){let r=parseInt(n[0]);if(r>255)return null;t.push(r)}return t.length!==3?null:{red:t[0],green:t[1],blue:t[2]}},tt=function(o){let e=Le(o);return e&&ve(e)},W=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e},Te=({hue:o,saturation:e,lightness:t})=>{let n,r,i;if(e===0)n=r=i=t;else{let s=t<.5?t*(1+e):t+e-t*e,a=2*t-s;n=W(a,s,o+1/3),r=W(a,s,o),i=W(a,s,o-1/3)}return{red:Math.round(n*255),blue:Math.round(i*255),green:Math.round(r*255)}},Ee=o=>{let e=o.toLowerCase();return typeof se[e]<"u"?se[e]:""};function D({red:o,blue:e,green:t},n=!0){if(o===void 0||e===void 0||t===void 0)return"";let r=ye(o,e,t);return`\x1B[${n?pe.Foreground:pe.Background};5;`+r+"m "+R}function M(o,e=!0){let{red:t,green:n,blue:r}=be(o);return D({red:t,green:n,blue:r},e)}function Y({hue:o,saturation:e,lightness:t},n){let{red:r,green:i,blue:s}=Te({hue:o,saturation:e,lightness:t});return D({red:r,green:i,blue:s},n)}function ae(o,e=!0){try{let t;return o=o||"",o?((typeof o=="string"||o instanceof String)&&(o=o.trim()),et(o)?(t=Ee(o),M(t,e)):typeof o=="object"&&!!o.red&&!!o.blue&&!!o.green?D(o,e):typeof o=="object"&&!!o.hue&&!!o.saturation&&!!o.lightness?Y(o,e):o.startsWith("#")?M(o,e):(o=o.toString(),/^[\da-fA-F]+$/.test(o)?M("#"+o,e):"")):""}catch(t){console.error("TO_ANSI_INVALID_ARGUMENT_ERROR",t.message)}}function J(o,{fg:e,bg:t,isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){let s=!1,a="";return e&&(s=!0,a=a+e),t&&(s=!0,a=a+t),n&&(s=!0,a=a+V.Underline),r&&(s=!0,a=a+V.Bold),i&&(s=!0,a=a+V.Reversed),s?a+o+me:o}function nt(o,{fg:e={},bg:t={},isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=D({...e})),t&&(t=D({...t},!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function rt(o,{fg:e="",bg:t="",isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=Y({...e})),t&&(t=Y({...t},!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function ot(o,{fg:e="",bg:t="",isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=M(e)),t&&(t=M(t,!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function it(o,e=null){if(!e)return o;let{fg:t="",bg:n="",isUnderline:r=!1,isBold:i=!1,isReversed:s=!1}=e;return t&&(t=ae(t)),n&&(n=ae(n,!1)),J(o,{fg:t,bg:n,isUnderline:r,isBold:i,isReversed:s})}var X={fromRgb:D,fromHexa:M,fromHsl:Y,fromColor:ae,getTextFromRgb:nt,getTextFromHsl:rt,getTextFromHex:ot,getTextFromColor:it,colorNameToHex:Ee,hslToRgb:Te,hexToRgb:be,rgbToHex:ve,rgbToAnsi256:ye,rgbStringToRgb:Le,rgbStringToHex:tt,hue2rgb:W,RESET:me,FONT_STYLE:V,STYLE:Ze};var we={COLOR_TABLE:["#d2466e","#FFA07A","#FF7F50","#FF6347","#FFE4B5","#ADFF2F","#808000","#40E0D0","#1E90FF","#EE82EE","#708090","#DEB887","#FE642E","#210B61","#088A4B","#5E610B","#FA8258","#088A68","#B40431"],SYSTEM:{BROWSER:"BROWSER",NODE:"NODE"}},k=we.COLOR_TABLE,$=we.SYSTEM,le=2e3,ce="analogger-removed-notif",ue="analogger-header",fe="analogger-view",he="analogger-footer",Se="to-esm-line",K={TOP:"TOP",BOTTOM:"BOTTOM"},Oe="ANALOGGER",Q={DEFAULT_FORMAT:"FORMAT1"};var{parse:wt,stringify:st}=JSON,{keys:St}=Object,at=String,lt="string";var Ae="object",ct=(o,e)=>e;var Re=(o,e,t)=>{let n=at(e.push(t)-1);return o.set(t,n),n};var xe=(o,e,t)=>{let n=e&&typeof e===Ae?(h,d)=>h===""||-1<e.indexOf(h)?d:void 0:e||ct,r=new Map,i=[],s=[],a=+Re(r,i,n.call({"":o},"",o)),u=!a;for(;a<i.length;)u=!0,s[a]=st(i[a++],f,t);return"["+s.join(",")+"]";function f(h,d){if(u)return u=!u,d;let g=n.call(this,h,d);switch(typeof g){case Ae:if(g===null)return g;case lt:return r.get(g)||Re(r,i,g)}return g}};var T={moduleName:"analogger",protocol:"http://",host:"localhost",port:12e3,pathname:"analogger",binarypathname:"uploaded",loopback:"localhost",consoleDomId:"#analogger",logFilename:"./analogger.log"},E={ALL:"ALL",USER:"USER",NONE:"NONE"},b={FATAL:5e3,ERROR:4e3,WARN:3e3,INFO:2e3,LOG:1e3,DEBUG:500,ALL:200,OFF:0,INHERIT:-1},Ce={LOCAL:"local",GLOBAL:"global"},B={DEFAULT:{contextName:"DEFAULT",logLevel:b.LOG,symbol:"check"},LOG:{contextName:"LOG",logLevel:b.LOG,symbol:"check"},DEBUG:{contextName:"DEBUG",logLevel:b.DEBUG},INFO:{contextName:"INFO",logLevel:b.INFO,color:"#B18904",symbol:"diamonds"},WARN:{contextName:"WARN",logLevel:b.WARN,color:k[0],symbol:"cross"},ERROR:{contextName:"ERROR",logLevel:b.ERROR},CRITICAL:{contextName:"CRITICAL",logLevel:b.CRITICAL}},ut=`
2
+ `,Z={airplane:"\u2708",anchor:"\u2693",announcement:"\u{1F4E2}",arrow_backward:"\u25C0",arrow_double_up:"\u23EB",arrow_double_down:"\u23EC",arrow_forward:"\u25B6",arrow_lower_right:"\u2198",arrow_lower_left:"\u2199",arrow_right_hook:"\u21AA",arrow_up_down:"\u2195",arrow_upper_left:"\u2196",arrow_upper_right:"\u2197",ballot_box_with_check:"\u2611",biohazard:"\u2623",black_circle:"\u23FA",black_medium_small_square:"\u25FE",black_medium_square:"\u25FC",black_nib:"\u2712",black_small_square:"\u25AA",black_square:"\u23F9",chains:"\u26D3",check:"\u2714",chess_pawn:"\u265F",cloud_and_rain:"\u26C8",clubs:"\u2663",coffee:"\u2615",computer:"\u{1F4BB}",computer_disk:"\u{1F4BD}",computer_mouse:"\u{1F5B1}\uFE0F",copyright:"\xA9",cross:"\u274C",desktop_computer:"\u{1F5A5}\uFE0F",diamonds:"\u2666",divisions_ign:"\u2797",double_triangle_right:"\u23ED",double_triangle_left:"\u23EE",email:"\u2709",eject:"\u23CF",envelope:"\u2709\uFE0F",exclamation_mark:"\u2757",fast_forward:"\u23E9",female_sign:"\u2640",fire:"\u{1F525}",fist:"\u270A",floppy_disk:"\u{1F4BE}",fuel_pump:"\u26FD",gear:"\u2699",hammer_and_pick:"\u2692",hand:"\u270B",hearts:"\u2665",identification_card:"\u{1F194}",infinity:"\u267E",information:"\u2139",information_source:"\u2139\uFE0F",key:"\u{1F511}",left_right_arrow:"\u2194",leftwards_arrow_with_hook:"\u21A9",lock:"\u{1F512}",male_sign:"\u2642",minus_sign:"\u2796",money_bag:"\u{1F4B0}",no_entry:"\u26D4",old_key:"\u{1F5DD}\uFE0F",partly_sunny:"\u26C5",pencil:"\u270F",phone:"\u260E",pile_of_poo:"\u{1F4A9}",plus_sign:"\u2795",question:"\u2754",radioactive:"\u2622",raised_hand:"\u270B",recycle:"\u267B",registered:"\xAE",relaxed:"\u263A",rewind:"\u23EA",scissors:"\u2702",settings:"\u2699\uFE0F",shield:"\u{1F6E1}\uFE0F",screen_with_curl:"\u{1F4DC}",snowman:"\u2603",spades:"\u2660",sparkles:"\u2728",speech_bubble:"\u{1F4AC}",squared_cancellation_mark:"\u274E",star:"\u2B50",sunny:"\u2600",tent:"\u26FA",thought_balloon:"\u{1F4AD}",trademark:"\u2122",triangle_with_vertical_bar:"\u23EF",umbrella:"\u2614",unlock:"\u{1F513}",vertical_bars:"\u23F8",watch:"\u231A",white_frowning_face:"\u2639",white_medium_square:"\u25FB",white_medium_small_square:"\u25FD",white_small_square:"\u25AB",wheelchair:"\u267F",white_circle:"\u26AA",white_square_containing_black_small_square:"\u25FD",writing_hand:"\u270D"};function ft(o){try{let e=path.extname(o),t=path.basename(o,e),n=path.dirname(o),r=o.slice(0,o.length-e.length);return{extension:e,filePath:r,basename:t,dirname:n}}catch(e){console.error("FILEPATH_EXT_FAILURE: ",e.message)}return{extension:".log",filePath:o}}function ht(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function dt(o,e,t,n,r,i,s){fs.readdir(o,(a,u)=>{if(a){s(a,null);return}let f=[],h=0,d=(p,L)=>{if(!fs.existsSync(p)){L(null,null);return}fs.unlink(p,O=>{O?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${O}`):f.push(p),h++,h===u.length&&L(null,f)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let L=path.join(o,p);r&&mt(L,r,i),d(L,s)}else h++,h===u.length&&s(null,f)};u.length===0?s(null,f):u.forEach(g,i)})}function gt(o,e={}){let t=document.createElement("script");t.textContent=o;for(let n in e)t.setAttribute(n,e[n]);document.head.appendChild(t),t.remove()}function pt(){let o=[];return o.push(`!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).htmlToImage={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}a((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var r,i=(r=0,function(){return r+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(r)});function o(t){for(var e=[],n=0,r=t.length;n<r;n++)e.push(t[n]);return e}var u=null;function c(t){return void 0===t&&(t={}),u||(u=t.includeStyleProperties?t.includeStyleProperties:o(window.getComputedStyle(document.documentElement)))}function a(t,e){var n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function s(t,e){void 0===e&&(e={});var n,r,i,o=e.width||(r=a(n=t,"border-left-width"),i=a(n,"border-right-width"),n.clientWidth+r+i),u=e.height||function(t){var e=a(t,"border-top-width"),n=a(t,"border-bottom-width");return t.clientHeight+e+n}(t);return{width:o,height:u}}var l=16384;function f(t,e){return void 0===e&&(e={}),t.toBlob?new Promise((function(n){t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((function(n){for(var r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=r.length,o=new Uint8Array(i),u=0;u<i;u+=1)o[u]=r.charCodeAt(u);n(new Blob([o],{type:e.type?e.type:"image/png"}))}))}function h(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){r.decode().then((function(){requestAnimationFrame((function(){return e(r)}))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t}))}function d(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(t)})).then(encodeURIComponent).then((function(t){return"data:image/svg+xml;charset=utf-8,".concat(t)}))]}))}))}function v(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u;return n(this,(function(n){return e="http://www.w3.org/2000/svg",o=document.createElementNS(e,"svg"),u=document.createElementNS(e,"foreignObject"),o.setAttribute("width","".concat(r)),o.setAttribute("height","".concat(i)),o.setAttribute("viewBox","0 0 ".concat(r," ").concat(i)),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),o.appendChild(u),u.appendChild(t),[2,d(o)]}))}))}var p=function(t,e){if(t instanceof e)return!0;var n=Object.getPrototypeOf(t);return null!==n&&(n.constructor.name===e.name||p(n,e))};function g(t,e,n,r){var i=".".concat(t,":").concat(e),o=n.cssText?function(t){var e=t.getPropertyValue("content");return"".concat(t.cssText," content: '").concat(e.replace(/'|"/g,""),"';")}(n):function(t,e){return c(e).map((function(e){var n=t.getPropertyValue(e),r=t.getPropertyPriority(e);return"".concat(e,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n,r);return document.createTextNode("".concat(i,"{").concat(o,"}"))}function m(t,e,n,r){var o=window.getComputedStyle(t,n),u=o.getPropertyValue("content");if(""!==u&&"none"!==u){var c=i();try{e.className="".concat(e.className," ").concat(c)}catch(t){return}var a=document.createElement("style");a.appendChild(g(c,n,o,r)),e.appendChild(a)}}var w="application/font-woff",y="image/jpeg",b={woff:w,woff2:w,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:y,jpeg:y,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function S(t){var e=function(t){var e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return b[e]||""}function E(t){return-1!==t.search(/^(data:)/)}function x(t,e){return"data:".concat(e,";base64,").concat(t)}function C(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return[4,fetch(t,r)];case 1:if(404===(e=n.sent()).status)throw new Error('Resource "'.concat(e.url,'" not found'));return[4,e.blob()];case 2:return o=n.sent(),[2,new Promise((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(){try{t(i({res:e,result:r.result}))}catch(t){n(t)}},r.readAsDataURL(o)}))]}}))}))}var P={};function R(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u,c,a;return n(this,(function(n){switch(n.label){case 0:if(e=function(t,e,n){var r=t.replace(/\\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\\//,"")),e?"[".concat(e,"]").concat(r):r}(t,r,i.includeQueryParams),null!=P[e])return[2,P[e]];i.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+(new Date).getTime()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,C(t,i.fetchRequestInit,(function(t){var e=t.res,n=t.result;return r||(r=e.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n)}))];case 2:return u=n.sent(),o=x(u,r),[3,4];case 3:return c=n.sent(),o=i.imagePlaceholder||"",a="Failed to fetch resource: ".concat(t),c&&(a="string"==typeof c?c:c.message),a&&console.warn(a),[3,4];case 4:return P[e]=o,[2,o]}}))}))}function T(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"data:,"===(e=t.toDataURL())?[2,t.cloneNode(!1)]:[2,h(e)]}))}))}function A(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return t.currentSrc?(e=document.createElement("canvas"),i=e.getContext("2d"),e.width=t.clientWidth,e.height=t.clientHeight,null==i||i.drawImage(t,0,0,e.width,e.height),[2,h(e.toDataURL())]):(o=t.poster,u=S(o),[4,R(o,u,r)]);case 1:return[2,h(n.sent())]}}))}))}function k(t,r){var i;return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(null===(i=null==t?void 0:t.contentDocument)||void 0===i?void 0:i.body)?[4,I(t.contentDocument.body,r,!0)]:[3,2];case 1:return[2,e.sent()];case 2:return[3,4];case 3:return e.sent(),[3,4];case 4:return[2,t.cloneNode(!1)]}}))}))}var L=function(t){return null!=t.tagName&&"SVG"===t.tagName.toUpperCase()};function N(t,e,n){return p(e,Element)&&(function(t,e,n){var r=e.style;if(r){var i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):c(n).forEach((function(n){var o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){var u=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o="".concat(u,"px")}p(t,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&e.getAttribute("d")&&(o="path(".concat(e.getAttribute("d"),")")),r.setProperty(n,o,i.getPropertyPriority(n))}))}}(t,e,n),function(t,e,n){m(t,e,":before",n),m(t,e,":after",n)}(t,e,n),function(t,e){p(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),p(t,HTMLInputElement)&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(p(t,HTMLSelectElement)){var n=e,r=Array.from(n.children).find((function(e){return t.value===e.getAttribute("value")}));r&&r.setAttribute("selected","")}}(t,e)),e}function I(t,r,i){return e(this,void 0,void 0,(function(){return n(this,(function(u){return i||!r.filter||r.filter(t)?[2,Promise.resolve(t).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){return p(t,HTMLCanvasElement)?[2,T(t)]:p(t,HTMLVideoElement)?[2,A(t,r)]:p(t,HTMLIFrameElement)?[2,k(t,r)]:[2,t.cloneNode(L(t))]}))}))}(t,r)})).then((function(i){return function(t,r,i){var u,c;return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return L(r)?[2,r]:(e=[],0===(e=null!=(a=t).tagName&&"SLOT"===a.tagName.toUpperCase()&&t.assignedNodes?o(t.assignedNodes()):p(t,HTMLIFrameElement)&&(null===(u=t.contentDocument)||void 0===u?void 0:u.body)?o(t.contentDocument.body.childNodes):o((null!==(c=t.shadowRoot)&&void 0!==c?c:t).childNodes)).length||p(t,HTMLVideoElement)?[2,r]:[4,e.reduce((function(t,e){return t.then((function(){return I(e,i)})).then((function(t){t&&r.appendChild(t)}))}),Promise.resolve())]);case 1:return n.sent(),[2,r]}var a}))}))}(t,i,r)})).then((function(e){return N(t,e,r)})).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c,a,s,l,f,h,d,v,p;return n(this,(function(n){switch(n.label){case 0:if(0===(e=t.querySelectorAll?t.querySelectorAll("use"):[]).length)return[2,t];i={},p=0,n.label=1;case 1:return p<e.length?(o=e[p],(u=o.getAttribute("xlink:href"))?(c=t.querySelector(u),a=document.querySelector(u),c||!a||i[u]?[3,3]:(s=i,l=u,[4,I(a,r,!0)])):[3,3]):[3,4];case 2:s[l]=n.sent(),n.label=3;case 3:return p++,[3,1];case 4:if((f=Object.values(i)).length){for(h="http://www.w3.org/1999/xhtml",(d=document.createElementNS(h,"svg")).setAttribute("xmlns",h),d.style.position="absolute",d.style.width="0",d.style.height="0",d.style.overflow="hidden",d.style.display="none",v=document.createElementNS(h,"defs"),d.appendChild(v),p=0;p<f.length;p++)v.appendChild(f[p]);t.appendChild(d)}return[2,t]}}))}))}(t,r)}))]:[2,null]}))}))}var D=/url\\((['"]?)([^'"]+?)\\1\\)/g,H=/url\\([^)]+\\)\\s*format\\((["']?)([^"']+)\\1\\)/g,M=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function F(t,r,i,o,u){return e(this,void 0,void 0,(function(){var e,c,a,s;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),e=i?function(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}(r,i):r,c=S(r),a=void 0,u?[4,u(e)]:[3,2];case 1:return s=n.sent(),a=x(s,c),[3,4];case 2:return[4,R(e,c,o)];case 3:a=n.sent(),n.label=4;case 4:return[2,t.replace((l=r,f=l.replace(/([.*+?^$`),o.push(`{}()|\\[\\]\\/\\\\])/g,"\\\\$1"),new RegExp("(url\\\\(['\\"]?)(".concat(f,")(['\\"]?\\\\))"),"g")),"$1".concat(a,"$3"))];case 5:return n.sent(),[3,6];case 6:return[2,t]}var l,f}))}))}function V(t){return-1!==t.search(D)}function q(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){return V(t)?(e=function(t,e){var n=e.preferredFontFormat;return n?t.replace(M,(function(t){for(;;){var e=H.exec(t)||[],r=e[0],i=e[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):t}(t,i),o=function(t){var e=[];return t.replace(D,(function(t,n,r){return e.push(r),t})),e.filter((function(t){return!E(t)}))}(e),[2,o.reduce((function(t,e){return t.then((function(t){return F(t,e,r,i)}))}),Promise.resolve(e))]):[2,t]}))}))}function U(t,r,i){var o;return e(this,void 0,void 0,(function(){var e,u;return n(this,(function(n){switch(n.label){case 0:return(e=null===(o=r.style)||void 0===o?void 0:o.getPropertyValue(t))?[4,q(e,null,i)]:[3,2];case 1:return u=n.sent(),r.style.setProperty(t,u,r.style.getPropertyPriority(t)),[2,!0];case 2:return[2,!1]}}))}))}function j(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,U("background",t,r)];case 1:return n.sent()?[3,3]:[4,U("background-image",t,r)];case 2:n.sent(),n.label=3;case 3:return[4,U("mask",t,r)];case 4:return(i=n.sent())?[3,6]:[4,U("-webkit-mask",t,r)];case 5:i=n.sent(),n.label=6;case 6:return(e=i)?[3,8]:[4,U("mask-image",t,r)];case 7:e=n.sent(),n.label=8;case 8:return e?[3,10]:[4,U("-webkit-mask-image",t,r)];case 9:n.sent(),n.label=10;case 10:return[2]}}))}))}function O(t,r){return e(this,void 0,void 0,(function(){var e,i,o;return n(this,(function(n){switch(n.label){case 0:return(e=p(t,HTMLImageElement))&&!E(t.src)||p(t,SVGImageElement)&&!E(t.href.baseVal)?[4,R(i=e?t.src:t.href.baseVal,S(i),r)]:[2];case 1:return o=n.sent(),[4,new Promise((function(n,i){t.onload=n,t.onerror=r.onImageErrorHandler?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{n(r.onImageErrorHandler.apply(r,t))}catch(t){i(t)}}:i;var u=t;u.decode&&(u.decode=n),"lazy"===u.loading&&(u.loading="eager"),e?(t.srcset="",t.src=o):t.href.baseVal=o}))];case 2:return n.sent(),[2]}}))}))}function B(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return e=o(t.childNodes),i=e.map((function(t){return z(t,r)})),[4,Promise.all(i).then((function(){return t}))];case 1:return n.sent(),[2]}}))}))}function z(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return p(t,Element)?[4,j(t,r)]:[3,4];case 1:return e.sent(),[4,O(t,r)];case 2:return e.sent(),[4,B(t,r)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}var W={};function $(t){return e(this,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:return null!=(e=W[t])?[2,e]:[4,fetch(t)];case 1:return[4,n.sent().text()];case 2:return r=n.sent(),e={url:t,cssText:r},W[t]=e,[2,e]}}))}))}function G(t,r){return e(this,void 0,void 0,(function(){var i,o,u,c,a=this;return n(this,(function(s){return i=t.cssText,o=/url\\(["']?([^"')]+)["']?\\)/g,u=i.match(/url\\([^)]+\\)/g)||[],c=u.map((function(u){return e(a,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=u.replace(o,"$1")).startsWith("https://")||(e=new URL(e,t.url).href),[2,C(e,r.fetchRequestInit,(function(t){var e=t.result;return i=i.replace(u,"url(".concat(e,")")),[u,e]}))]}))}))})),[2,Promise.all(c).then((function(){return i}))]}))}))}function _(t){if(null==t)return[];for(var e=[],n=t.replace(/(\\/\\*[\\s\\S]*?\\*\\/)/gi,""),r=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");;){if(null===(u=r.exec(n)))break;e.push(u[0])}n=n.replace(r,"");for(var i=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,o=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");;){var u;if(null===(u=i.exec(n))){if(null===(u=o.exec(n)))break;i.lastIndex=o.lastIndex}else o.lastIndex=i.lastIndex;e.push(u[0])}return e}function J(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){return e=[],i=[],t.forEach((function(e){if("cssRules"in e)try{o(e.cssRules||[]).forEach((function(t,n){if(t.type===CSSRule.IMPORT_RULE){var o=n+1,u=$(t.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){try{e.insertRule(t,t.startsWith("@import")?o+=1:e.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}}))})).catch((function(t){console.error("Error loading remote css",t.toString())}));i.push(u)}}))}catch(o){var n=t.find((function(t){return null==t.href}))||document.styleSheets[0];null!=e.href&&i.push($(e.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){n.insertRule(t,n.cssRules.length)}))})).catch((function(t){console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",o)}})),[2,Promise.all(i).then((function(){return t.forEach((function(t){if("cssRules"in t)try{o(t.cssRules||[]).forEach((function(t){e.push(t)}))}catch(e){console.error("Error while reading CSS rules from ".concat(t.href),e)}})),e}))]}))}))}function Q(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return V(t.style.getPropertyValue("src"))}))}function X(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");return[4,J(o(t.ownerDocument.styleSheets),r)];case 1:return[2,Q(e.sent())]}}))}))}function K(t){return t.trim().replace(/["']/g,"")}function Y(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,X(t,r)];case 1:return e=n.sent(),i=function(t){var e=new Set;return function t(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((function(t){e.add(K(t))})),Array.from(n.children).forEach((function(e){e instanceof HTMLElement&&t(e)}))}(t),e}(t),[4,Promise.all(e.filter((function(t){return i.has(K(t.style.fontFamily))})).map((function(t){var e=t.parentStyleSheet?t.parentStyleSheet.href:null;return q(t.cssText,e,r)})))];case 2:return[2,n.sent().join("\\n")]}}))}))}function Z(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c;return n(this,(function(n){switch(n.label){case 0:return null==r.fontEmbedCSS?[3,1]:(i=r.fontEmbedCSS,[3,5]);case 1:return r.skipFonts?(o=null,[3,4]):[3,2];case 2:return[4,Y(t,r)];case 3:o=n.sent(),n.label=4;case 4:i=o,n.label=5;case 5:return(e=i)&&(u=document.createElement("style"),c=document.createTextNode(e),u.appendChild(c),t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),[2]}}))}))}function tt(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,I(t,r,!0)];case 1:return[4,Z(u=n.sent(),r)];case 2:return n.sent(),[4,z(u,r)];case 3:return n.sent(),function(t,e){var n=t.style;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width="".concat(e.width,"px")),e.height&&(n.height="".concat(e.height,"px"));var r=e.style;null!=r&&Object.keys(r).forEach((function(t){n[t]=r[t]}))}(u,r),[4,v(u,i,o)];case 4:return[2,n.sent()]}}))}))}function et(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u,c,a,f,d,v;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,tt(t,r)];case 1:return[4,h(n.sent())];case 2:return u=n.sent(),c=document.createElement("canvas"),a=c.getContext("2d"),f=r.pixelRatio||function(){var t,e;try{e=process}catch(t){}var n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),d=r.canvasWidth||i,v=r.canvasHeight||o,c.width=d*f,c.height=v*f,r.skipAutoScale||function(t){(t.width>l||t.height>l)&&(t.width>l&&t.height>l?t.width>t.height?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l):t.width>l?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l))}(c),c.style.width="".concat(d),c.style.height="".concat(v),r.backgroundColor&&(a.fillStyle=r.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(u,0,0,c.width,c.height),[2,c]}}))}))}t.getFontEmbedCSS=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Y(t,r)]}))}))},t.toBlob=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[4,f(e.sent())];case 2:return[2,e.sent()]}}))}))},t.toCanvas=et,t.toJpeg=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL("image/jpeg",r.quality||1)]}}))}))},t.toPixelData=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,et(t,r)];case 1:return u=n.sent(),[2,u.getContext("2d").getImageData(0,0,i,o).data]}}))}))},t.toPng=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL()]}}))}))},t.toSvg=tt}));`),o.join("")}function mt(o,e,t=1){try{if(!fs.existsSync(o))return;if(!fs.existsSync(e)){let r=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-init-"));try{let i=path.join(r,path.basename(o));fs.copyFileSync(o,i),c({sync:!0,gzip:{level:t},file:e,cwd:r,portable:!0},[path.basename(o)])}finally{fs.rmSync(r,{recursive:!0,force:!0})}return}let n=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-append-"));try{x({file:e,cwd:n,sync:!0});let r=path.join(n,path.basename(o));fs.copyFileSync(o,r),c({gzip:!0,file:e,cwd:n,sync:!0,portable:!0},fs.readdirSync(n))}finally{fs.rmSync(n,{recursive:!0,force:!0})}}catch(n){console.error(`ARCHIVE_FAILURE: ${n.message}`)}}function de(){try{let e=new Error().stack,t="ana-logger",n=!1,r=null,i,s=[];if(e){let a=e.split(`
3
+ `),u=null;if(a.length>=3){let f=0;for(let h=0,d=a.length;h<d;h++){let g=a[h],p=g.split(":");if(p.length<3){s.push(g);continue}if(f=h,u=p[p.length-3],g.indexOf(t)===-1)break;if(g.indexOf("getInvocationLine")===-1){n=!0,t=u.split(/[\\/]/).pop();break}break}for(let h=f+1,d=a.length;h<d;h++){let g=a[h];if(g.indexOf(u)>-1)continue;let p=g.split(":");if(p.length<3)continue;i=s.join(`
4
+ `)+a.slice(h).join(`
5
+ `);let L=parseInt(p.pop()),O=parseInt(p.pop()),P=p.pop(),I=p.pop().split(" "),z=null;for(let _=0;_<I.length;_++){let H=I[_];if(!!H&&H.indexOf("at")!==0){z=H;break}}r={file:P,line:O,col:L,method:z,isMinified:n,stack:i};break}return r}}}catch{}return null}function Ne(o=8){try{let e=de();if(!e)return`LID${Date.now()}`;let n=e.method.split(".")[0].toUpperCase().substring(0,3);if(n.length>=o)return n.substring(0,o);let r=`${n}:${e.line}`;if(r.length>=o)return r=r.replaceAll(":",""),r.substring(0,o);let i=`${n}:${e.line}:${e.col}`;return i.length>o?i.substring(0,o).endsWith(":")?`${n}${e.line}:${e.col}`.substring(0,o):i.substring(0,o):`${n}${e.line}:${e.col}`.substring(0,o)}catch{return`ERR_LID${Date.now()}`}}function Fe(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?$.NODE:$.BROWSER}var yt=Fe();function bt(){return yt===$.NODE}var vt=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],G,S,C,F,w,ee,Ie,te,Me,l=class{constructor({name:e="default"}={}){A(this,ee);A(this,te);m(this,"system","");m(this,"instanceId","");m(this,"instanceName","");m(this,"logIndex",0);m(this,"logCounter",0);A(this,S,[]);A(this,C,{...E});A(this,F,{});m(this,"activeTargets",[Object.values(E)]);m(this,"indexColor",0);m(this,"format","");m(this,"keepLog",!1);m(this,"logHistory",[]);m(this,"$containers",null);m(this,"options",{hideHookMessage:!1});A(this,w,{log:!1,info:!1,warn:!1,error:!1});m(this,"originalFormatFunction");m(this,"forceLidOn",!1);m(this,"resolveLineCall",!1);m(this,"resolveErrorLineCall",!1);m(this,"removeDomOldEntries",e=>{if(e.childElementCount>le){let n=Math.ceil(le/10);for(let r=0;r<n;++r)e.removeChild(e.firstChild);return n}return 0});m(this,"scrollDivToBottom",e=>{let t=e.scrollHeight-(e.clientHeight+e.scrollTop),n=e.clientHeight||e.offsetHeight;t>n/2||(e.scrollTop=e.scrollHeight)});this.system=Fe(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=e,this.instanceId=l.instanceCount+"-"+Date.now(),y(l,G)[l.instanceCount]=this,++l.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),l.Console||(l.Console={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug,table:console.table}),this.rawLog=l.Console.log,this.rawInfo=l.Console.info,this.rawWarn=l.Console.warn,this.rawError=l.Console.error,this.ALIGN=l.ALIGN,this.ENVIRONMENT_TYPE=l.ENVIRONMENT_TYPE,ie(this,te,Me).call(this),this.resetLogHistory()}getName(){return this.instanceName}getId(){return this.instanceId}forceLid(e=!0){this.forceLidOn=!!e}forceResolveLineCall(e=!0){this.resolveLineCall=!!e}forceResolveErrorLineCall(e=!0){this.resolveErrorLineCall=!!e}importLids(e){for(let t in e){let n=e[t]||{};n.lid=n.lid||t,n.callCount=0,n.callTimes=[],l.lidTable[t]=n}l.lidTableOn=!0}loadLids(e){e=e||{},this.importLids(e)}convertTimestampToDate(e){let t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),u=String(t.getSeconds()).padStart(2,"0"),f=String(t.getMilliseconds()).padStart(3,"0");return`${n}-${r}-${i} ${s}:${a}:${u}.${f}`}getLids(){let e={...De.lidTable};for(let t in e){let n=e[t]||{};if(n.callTimes.length){n.dates=[];for(let r=0;r<n.callTimes.length;++r){let i=n.callTimes[r],s=this.convertTimestampToDate(i);n.dates.push(s)}}}return e}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}addToLogHistory(e){e=e||{},this.logHistory.push(Object.assign({},e))}getLogHistory(e=!0,t=ut){let n=this.logHistory||[],r=[];return n.forEach(i=>{let{text:s}=i;r.push(s)}),e?r.join(t):r}getRawLogHistory(){return this.logHistory||[]}hasSeenLid(e){this.logHistory=this.logHistory||[];for(let t=0;t<this.logHistory.length;++t){let r=(this.logHistory[t]||{}).context||{};if(e===r.lid)return!0}return!1}forceEnvironment(e){this.forcedSystem=e}isNode(){return this&&this.forcedSystem?this.forcedSystem===$.NODE:bt()}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=12,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logMaxSize=0,this.options.logMaxArchives=3,this.options.logIndexArchive=0,this.options.logToRemote=void 0,this.options.addArchiveTimestamp=!0,this.options.addArchiveIndex=!0,this.options.logToRemoteUrl=void 0,this.options.logToRemoteBinaryUrl=void 0,this.options.compressArchives=!1,this.options.compressionLevel=1,this.options.protocol=void 0,this.options.host=void 0,this.options.port=void 0,this.options.pathname=void 0,this.options.binarypathname=void 0,this.options.enableDate=void 0,this.options.logToLocalStorage=void 0,this.options.logToLocalStorageMax=50,this.options.logToLocalStorageSize=1e4,this.options.logToRemoteMaxEntries=void 0,this.options.logToRemoteDebounce=void 0,this.remoteBuffer=[],this.remoteTimer=null}resetOptions(){this.resetLogger()}setOptions({contextLenMax:e=10,idLenMax:t=5,lidLenMax:n=6,symbolLenMax:r=2,enableTrace:i=!0,messageLenMax:s=void 0,hideLog:a=void 0,hideError:u=void 0,hideHookMessage:f=void 0,hidePassingTests:h=void 0,logToDom:d=void 0,logToFile:g=void 0,logMaxSize:p=0,logMaxArchives:L=3,logIndexArchive:O=0,addArchiveTimestamp:P=!0,addArchiveIndex:q=!0,compressArchives:I=!1,compressionLevel:z=1,logToRemote:_=void 0,logToRemoteUrl:H=void 0,logToRemoteBinaryUrl:ke=void 0,loopback:Pe=T.loopback,requiredLogLevel:_e=b.LOG,oneConsolePerContext:He=void 0,silent:ge=void 0,enableDate:Ue=void 0,logToLocalStorage:je=void 0,logToLocalStorageMax:$e=50,logToLocalStorageSize:Be=1e4,logToRemoteMaxEntries:Ge=void 0,logToRemoteDebounce:qe=void 0,protocol:ze=void 0,host:Ve=void 0,port:We=void 0,pathname:Ye=void 0,binarypathname:Je=void 0,loadHtmlToImage:Xe=!1}=null){if(this.options.contextLenMax=e,this.options.idLenMax=t,this.options.lidLenMax=n,this.options.messageLenMax=s,this.options.symbolLenMax=r,this.options.logMaxSize=p,this.options.logMaxArchives=L,this.options.logIndexArchive=O,this.options.addArchiveTimestamp=P,this.options.addArchiveIndex=q,this.options.compressArchives=I,this.options.compressionLevel=z,this.options.requiredLogLevel=_e,this.options.enableTrace=i,this.options.logToLocalStorageMax=$e,this.options.logToLocalStorageSize=Be,this.options.logToRemoteMaxEntries=Ge,this.options.logToRemoteDebounce=qe,Xe){let N=pt();gt(N)}let ne;ge!==void 0?ne=!!ge:a!==void 0&&(ne=!!a),[{hideLog:ne},{oneConsolePerContext:He},{hideError:u},{enableDate:Ue},{hideHookMessage:f},{hidePassingTests:h},{logToRemote:_},{logToLocalStorage:je}].forEach(N=>{let U=Object.keys(N)[0],j=N[U];j!==void 0&&(this.options[U]=!!j)}),[{logToRemoteBinaryUrl:ke},{logToRemoteUrl:H},{loopback:Pe},{protocol:ze},{host:Ve},{port:We},{pathname:Ye},{binarypathname:Je}].forEach(N=>{let U=Object.keys(N)[0],j=N[U];j!==void 0&&(this.options[U]=j)}),this.options.logToRemote&&!this.options.logToRemoteUrl&&(this.options.logToRemoteUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.pathname})),this.options.logToRemote&&!this.options.logToRemoteBinaryUrl&&(this.options.logToRemoteBinaryUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.binarypathname||T.binarypathname})),d===!1?this.options.logToDom=!1:d!==void 0&&(this.options.logToDom=d===!0?T.consoleDomId:d),g===!1?this.options.logToFile=!1:g!==void 0&&(this.isBrowser()||(this.options.logToFile=g||T.logFilename),l.Console.log("LogToFile is not supported in this environment. "))}updateOptions(e){this.setOptions({...this.options,...e})}getOptions(){return this.options}truncateMessage(e="",{fit:t=0,align:n=l.ALIGN.LEFT,ellipsis:r="..."}={}){return e=""+e,t&&e.length>t&&(e=e.substring(0,t-r.length)+r),e=n===l.ALIGN.LEFT?e.padEnd(t," "):e.padStart(t," "),e}onBuildLog({contextName:e,message:t="",lid:n="",symbol:r=""}={}){try{let i="",s=t.split(/\n/g);for(let a=0;a<s.length;++a){let u=s[a],f=new Date,h=("0"+f.getHours()).slice(-2)+":"+("0"+f.getMinutes()).slice(-2)+":"+("0"+f.getSeconds()).slice(-2);this.options.enableDate&&(h=f.getFullYear().toString().slice(-2)+"-"+(f.getMonth()+1).toString().padStart(2,"0")+"-"+f.getDate().toString().padStart(2,"0")+" "+h),h=this.truncateMessage(h,{fit:this.options.timeLenMax}),a>0&&(e="",n=""),e=this.truncateMessage(e,{fit:this.options.contextLenMax,align:l.ALIGN.RIGHT}),n=this.truncateMessage(n,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(u=this.truncateMessage(u,{fit:this.options.messageLenMax})),r=this.truncateMessage(r,{fit:this.options.symbolLenMax}),a<=0?i+=`[${h}] ${e}: (${n}) ${r} ${u}`:a<s.length-1?(i+=`
6
+ `,i+=`[${h}] ${e} ${n} ${u}`):u&&(i+=`
7
+ `,i+=`[${h}] ${e} ${n} ${u}`)}return i}catch(i){l.Console.error(`ANALOGGER_FAILURE_1001: ${i.message}`)}return""}onErrorForUserTarget(e,...t){this.errorUserTargetHandler(e,...t)}onError(e,...t){e.target===y(this,C).USER&&this.onErrorForUserTarget(e,...t)}onDisplayLog(...e){this.log(...e)}assistStask(e){try{let t=e.stack.split(`
8
+ `),n=[];for(let r=0;r<t.length;++r){let i=t[r];n.push(i)}return n}catch(t){l.Console.error(`ANALOGGER_FAILURE_1002: ${t.message}`)}return e.message}onDisplayError(...e){try{let t=-1,n=null;for(let r=0;r<e.length;++r){let i=e[r];if(i instanceof Error&&i.stack){t=r,n=this.assistStask(i)||[];break}}if(!n){this.error(...e);return}for(let r=0;r<n.length;++r)e[t]=n[r],this.error(...e)}catch(t){l.Console.error(`ANALOGGER_FAILURE_1003: ${t.message}`)}}setLogFormat(e){if(typeof e!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=e.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(e){this.errorTargetHandler=e.bind(this)}setErrorHandlerForUserTarget(e){this.errorUserTargetHandler=e.bind(this)}isContextValid(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null?e.hasOwnProperty("contextName")&&e.hasOwnProperty("target"):!1}setDefaultContext(e){this.setContext(B.DEFAULT.contextName,e)}generateDefaultContext(){let e=y(this,S)[B.DEFAULT.contextName]||{};return e=Object.assign({},{lid:"",contextName:B.DEFAULT.contextName,target:E.ALL,symbol:"\u26A1",color:k[1],logLevel:b.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=k[this.indexColor++%(k.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=B.ERROR.contextName,e.name=e.contextName,e.color=k[0],e.symbol="\u274C",e.error=!0,e.logLevel=b.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=ie(this,ee,Ie).call(this,t),y(this,S)[e]=t}getContext(e){return y(this,S)[e]}setContexts(e){Object.keys(e).forEach(n=>{let r=e[n]||{};this.setContext(n,r),e[n]=y(this,S)[n]})}getContexts(){return Object.freeze(y(this,S))}setTargets(e={}){let t={};if(Array.isArray(e))try{for(let n=0;n<e.length;++n){let r=e[n];if(typeof r=="string"||r instanceof String)t[r]=r;else if(typeof r=="object"){let i=null;for(let s in r){let a=r[s];if(s=s.trim(),!s){console.error("Invalid target");break}if(typeof a=="string"||a instanceof String){a=a.trim(),i=[s,a];break}if(typeof a=="number")break}i&&(t[i[0]]=i[1])}}}catch(n){console.error({lid:4321},n.message)}else t=e;oe(this,C,Object.assign({},t,{...E}))}addTargets(e){let t=y(this,C),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(y(this,C))}setActiveTargets(e=null){if(e==null){this.activeTargets=[E.ALL];return}if(typeof e=="function"&&(e=e.call(this)),e===null){this.activeTargets=[E.ALL];return}else if(typeof e=="string"||e instanceof String)e=e.split(",");else if(typeof e=="function")e=e.call(this);else if(typeof e=="object")e=Object.values(e);else if(!Array.isArray(e))return;let t=[];for(let n=0;n<e.length;++n){let r=e[n].trim();Object.values(y(this,C)).includes(r)&&t.push(r)}this.activeTargets=t}getActiveTargets(){return this.activeTargets}getActiveTarget(){return(this.getActiveTargets()||[])[0]||E.NONE}setActiveTarget(e){this.activeTargets=[],this.setActiveTargets(e);let t=this.activeTargets[0]||E.NONE;this.activeTargets=[t]}setLogLevel(e,t){y(this,F)[e]=t}getLogLevel(e){return y(this,F)[e]}setLogLevels(e){oe(this,F,e)}getLogLevels(){return Object.freeze(y(this,F))}isTargetAllowed(e){return e===E.NONE?!1:e===E.ALL||this.getActiveTarget()===E.ALL?!0:this.activeTargets.includes(e)}getCurrentTime(){let e=new Date,t=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),r=String(e.getSeconds()).padStart(2,"0");return`${t}:${n}:${r}`}getCurrentDate(){let e=new Date,t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear()).slice(-2);return`${t}-${n}-${r}`}setColumns(e,t,n){let r=1,i=!1;for(let a in t){if(!["contextName","symbol","lid","text","enableDate","enableTime"].includes(a))continue;let u=t[a];a==="enableDate"&&(u=this.getCurrentDate()+" "+this.getCurrentTime()),a==="enableTime"&&(u=this.getCurrentTime());let f=document.createElement("span");f.classList.add("analogger-col",`analogger-col-${a}`,`analogger-col-${r}`),++r,a!=="enableDate"&&a!=="enableTime"?(f.textContent=u,e.append(f)):(f.textContent=`[${u}]`,i=f)}i&&(i.classList.add("analogger-col","analogger-col-time","analogger-col-0"),e.prepend(i));let s=document.createElement("span");s.classList.add("analogger-col","analogger-col-text",`analogger-col-${r}`),s.textContent=n,e.append(s);for(let a=1;a<=3;++a)s=document.createElement("span"),s.classList.add("analogger-col","analogger-col-extra",`analogger-extra-${a}`),e.append(s)}checkOnLoggingToDom(e,t){try{let n=e.onLoggingToDom;return typeof n!="function"?void 0:n.call(this,e,t)}catch{}}addLineToDom(e,t,{context:n,addType:r,message:i,text:s,args:a}){if(this.checkOnLoggingToDom(n,{message:i,text:s,args:a,logCounter:this.logCounter,$view:e,$line:t,addType:r})===!1)return;if(r===K.BOTTOM?e.append(t):e.insertBefore(t,e.firstChild),this.removeDomOldEntries(e)){if(e.getElementsByClassName(ce).length)return;this.showRemovedNotification(n);return}this.scrollDivToBottom(e)}showRemovedNotification(e){e.contextName=Oe,e.symbol="\u{1F5D1}",e.color="orange",e.className=ce,clearTimeout(this.timerAddLineToDomID),this.timerAddLineToDomID=setTimeout(()=>{this.timerAddLineToDomID=null,this.writeLogToDom(e,"",{addType:K.TOP,message:"Oldest entries removed"})},500)}writeLogToDom(e,t,{addType:n=K.BOTTOM,message:r="",args:i=null}={}){this.$containers=this.$containers||document.querySelectorAll(this.options.logToDom),t=r||t;for(let s=0;s<this.$containers.length;++s){let a=this.$containers[s],u=a.querySelector("."+ue);u||(u=document.createElement("div"),u.classList.add(ue),u.append(document.createElement("span")),u.append(document.createElement("span")),u.append(document.createElement("span")),a.append(u));let f=a.querySelector("."+fe);f||(f=document.createElement("div"),f.classList.add(fe),a.append(f));let h=a.querySelector("."+he);h||(h=document.createElement("div"),h.classList.add(he),h.append(document.createElement("span")),h.append(document.createElement("span")),h.append(document.createElement("span")),a.append(h));let d=document.createElement("div");d.classList.add(Se),e.className&&d.classList.add(e.className),d.style.color=e.color,this.setColumns(d,e,t,i),setTimeout(function(g,p,{addType:L,context:O,message:P,text:q,args:I}){this.addLineToDom(g,p,{addType:L,context:O,message:P,text:q,args:I})}.bind(this,f,d,{addType:n,context:e,message:r,text:t,args:i}),0)}}writeLogToFile(e){try{if(!fs.existsSync(this.options.logToFilePath)){let t=path.dirname(this.options.logToFilePath);fs.existsSync(t)||fs.mkdirSync(t,{recursive:!0}),fs.writeFileSync(this.options.logToFilePath,"")}if(this.options.logMaxSize&&fs.statSync(this.options.logToFilePath).size>this.options.logMaxSize){this.options.logIndexArchive<this.options.logMaxArchives?++this.options.logIndexArchive:this.options.logIndexArchive=1;let r=this.options.logMaxArchives.toString().length+1,{filePath:i,extension:s,basename:a,dirname:u}=ft(this.options.logToFilePath),f,h;f=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(r,"0"):"",h=this.options.addArchiveTimestamp?"."+ht():"";let d=`${i}${h}${f}${s}`,g=this.options.compressArchives?`${i}.tar.gz`:"";dt(u,a,f,s,g,this.options.compressionLevel,p=>{p&&console.error("DELETION_FAILURE: Failed to delete some files")}),fs.renameSync(this.options.logToFilePath,d),fs.writeFileSync(this.options.logToFilePath,"")}fs.appendFileSync(this.options.logToFilePath,e+this.EOL)}catch(t){l.Console.error("LOG_TO_FILE_FAILURE: ",t.message)}}writeLogToRemote(...e){try{if(this.options.logToRemoteMaxEntries===void 0&&this.options.logToRemoteDebounce===void 0){this.performRemotePost([...e]);return}if(this.remoteBuffer.push([...e]),this.options.logToRemoteMaxEntries!==void 0&&this.remoteBuffer.length>=this.options.logToRemoteMaxEntries){this.flushRemoteLogs();return}this.options.logToRemoteDebounce!==void 0&&!this.remoteTimer&&(this.remoteTimer=setTimeout(()=>{this.flushRemoteLogs()},this.options.logToRemoteDebounce))}catch(t){l.Console.error("LOG_TO_REMOTE_FAILURE: ",t.message)}}flushRemoteLogs(){if(this.remoteTimer&&(clearTimeout(this.remoteTimer),this.remoteTimer=null),this.remoteBuffer.length===0)return;let e=[...this.remoteBuffer];this.remoteBuffer=[],this.performRemotePost(e)}performRemotePost(e){try{let t=this.generateLogToRemoteUrl(this.options.logToRemoteUrl);if(!t)return null;let n=JSON.stringify(e);fetch(t,{method:"post",body:n,headers:{"Content-Type":"application/json"}}).then(r=>r.json()).catch(()=>null)}catch(t){l.Console.error("REMOTE_POST_FAILURE: ",t.message)}}writeLogToLocalStorage(e,...t){try{if(!this.isBrowser()||!window.localStorage)return;let n=`analogger_history_${this.instanceName}`,r=[];try{let u=localStorage.getItem(n);u&&(r=JSON.parse(u))}catch{r=[]}r.push({context:e,args:t});let i=this.options.logToLocalStorageMax||50;r.length>i&&(r=r.slice(r.length-i));let s=this.options.logToLocalStorageSize||1e4,a=JSON.stringify(r);for(;a.length>s&&r.length>1;)r.shift(),a=JSON.stringify(r);localStorage.setItem(n,a)}catch(n){l.Console.error("LOG_TO_LOCAL_STORAGE_FAILURE: ",n.message)}}restoreLogs(){try{if(!this.isBrowser()||!window.localStorage)return;let e=`analogger_history_${this.instanceName}`,t=localStorage.getItem(e);if(!t)return;let n=JSON.parse(t);if(!Array.isArray(n))return;let r=this.options.logToLocalStorage;this.options.logToLocalStorage=!1,n.forEach(i=>{let{context:s,args:a}=i;s&&(s.symbol="floppy_disk"),this.processOutput(s,...a)}),this.options.logToLocalStorage=r}catch(e){l.Console.error("RESTORE_LOGS_FAILURE: ",e.message)}}uploadDataToRemote(e,t=null,n=null){try{if(!this.options.logToRemote)return;let r=this.generateLogToRemoteUrl(this.options.logToRemoteBinaryUrl,{pathname:T.binarypathname});if(!r)return null;let i=e;t&&(i=JSON.stringify({raw:e,context:t})),fetch(r,{method:"post",body:i}).then(s=>s.json()).then(s=>n&&n(s)).catch(s=>s)}catch(r){l.Console.error("BINARY_TO_REMOTE_FAILURE: ",r.message)}}stringifyEntry(e){let t;try{t=JSON.stringify(e)}catch{}if(!t)try{t=xe(e)}catch{}return t}convertEntry(e){try{if(e==null||e==="")return e;if(typeof e=="boolean")return e;if(typeof e=="symbol"||typeof e=="number")return e;if(typeof e=="string"||myVar instanceof e)return e;if(e instanceof Date)return e}catch{}return this.stringifyEntry(e)}convertArgumentsToText(e){let t=[],n,r=e.length;for(let i=0;i<r;++i){let s,a=e[i];s=this.convertEntry(a),t.push(s)}return n=t.join("\u2022"),n}writeToConsole(e,t){let n=[e];this.isBrowser()&&n.push(`color: ${t.color}`);let r=t.contextLevel||b.LOG;r>=b.ERROR?l.Console.error(...n):r>=b.WARN?l.Console.warn(...n):r>=b.INFO?l.Console.info(...n):r>=b.LOG?l.Console.log(...n):r>=b.DEBUG&&l.Console.debug(...n)}checkPlugins(e,{message:t,text:n,args:r,logCounter:i}){try{if(!Object.keys(l.pluginTable).length)return;let s=!0;for(let a in e){let u=e[a];if(!u)continue;let f=l.pluginTable[a];if(!f||typeof f!="object")continue;let{callback:h,methodName:d,type:g}=f;if(typeof h!="function")continue;h.call(this,e,{message:t,text:n,args:r,logCounter:i,methodName:d,type:g,pluginOptions:u})===!1&&(s=!1)}return s}catch{}}checkOnLogging(e,t,n,r){if(!!r)try{let i=e[r];return typeof i!="function"?void 0:i.call(this,t,n)}catch{}}isContextMessagePattern(e){return/\{\{[^}]+}}/.test(e)}transformContextMessage(e,t){let n=e;for(let r in t){let i=`{{${r}}}`,s=t[r];n=n.replaceAll(i,s)}return n}processOutput(e={},...t){try{let n="";if(l.lidTableOn&&e.lid){let f=l.lidTable[e.lid];f?(e.message=e.message||f.message,f.callCount=f.callCount||0,++f.callCount,f.callTimes.push(Date.now())):l.lidTable[e.lid]={...e,message:t[0],lid:e.lid,callCount:1,callTimes:[Date.now()]}}if(e.message&&(this.isContextMessagePattern(e.message)&&t.length>=1&&typeof t[0]=="object"&&(e.message=this.transformContextMessage(e.message,t[0]),t.shift()),t.unshift(e.message)),this.applySymbolByName(e),this.checkOnLogging(e,e,t,"onContext"),!this.isTargetAllowed(e.target)||e.logLevel===b.OFF||this.options.requiredLogLevel>e.logLevel)return;let r=this.checkOnLogging(e,t[0],arguments,"onMessage");r!==void 0&&(arguments[1]=r);let i=t;n=this.convertArgumentsToText(i);let s="",a=this.format({...e,message:n});this.keepLog&&this.addToLogHistory({context:e,message:n,text:a}),++this.logCounter;let u=this.checkOnLogging(e,a,{message:n,args:i,logCounter:this.logCounter},"onOutput");if(u===!1||((typeof u=="string"||u instanceof String)&&(a=u),u=this.checkPlugins(e,{message:n,text:a,args:i,logCounter:this.logCounter}),u===!1)||(this.options.logToRemote&&this.writeLogToRemote(e,...i),this.options.logToLocalStorage&&this.writeLogToLocalStorage(e,...i),this.isBrowser()?(e.environnment=l.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(e,a,{message:n,args:i}),s=`%c${a}`):(e.environnment=l.ENVIRONMENT_TYPE.NODE,s=X.getTextFromColor(a,{fg:e.color,bg:e.bgColor,isBold:e.bold,isUnderline:e.underline,isReversed:e.reversed}),this.options.logToFile&&this.writeLogToFile(a)),this.options.hideLog||e.hideLog||e.silent))return;this.writeToConsole(s,e),this.errorTargetHandler(e,i)}catch{}}isExtendedOptionsPassed(e){return typeof e!="object"?!1:e.hasOwnProperty("context")||e.hasOwnProperty("target")||e.hasOwnProperty("color")||e.hasOwnProperty("contextName")||e.hasOwnProperty("raw")||e.hasOwnProperty("lid")}stringToObject(e){try{if(e=e.trim(),e.startsWith("{")&&e.endsWith("}")&&(e=e.slice(1,-1).trim()),!e)return{};let t={},n=e.split(",");for(let r of n){let i=r.trim().split(":");if(i.length<2){if(i.length===2){let h=i[0].trim().replace(/^['"]|['"]$/g,"");t[h]=i[1].trim().replace(/^['"]|['"]$/g,"")}else if(i.length===1&&Object.keys(t).length>0){let h=Object.keys(t).pop();t[h]instanceof Array?t[h].push(i[0].trim().replace(/^['"]|['"]$/g,"")):t[h]=[t[h],i[0].trim().replace(/^['"]|['"]$/g,"")]}continue}let s=i[0],a=i.slice(1).join(":"),u=s.trim().replace(/^['"]|['"]$/g,""),f=a.trim().replace(/^['"]|['"]$/g,"");!isNaN(f)&&!isNaN(parseFloat(f))?t[u]=parseFloat(f):t[u]=f}return t}catch{return null}}extractContextFromInput(e){if(typeof e=="string"||e instanceof String){if(e.toLowerCase().indexOf("lid:")!==0)return e;let t=this.stringToObject(e);t&&(e=t)}if(typeof e=="object"&&!Array.isArray(e)&&e!==null&&this.isExtendedOptionsPassed(e)){if(e.contextName){let t=y(this,S)[e.contextName];t&&(e=Object.assign({},t,e))}e.target||(e.target=this.getActiveTarget())}return e}listSymbols(){for(let e in Z)console.rawLog(Z[e]+` ${e} `)}applySymbolByName(e){try{e.symbol&&Z[e.symbol]&&(e.symbol=Z[e.symbol])}catch{}}convertToContext(e,t){e=e||t;let n=e;if(e.context&&typeof e.context=="object"){let r=Object.assign({},e);delete r.context,n=Object.assign({},e.context,r)}return n=Object.assign({},t,n),delete n.context,n}log(e,...t){if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateDefaultContext();this.processOutput.apply(this,[s,e,...t]);return}(!t||!t.length)&&(t=[e]),e={lid:Ne(this.options.lidLenMax)}}let n=this.generateDefaultContext(),r=this.convertToContext(e,n);if(r.raw){l.Console.log(...t);return}this.resolveLineCall&&(this.resolveErrorLineCall||(r.stack=de())),this.processOutput.apply(this,[r,...t])}error(e,...t){if(this.options.hideError)return;if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateErrorContext();this.processOutput.apply(this,[s,e,...t]);return}e={lid:Ne(this.options.lidLenMax)}}let n=this.generateErrorContext(),r=this.convertToContext(e,n);this.resolveErrorLineCall&&(r.stack=de()),this.log(r,...t),this.options.enableTrace&&console.trace(...t)}overrideError(){this.options.hideHookMessage||l.Console.log("AnaLogger: Hook placed on console.error"),y(this,w).error=!0,console.error=this.onDisplayError.bind(this)}attachConsole(){try{return console.rawLog=l.Console.log,console.raw=l.Console.log,console.rawInfo=l.Console.info,console.rawWarn=l.Console.warn,console.rawError=l.Console.error,console.logHistory=this.logHistory,console.logHistory=this.logHistory,vt.forEach(e=>{console[e]=function(...t){this[e](...t)}.bind(this)}),!0}catch(e){console.error({lid:4321},e.message)}return!1}overrideConsole({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){this.options.hideHookMessage||l.Console.log("AnaLogger: Hook placed on console.log"),[{log:e},{info:t},{warn:n}].forEach(function(i){let s=Object.keys(i)[0];i[s]&&(y(this,w)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),r&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=l.Console.error,y(this,w).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){e&&(console.log=l.Console.log,y(this,w).log=!1),t&&(console.info=l.Console.info,y(this,w).info=!1),n&&(console.warn=l.Console.warn,y(this,w).warn=!1),r&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!y(this,w).log){l.Console.table(...e);return}let t=console.log;console.log=l.Console.log,l.Console.table(...e),console.log=t}takeScreenshot(e={selector:"body",quality:.95,canvasHeight:480,canvasWidth:640}){return new Promise((t,n)=>{if(!this.isBrowser())return;let r="";if(!htmlToImage){r="MISSING_HTML_IMAGE_LIBRARY: htmlToImage is not defined. Please install it first.",l.Console.error(r),n(new Error);return}let{selector:i,quality:s,canvasHeight:a,canvasWidth:u}=e,f=document.querySelector(i),h={quality:s,canvasHeight:a,canvasWidth:u};htmlToImage.toPng(f,h).then(function(d,g){this.uploadDataToRemote(g,d,p=>{t({imageData:g,serverResponse:p})})}.bind(this,e)).catch(function(d){r=`IMAGE_PROCESSING_FAILURE: ${d.message}`,l.Console.error(r),n(new Error(r))})})}alert(...e){if(!this.isBrowser())return this.log(...e);let t;if(e&&(e[0]&&e[0].hasOwnProperty("lid")||this.isContextValid(e[0]))){let n=this.generateDefaultContext();t=this.convertToContext(e[0],n).lid+": "+e.slice(1).join(" | ")}else t=e.join(" | ");alert(t)}assert(e,t=!0,...n){let r;try{return typeof e=="function"?(r=e(...n),r!==t?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):e!==t?(this.error("Assert failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)}catch{this.error("Unexpected error in assert")}return!1}applyAnalogFormatting({activeTarget:e="",override:t=!1}={}){try{let r={STANDARD:null,TEST:{color:"#B18904",symbol:"diamonds"}};return this.setDefaultContext(r.DEFAULT),e&&this.setActiveTarget(e),this.setOptions({silent:!1,hideError:!1,hideHookMessage:!0,lidLenMax:6}),t&&(this.overrideConsole(),this.overrideError()),!0}catch(n){console.error({lid:3249},n.message)}return!1}applyPredefinedFormat(e=Q.DEFAULT_FORMAT,{activeTarget:t="",override:n=!1}={}){if(e===Q.DEFAULT_FORMAT)return this.applyAnalogFormatting({activeTarget:t,override:n})}static generateInstance(){return new l}static getInstance(e=0){return l.instanceCount?y(l,G)[e]:null}static generateMainInstance(){let e=l.getInstance();return e||new l}static startLogger(){l.generateMainInstance().applyPredefinedFormat(Q.DEFAULT_FORMAT,{override:!0})}static stopLogger(){let e=l.generateMainInstance();e.removeOverride(),e.removeOverrideError()}convertToUrl({protocol:e=T.protocol,host:t=T.host,port:n=T.port,pathname:r=T.pathname}={}){let i=new URL("http://localhost");return i.protocol=e,i.host=t,i.port=n,r&&(i.pathname=r),i.toString()}generateLogToRemoteUrl(e=null,{pathname:t=T.pathname}={}){if(typeof e=="string"||e instanceof String)return e;if(!this.isBrowser())return null;let n=this.options.protocol||window.location.protocol+"//",r=this.options.host||window.location.host||T.host,i=this.options.port||T.port;return t=this.options.pathname||t,this.convertToUrl({protocol:n,host:r,port:i,pathname:t})}addPlugin(e,t,n=""){n=n||e,this[e]=t,l.pluginTable[n]={type:Ce.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){l[e]=t,l.pluginTable[n]={type:Ce.GLOBAL,methodName:e,callback:t}}getPluginList(){return Object.keys(l.pluginTable)}validatePlugin(e){return l.pluginTable[e]?!0:(console.warn(`The plugin ${e} is not registered`),!1)}},v=l;G=new WeakMap,S=new WeakMap,C=new WeakMap,F=new WeakMap,w=new WeakMap,ee=new WeakSet,Ie=function(e){let t=this.generateNewContext(),n=Object.assign({},t,e);return n.color.toLowerCase().indexOf("rgb")>-1?n.color=X.rgbStringToHex(n.color):n.color.indexOf("#")===-1&&(n.color=X.colorNameToHex(n.color)),n},te=new WeakSet,Me=function(){try{this.setTargets(E),this.setLogLevels(b),this.setContexts(B)}catch(e){console.error({lid:4321},e.message)}return!1},A(v,G,[]),m(v,"Console",null),m(v,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m(v,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),m(v,"instanceCount",0),m(v,"pluginTable",{}),m(v,"lidTable",{}),m(v,"lidTableOn",!1);var De=v,Nt=De,Ft=v.generateMainInstance();var It=v;export{It as AnaLogger,B as DEFAULT_LOG_CONTEXTS,b as DEFAULT_LOG_LEVELS,E as DEFAULT_LOG_TARGETS,Ft as anaLogger,Nt as default};
9
9
 
@@ -1,9 +1,9 @@
1
- var Ye=Object.defineProperty;var Je=(o,e,t)=>e in o?Ye(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var m=(o,e,t)=>(Je(o,typeof e!="symbol"?e+"":e,t),t),re=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var y=(o,e,t)=>(re(o,e,"read from private field"),t?t.call(o):e.get(o)),A=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},oe=(o,e,t,n)=>(re(o,e,"write to private field"),n?n.call(o,t):e.set(o,t),t);var ie=(o,e,t)=>(re(o,e,"access private method"),t);var pe={Foreground:38,Background:48},R="\x1B[1D",me="\x1B[0m"+R,z={Bold:"\x1B[1m"+R,Underline:"\x1B[4m"+R,Reversed:"\x1B[7m"+R},Xe={Bold:"\x1B[1m"+R,Underline:"\x1B[4m"+R,Reversed:"\x1B[7m"+R},se={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Ke(o){return!!se[o]}var ye=(o,e,t)=>o===e&&e===t?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(e/255*5)+Math.round(t/255*5),be=o=>{let e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;o=o.replace(e,function(n,r,i,s){return r+r+i+i+s+s});let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return t?{red:parseInt(t[1],16),blue:parseInt(t[2],16),green:parseInt(t[3],16)}:{}},ve=function({red:o,green:e,blue:t}){let n=o<<16|e<<8|t<<0;return"#"+(16777216+n).toString(16).slice(1)},Le=function(o){let e=o.matchAll(/\d+/g),t=[];for(let n of e){let r=parseInt(n[0]);if(r>255)return null;t.push(r)}return t.length!==3?null:{red:t[0],green:t[1],blue:t[2]}},Qe=function(o){let e=Le(o);return e&&ve(e)},W=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e},Ee=({hue:o,saturation:e,lightness:t})=>{let n,r,i;if(e===0)n=r=i=t;else{let s=t<.5?t*(1+e):t+e-t*e,a=2*t-s;n=W(a,s,o+1/3),r=W(a,s,o),i=W(a,s,o-1/3)}return{red:Math.round(n*255),blue:Math.round(i*255),green:Math.round(r*255)}},Te=o=>{let e=o.toLowerCase();return typeof se[e]<"u"?se[e]:""};function D({red:o,blue:e,green:t},n=!0){if(o===void 0||e===void 0||t===void 0)return"";let r=ye(o,e,t);return`\x1B[${n?pe.Foreground:pe.Background};5;`+r+"m "+R}function M(o,e=!0){let{red:t,green:n,blue:r}=be(o);return D({red:t,green:n,blue:r},e)}function Y({hue:o,saturation:e,lightness:t},n){let{red:r,green:i,blue:s}=Ee({hue:o,saturation:e,lightness:t});return D({red:r,green:i,blue:s},n)}function ae(o,e=!0){try{let t;return o=o||"",o?((typeof o=="string"||o instanceof String)&&(o=o.trim()),Ke(o)?(t=Te(o),M(t,e)):typeof o=="object"&&!!o.red&&!!o.blue&&!!o.green?D(o,e):typeof o=="object"&&!!o.hue&&!!o.saturation&&!!o.lightness?Y(o,e):o.startsWith("#")?M(o,e):(o=o.toString(),/^[\da-fA-F]+$/.test(o)?M("#"+o,e):"")):""}catch(t){console.error("TO_ANSI_INVALID_ARGUMENT_ERROR",t.message)}}function J(o,{fg:e,bg:t,isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){let s=!1,a="";return e&&(s=!0,a=a+e),t&&(s=!0,a=a+t),n&&(s=!0,a=a+z.Underline),r&&(s=!0,a=a+z.Bold),i&&(s=!0,a=a+z.Reversed),s?a+o+me:o}function Ze(o,{fg:e={},bg:t={},isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=D({...e})),t&&(t=D({...t},!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function et(o,{fg:e="",bg:t="",isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=Y({...e})),t&&(t=Y({...t},!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function tt(o,{fg:e="",bg:t="",isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=M(e)),t&&(t=M(t,!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function nt(o,e=null){if(!e)return o;let{fg:t="",bg:n="",isUnderline:r=!1,isBold:i=!1,isReversed:s=!1}=e;return t&&(t=ae(t)),n&&(n=ae(n,!1)),J(o,{fg:t,bg:n,isUnderline:r,isBold:i,isReversed:s})}var X={fromRgb:D,fromHexa:M,fromHsl:Y,fromColor:ae,getTextFromRgb:Ze,getTextFromHsl:et,getTextFromHex:tt,getTextFromColor:nt,colorNameToHex:Te,hslToRgb:Ee,hexToRgb:be,rgbToHex:ve,rgbToAnsi256:ye,rgbStringToRgb:Le,rgbStringToHex:Qe,hue2rgb:W,RESET:me,FONT_STYLE:z,STYLE:Xe};var we={COLOR_TABLE:["#d2466e","#FFA07A","#FF7F50","#FF6347","#FFE4B5","#ADFF2F","#808000","#40E0D0","#1E90FF","#EE82EE","#708090","#DEB887","#FE642E","#210B61","#088A4B","#5E610B","#FA8258","#088A68","#B40431"],SYSTEM:{BROWSER:"BROWSER",NODE:"NODE"}},k=we.COLOR_TABLE,$=we.SYSTEM,le=2e3,ce="analogger-removed-notif",ue="analogger-header",fe="analogger-view",de="analogger-footer",Se="to-esm-line",K={TOP:"TOP",BOTTOM:"BOTTOM"},Oe="ANALOGGER",Q={DEFAULT_FORMAT:"FORMAT1"};var{parse:Lt,stringify:rt}=JSON,{keys:Et}=Object,ot=String,it="string";var Ae="object",st=(o,e)=>e;var xe=(o,e,t)=>{let n=ot(e.push(t)-1);return o.set(t,n),n};var Re=(o,e,t)=>{let n=e&&typeof e===Ae?(d,h)=>d===""||-1<e.indexOf(d)?h:void 0:e||st,r=new Map,i=[],s=[],a=+xe(r,i,n.call({"":o},"",o)),u=!a;for(;a<i.length;)u=!0,s[a]=rt(i[a++],f,t);return"["+s.join(",")+"]";function f(d,h){if(u)return u=!u,h;let g=n.call(this,d,h);switch(typeof g){case Ae:if(g===null)return g;case it:return r.get(g)||xe(r,i,g)}return g}};var E={moduleName:"analogger",protocol:"http://",host:"localhost",port:12e3,pathname:"analogger",binarypathname:"uploaded",loopback:"localhost",consoleDomId:"#analogger",logFilename:"./analogger.log"},T={ALL:"ALL",USER:"USER",NONE:"NONE"},b={FATAL:5e3,ERROR:4e3,WARN:3e3,INFO:2e3,LOG:1e3,DEBUG:500,ALL:200,OFF:0,INHERIT:-1},Ce={LOCAL:"local",GLOBAL:"global"},B={DEFAULT:{contextName:"DEFAULT",logLevel:b.LOG,symbol:"check"},LOG:{contextName:"LOG",logLevel:b.LOG,symbol:"check"},DEBUG:{contextName:"DEBUG",logLevel:b.DEBUG},INFO:{contextName:"INFO",logLevel:b.INFO,color:"#B18904",symbol:"diamonds"},WARN:{contextName:"WARN",logLevel:b.WARN,color:k[0],symbol:"cross"},ERROR:{contextName:"ERROR",logLevel:b.ERROR},CRITICAL:{contextName:"CRITICAL",logLevel:b.CRITICAL}},at=`
2
- `,Z={airplane:"\u2708",anchor:"\u2693",announcement:"\u{1F4E2}",arrow_backward:"\u25C0",arrow_double_up:"\u23EB",arrow_double_down:"\u23EC",arrow_forward:"\u25B6",arrow_lower_right:"\u2198",arrow_lower_left:"\u2199",arrow_right_hook:"\u21AA",arrow_up_down:"\u2195",arrow_upper_left:"\u2196",arrow_upper_right:"\u2197",ballot_box_with_check:"\u2611",biohazard:"\u2623",black_circle:"\u23FA",black_medium_small_square:"\u25FE",black_medium_square:"\u25FC",black_nib:"\u2712",black_small_square:"\u25AA",black_square:"\u23F9",chains:"\u26D3",check:"\u2714",chess_pawn:"\u265F",cloud_and_rain:"\u26C8",clubs:"\u2663",coffee:"\u2615",computer:"\u{1F4BB}",computer_disk:"\u{1F4BD}",computer_mouse:"\u{1F5B1}\uFE0F",copyright:"\xA9",cross:"\u274C",desktop_computer:"\u{1F5A5}\uFE0F",diamonds:"\u2666",divisions_ign:"\u2797",double_triangle_right:"\u23ED",double_triangle_left:"\u23EE",email:"\u2709",eject:"\u23CF",envelope:"\u2709\uFE0F",exclamation_mark:"\u2757",fast_forward:"\u23E9",female_sign:"\u2640",fire:"\u{1F525}",fist:"\u270A",floppy_disk:"\u{1F4BE}",fuel_pump:"\u26FD",gear:"\u2699",hammer_and_pick:"\u2692",hand:"\u270B",hearts:"\u2665",identification_card:"\u{1F194}",infinity:"\u267E",information:"\u2139",information_source:"\u2139\uFE0F",key:"\u{1F511}",left_right_arrow:"\u2194",leftwards_arrow_with_hook:"\u21A9",lock:"\u{1F512}",male_sign:"\u2642",minus_sign:"\u2796",money_bag:"\u{1F4B0}",no_entry:"\u26D4",old_key:"\u{1F5DD}\uFE0F",partly_sunny:"\u26C5",pencil:"\u270F",phone:"\u260E",pile_of_poo:"\u{1F4A9}",plus_sign:"\u2795",question:"\u2754",radioactive:"\u2622",raised_hand:"\u270B",recycle:"\u267B",registered:"\xAE",relaxed:"\u263A",rewind:"\u23EA",scissors:"\u2702",settings:"\u2699\uFE0F",shield:"\u{1F6E1}\uFE0F",screen_with_curl:"\u{1F4DC}",snowman:"\u2603",spades:"\u2660",sparkles:"\u2728",speech_bubble:"\u{1F4AC}",squared_cancellation_mark:"\u274E",star:"\u2B50",sunny:"\u2600",tent:"\u26FA",thought_balloon:"\u{1F4AD}",trademark:"\u2122",triangle_with_vertical_bar:"\u23EF",umbrella:"\u2614",unlock:"\u{1F513}",vertical_bars:"\u23F8",watch:"\u231A",white_frowning_face:"\u2639",white_medium_square:"\u25FB",white_medium_small_square:"\u25FD",white_small_square:"\u25AB",wheelchair:"\u267F",white_circle:"\u26AA",white_square_containing_black_small_square:"\u25FD",writing_hand:"\u270D"};function lt(o){try{let e=path.extname(o),t=path.basename(o,e),n=path.dirname(o),r=o.slice(0,o.length-e.length);return{extension:e,filePath:r,basename:t,dirname:n}}catch(e){console.error("FILEPATH_EXT_FAILURE: ",e.message)}return{extension:".log",filePath:o}}function ct(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function ut(o,e,t,n,r,i,s){fs.readdir(o,(a,u)=>{if(a){s(a,null);return}let f=[],d=0,h=(p,L)=>{if(!fs.existsSync(p)){L(null,null);return}fs.unlink(p,O=>{O?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${O}`):f.push(p),d++,d===u.length&&L(null,f)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let L=path.join(o,p);r&&ht(L,r,i),h(L,s)}else d++,d===u.length&&s(null,f)};u.length===0?s(null,f):u.forEach(g,i)})}function ft(o,e={}){let t=document.createElement("script");t.textContent=o;for(let n in e)t.setAttribute(n,e[n]);document.head.appendChild(t),t.remove()}function dt(){let o=[];return o.push(`!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).htmlToImage={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}a((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var r,i=(r=0,function(){return r+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(r)});function o(t){for(var e=[],n=0,r=t.length;n<r;n++)e.push(t[n]);return e}var u=null;function c(t){return void 0===t&&(t={}),u||(u=t.includeStyleProperties?t.includeStyleProperties:o(window.getComputedStyle(document.documentElement)))}function a(t,e){var n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function s(t,e){void 0===e&&(e={});var n,r,i,o=e.width||(r=a(n=t,"border-left-width"),i=a(n,"border-right-width"),n.clientWidth+r+i),u=e.height||function(t){var e=a(t,"border-top-width"),n=a(t,"border-bottom-width");return t.clientHeight+e+n}(t);return{width:o,height:u}}var l=16384;function f(t,e){return void 0===e&&(e={}),t.toBlob?new Promise((function(n){t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((function(n){for(var r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=r.length,o=new Uint8Array(i),u=0;u<i;u+=1)o[u]=r.charCodeAt(u);n(new Blob([o],{type:e.type?e.type:"image/png"}))}))}function h(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){r.decode().then((function(){requestAnimationFrame((function(){return e(r)}))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t}))}function d(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(t)})).then(encodeURIComponent).then((function(t){return"data:image/svg+xml;charset=utf-8,".concat(t)}))]}))}))}function v(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u;return n(this,(function(n){return e="http://www.w3.org/2000/svg",o=document.createElementNS(e,"svg"),u=document.createElementNS(e,"foreignObject"),o.setAttribute("width","".concat(r)),o.setAttribute("height","".concat(i)),o.setAttribute("viewBox","0 0 ".concat(r," ").concat(i)),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),o.appendChild(u),u.appendChild(t),[2,d(o)]}))}))}var p=function(t,e){if(t instanceof e)return!0;var n=Object.getPrototypeOf(t);return null!==n&&(n.constructor.name===e.name||p(n,e))};function g(t,e,n,r){var i=".".concat(t,":").concat(e),o=n.cssText?function(t){var e=t.getPropertyValue("content");return"".concat(t.cssText," content: '").concat(e.replace(/'|"/g,""),"';")}(n):function(t,e){return c(e).map((function(e){var n=t.getPropertyValue(e),r=t.getPropertyPriority(e);return"".concat(e,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n,r);return document.createTextNode("".concat(i,"{").concat(o,"}"))}function m(t,e,n,r){var o=window.getComputedStyle(t,n),u=o.getPropertyValue("content");if(""!==u&&"none"!==u){var c=i();try{e.className="".concat(e.className," ").concat(c)}catch(t){return}var a=document.createElement("style");a.appendChild(g(c,n,o,r)),e.appendChild(a)}}var w="application/font-woff",y="image/jpeg",b={woff:w,woff2:w,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:y,jpeg:y,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function S(t){var e=function(t){var e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return b[e]||""}function E(t){return-1!==t.search(/^(data:)/)}function x(t,e){return"data:".concat(e,";base64,").concat(t)}function C(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return[4,fetch(t,r)];case 1:if(404===(e=n.sent()).status)throw new Error('Resource "'.concat(e.url,'" not found'));return[4,e.blob()];case 2:return o=n.sent(),[2,new Promise((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(){try{t(i({res:e,result:r.result}))}catch(t){n(t)}},r.readAsDataURL(o)}))]}}))}))}var P={};function R(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u,c,a;return n(this,(function(n){switch(n.label){case 0:if(e=function(t,e,n){var r=t.replace(/\\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\\//,"")),e?"[".concat(e,"]").concat(r):r}(t,r,i.includeQueryParams),null!=P[e])return[2,P[e]];i.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+(new Date).getTime()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,C(t,i.fetchRequestInit,(function(t){var e=t.res,n=t.result;return r||(r=e.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n)}))];case 2:return u=n.sent(),o=x(u,r),[3,4];case 3:return c=n.sent(),o=i.imagePlaceholder||"",a="Failed to fetch resource: ".concat(t),c&&(a="string"==typeof c?c:c.message),a&&console.warn(a),[3,4];case 4:return P[e]=o,[2,o]}}))}))}function T(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"data:,"===(e=t.toDataURL())?[2,t.cloneNode(!1)]:[2,h(e)]}))}))}function A(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return t.currentSrc?(e=document.createElement("canvas"),i=e.getContext("2d"),e.width=t.clientWidth,e.height=t.clientHeight,null==i||i.drawImage(t,0,0,e.width,e.height),[2,h(e.toDataURL())]):(o=t.poster,u=S(o),[4,R(o,u,r)]);case 1:return[2,h(n.sent())]}}))}))}function k(t,r){var i;return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(null===(i=null==t?void 0:t.contentDocument)||void 0===i?void 0:i.body)?[4,I(t.contentDocument.body,r,!0)]:[3,2];case 1:return[2,e.sent()];case 2:return[3,4];case 3:return e.sent(),[3,4];case 4:return[2,t.cloneNode(!1)]}}))}))}var L=function(t){return null!=t.tagName&&"SVG"===t.tagName.toUpperCase()};function N(t,e,n){return p(e,Element)&&(function(t,e,n){var r=e.style;if(r){var i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):c(n).forEach((function(n){var o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){var u=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o="".concat(u,"px")}p(t,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&e.getAttribute("d")&&(o="path(".concat(e.getAttribute("d"),")")),r.setProperty(n,o,i.getPropertyPriority(n))}))}}(t,e,n),function(t,e,n){m(t,e,":before",n),m(t,e,":after",n)}(t,e,n),function(t,e){p(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),p(t,HTMLInputElement)&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(p(t,HTMLSelectElement)){var n=e,r=Array.from(n.children).find((function(e){return t.value===e.getAttribute("value")}));r&&r.setAttribute("selected","")}}(t,e)),e}function I(t,r,i){return e(this,void 0,void 0,(function(){return n(this,(function(u){return i||!r.filter||r.filter(t)?[2,Promise.resolve(t).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){return p(t,HTMLCanvasElement)?[2,T(t)]:p(t,HTMLVideoElement)?[2,A(t,r)]:p(t,HTMLIFrameElement)?[2,k(t,r)]:[2,t.cloneNode(L(t))]}))}))}(t,r)})).then((function(i){return function(t,r,i){var u,c;return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return L(r)?[2,r]:(e=[],0===(e=null!=(a=t).tagName&&"SLOT"===a.tagName.toUpperCase()&&t.assignedNodes?o(t.assignedNodes()):p(t,HTMLIFrameElement)&&(null===(u=t.contentDocument)||void 0===u?void 0:u.body)?o(t.contentDocument.body.childNodes):o((null!==(c=t.shadowRoot)&&void 0!==c?c:t).childNodes)).length||p(t,HTMLVideoElement)?[2,r]:[4,e.reduce((function(t,e){return t.then((function(){return I(e,i)})).then((function(t){t&&r.appendChild(t)}))}),Promise.resolve())]);case 1:return n.sent(),[2,r]}var a}))}))}(t,i,r)})).then((function(e){return N(t,e,r)})).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c,a,s,l,f,h,d,v,p;return n(this,(function(n){switch(n.label){case 0:if(0===(e=t.querySelectorAll?t.querySelectorAll("use"):[]).length)return[2,t];i={},p=0,n.label=1;case 1:return p<e.length?(o=e[p],(u=o.getAttribute("xlink:href"))?(c=t.querySelector(u),a=document.querySelector(u),c||!a||i[u]?[3,3]:(s=i,l=u,[4,I(a,r,!0)])):[3,3]):[3,4];case 2:s[l]=n.sent(),n.label=3;case 3:return p++,[3,1];case 4:if((f=Object.values(i)).length){for(h="http://www.w3.org/1999/xhtml",(d=document.createElementNS(h,"svg")).setAttribute("xmlns",h),d.style.position="absolute",d.style.width="0",d.style.height="0",d.style.overflow="hidden",d.style.display="none",v=document.createElementNS(h,"defs"),d.appendChild(v),p=0;p<f.length;p++)v.appendChild(f[p]);t.appendChild(d)}return[2,t]}}))}))}(t,r)}))]:[2,null]}))}))}var D=/url\\((['"]?)([^'"]+?)\\1\\)/g,H=/url\\([^)]+\\)\\s*format\\((["']?)([^"']+)\\1\\)/g,M=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function F(t,r,i,o,u){return e(this,void 0,void 0,(function(){var e,c,a,s;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),e=i?function(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}(r,i):r,c=S(r),a=void 0,u?[4,u(e)]:[3,2];case 1:return s=n.sent(),a=x(s,c),[3,4];case 2:return[4,R(e,c,o)];case 3:a=n.sent(),n.label=4;case 4:return[2,t.replace((l=r,f=l.replace(/([.*+?^$`),o.push(`{}()|\\[\\]\\/\\\\])/g,"\\\\$1"),new RegExp("(url\\\\(['\\"]?)(".concat(f,")(['\\"]?\\\\))"),"g")),"$1".concat(a,"$3"))];case 5:return n.sent(),[3,6];case 6:return[2,t]}var l,f}))}))}function V(t){return-1!==t.search(D)}function q(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){return V(t)?(e=function(t,e){var n=e.preferredFontFormat;return n?t.replace(M,(function(t){for(;;){var e=H.exec(t)||[],r=e[0],i=e[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):t}(t,i),o=function(t){var e=[];return t.replace(D,(function(t,n,r){return e.push(r),t})),e.filter((function(t){return!E(t)}))}(e),[2,o.reduce((function(t,e){return t.then((function(t){return F(t,e,r,i)}))}),Promise.resolve(e))]):[2,t]}))}))}function U(t,r,i){var o;return e(this,void 0,void 0,(function(){var e,u;return n(this,(function(n){switch(n.label){case 0:return(e=null===(o=r.style)||void 0===o?void 0:o.getPropertyValue(t))?[4,q(e,null,i)]:[3,2];case 1:return u=n.sent(),r.style.setProperty(t,u,r.style.getPropertyPriority(t)),[2,!0];case 2:return[2,!1]}}))}))}function j(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,U("background",t,r)];case 1:return n.sent()?[3,3]:[4,U("background-image",t,r)];case 2:n.sent(),n.label=3;case 3:return[4,U("mask",t,r)];case 4:return(i=n.sent())?[3,6]:[4,U("-webkit-mask",t,r)];case 5:i=n.sent(),n.label=6;case 6:return(e=i)?[3,8]:[4,U("mask-image",t,r)];case 7:e=n.sent(),n.label=8;case 8:return e?[3,10]:[4,U("-webkit-mask-image",t,r)];case 9:n.sent(),n.label=10;case 10:return[2]}}))}))}function O(t,r){return e(this,void 0,void 0,(function(){var e,i,o;return n(this,(function(n){switch(n.label){case 0:return(e=p(t,HTMLImageElement))&&!E(t.src)||p(t,SVGImageElement)&&!E(t.href.baseVal)?[4,R(i=e?t.src:t.href.baseVal,S(i),r)]:[2];case 1:return o=n.sent(),[4,new Promise((function(n,i){t.onload=n,t.onerror=r.onImageErrorHandler?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{n(r.onImageErrorHandler.apply(r,t))}catch(t){i(t)}}:i;var u=t;u.decode&&(u.decode=n),"lazy"===u.loading&&(u.loading="eager"),e?(t.srcset="",t.src=o):t.href.baseVal=o}))];case 2:return n.sent(),[2]}}))}))}function B(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return e=o(t.childNodes),i=e.map((function(t){return z(t,r)})),[4,Promise.all(i).then((function(){return t}))];case 1:return n.sent(),[2]}}))}))}function z(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return p(t,Element)?[4,j(t,r)]:[3,4];case 1:return e.sent(),[4,O(t,r)];case 2:return e.sent(),[4,B(t,r)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}var W={};function $(t){return e(this,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:return null!=(e=W[t])?[2,e]:[4,fetch(t)];case 1:return[4,n.sent().text()];case 2:return r=n.sent(),e={url:t,cssText:r},W[t]=e,[2,e]}}))}))}function G(t,r){return e(this,void 0,void 0,(function(){var i,o,u,c,a=this;return n(this,(function(s){return i=t.cssText,o=/url\\(["']?([^"')]+)["']?\\)/g,u=i.match(/url\\([^)]+\\)/g)||[],c=u.map((function(u){return e(a,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=u.replace(o,"$1")).startsWith("https://")||(e=new URL(e,t.url).href),[2,C(e,r.fetchRequestInit,(function(t){var e=t.result;return i=i.replace(u,"url(".concat(e,")")),[u,e]}))]}))}))})),[2,Promise.all(c).then((function(){return i}))]}))}))}function _(t){if(null==t)return[];for(var e=[],n=t.replace(/(\\/\\*[\\s\\S]*?\\*\\/)/gi,""),r=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");;){if(null===(u=r.exec(n)))break;e.push(u[0])}n=n.replace(r,"");for(var i=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,o=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");;){var u;if(null===(u=i.exec(n))){if(null===(u=o.exec(n)))break;i.lastIndex=o.lastIndex}else o.lastIndex=i.lastIndex;e.push(u[0])}return e}function J(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){return e=[],i=[],t.forEach((function(e){if("cssRules"in e)try{o(e.cssRules||[]).forEach((function(t,n){if(t.type===CSSRule.IMPORT_RULE){var o=n+1,u=$(t.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){try{e.insertRule(t,t.startsWith("@import")?o+=1:e.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}}))})).catch((function(t){console.error("Error loading remote css",t.toString())}));i.push(u)}}))}catch(o){var n=t.find((function(t){return null==t.href}))||document.styleSheets[0];null!=e.href&&i.push($(e.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){n.insertRule(t,n.cssRules.length)}))})).catch((function(t){console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",o)}})),[2,Promise.all(i).then((function(){return t.forEach((function(t){if("cssRules"in t)try{o(t.cssRules||[]).forEach((function(t){e.push(t)}))}catch(e){console.error("Error while reading CSS rules from ".concat(t.href),e)}})),e}))]}))}))}function Q(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return V(t.style.getPropertyValue("src"))}))}function X(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");return[4,J(o(t.ownerDocument.styleSheets),r)];case 1:return[2,Q(e.sent())]}}))}))}function K(t){return t.trim().replace(/["']/g,"")}function Y(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,X(t,r)];case 1:return e=n.sent(),i=function(t){var e=new Set;return function t(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((function(t){e.add(K(t))})),Array.from(n.children).forEach((function(e){e instanceof HTMLElement&&t(e)}))}(t),e}(t),[4,Promise.all(e.filter((function(t){return i.has(K(t.style.fontFamily))})).map((function(t){var e=t.parentStyleSheet?t.parentStyleSheet.href:null;return q(t.cssText,e,r)})))];case 2:return[2,n.sent().join("\\n")]}}))}))}function Z(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c;return n(this,(function(n){switch(n.label){case 0:return null==r.fontEmbedCSS?[3,1]:(i=r.fontEmbedCSS,[3,5]);case 1:return r.skipFonts?(o=null,[3,4]):[3,2];case 2:return[4,Y(t,r)];case 3:o=n.sent(),n.label=4;case 4:i=o,n.label=5;case 5:return(e=i)&&(u=document.createElement("style"),c=document.createTextNode(e),u.appendChild(c),t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),[2]}}))}))}function tt(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,I(t,r,!0)];case 1:return[4,Z(u=n.sent(),r)];case 2:return n.sent(),[4,z(u,r)];case 3:return n.sent(),function(t,e){var n=t.style;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width="".concat(e.width,"px")),e.height&&(n.height="".concat(e.height,"px"));var r=e.style;null!=r&&Object.keys(r).forEach((function(t){n[t]=r[t]}))}(u,r),[4,v(u,i,o)];case 4:return[2,n.sent()]}}))}))}function et(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u,c,a,f,d,v;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,tt(t,r)];case 1:return[4,h(n.sent())];case 2:return u=n.sent(),c=document.createElement("canvas"),a=c.getContext("2d"),f=r.pixelRatio||function(){var t,e;try{e=process}catch(t){}var n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),d=r.canvasWidth||i,v=r.canvasHeight||o,c.width=d*f,c.height=v*f,r.skipAutoScale||function(t){(t.width>l||t.height>l)&&(t.width>l&&t.height>l?t.width>t.height?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l):t.width>l?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l))}(c),c.style.width="".concat(d),c.style.height="".concat(v),r.backgroundColor&&(a.fillStyle=r.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(u,0,0,c.width,c.height),[2,c]}}))}))}t.getFontEmbedCSS=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Y(t,r)]}))}))},t.toBlob=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[4,f(e.sent())];case 2:return[2,e.sent()]}}))}))},t.toCanvas=et,t.toJpeg=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL("image/jpeg",r.quality||1)]}}))}))},t.toPixelData=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,et(t,r)];case 1:return u=n.sent(),[2,u.getContext("2d").getImageData(0,0,i,o).data]}}))}))},t.toPng=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL()]}}))}))},t.toSvg=tt}));`),o.join("")}function ht(o,e,t=1){try{if(!fs.existsSync(o))return;if(!fs.existsSync(e)){let r=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-init-"));try{let i=path.join(r,path.basename(o));fs.copyFileSync(o,i),c({sync:!0,gzip:{level:t},file:e,cwd:r,portable:!0},[path.basename(o)])}finally{fs.rmSync(r,{recursive:!0,force:!0})}return}let n=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-append-"));try{x({file:e,cwd:n,sync:!0});let r=path.join(n,path.basename(o));fs.copyFileSync(o,r),c({gzip:!0,file:e,cwd:n,sync:!0,portable:!0},fs.readdirSync(n))}finally{fs.rmSync(n,{recursive:!0,force:!0})}}catch(n){console.error(`ARCHIVE_FAILURE: ${n.message}`)}}function he(){try{let e=new Error().stack,t="ana-logger",n=!1,r=null,i,s=[];if(e){let a=e.split(`
3
- `),u=null;if(a.length>=3){let f=0;for(let d=0,h=a.length;d<h;d++){let g=a[d],p=g.split(":");if(p.length<3){s.push(g);continue}if(f=d,u=p[p.length-3],g.indexOf(t)===-1)break;if(g.indexOf("getInvocationLine")===-1){n=!0,t=u.split(/[\\/]/).pop();break}break}for(let d=f+1,h=a.length;d<h;d++){let g=a[d];if(g.indexOf(u)>-1)continue;let p=g.split(":");if(p.length<3)continue;i=s.join(`
4
- `)+a.slice(d).join(`
5
- `);let L=parseInt(p.pop()),O=parseInt(p.pop()),P=p.pop(),I=p.pop().split(" "),V=null;for(let _=0;_<I.length;_++){let H=I[_];if(!!H&&H.indexOf("at")!==0){V=H;break}}r={file:P,line:O,col:L,method:V,isMinified:n,stack:i};break}return r}}}catch{}return null}function Ne(o=8){try{let e=he();if(!e)return`LID${Date.now()}`;let n=e.method.split(".")[0].toUpperCase().substring(0,3);if(n.length>=o)return n.substring(0,o);let r=`${n}:${e.line}`;if(r.length>=o)return r=r.replaceAll(":",""),r.substring(0,o);let i=`${n}:${e.line}:${e.col}`;return i.length>o?i.substring(0,o).endsWith(":")?`${n}${e.line}:${e.col}`.substring(0,o):i.substring(0,o):`${n}${e.line}:${e.col}`.substring(0,o)}catch{return`ERR_LID${Date.now()}`}}function Fe(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?$.NODE:$.BROWSER}var gt=Fe();function pt(){return gt===$.NODE}var mt=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],G,S,C,F,w,ee,Ie,te,Me,l=class{constructor({name:e="default"}={}){A(this,ee);A(this,te);m(this,"system","");m(this,"instanceId","");m(this,"instanceName","");m(this,"logIndex",0);m(this,"logCounter",0);A(this,S,[]);A(this,C,{...T});A(this,F,{});m(this,"activeTargets",[Object.values(T)]);m(this,"indexColor",0);m(this,"format","");m(this,"keepLog",!1);m(this,"logHistory",[]);m(this,"$containers",null);m(this,"options",{hideHookMessage:!1});A(this,w,{log:!1,info:!1,warn:!1,error:!1});m(this,"originalFormatFunction");m(this,"forceLidOn",!1);m(this,"resolveLineCall",!1);m(this,"resolveErrorLineCall",!1);m(this,"removeDomOldEntries",e=>{if(e.childElementCount>le){let n=Math.ceil(le/10);for(let r=0;r<n;++r)e.removeChild(e.firstChild);return n}return 0});m(this,"scrollDivToBottom",e=>{let t=e.scrollHeight-(e.clientHeight+e.scrollTop),n=e.clientHeight||e.offsetHeight;t>n/2||(e.scrollTop=e.scrollHeight)});this.system=Fe(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=e,this.instanceId=l.instanceCount+"-"+Date.now(),y(l,G)[l.instanceCount]=this,++l.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),l.Console||(l.Console={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug,table:console.table}),this.rawLog=l.Console.log,this.rawInfo=l.Console.info,this.rawWarn=l.Console.warn,this.rawError=l.Console.error,this.ALIGN=l.ALIGN,this.ENVIRONMENT_TYPE=l.ENVIRONMENT_TYPE,ie(this,te,Me).call(this),this.resetLogHistory()}getName(){return this.instanceName}getId(){return this.instanceId}forceLid(e=!0){this.forceLidOn=!!e}forceResolveLineCall(e=!0){this.resolveLineCall=!!e}forceResolveErrorLineCall(e=!0){this.resolveErrorLineCall=!!e}importLids(e){for(let t in e){let n=e[t]||{};n.lid=n.lid||t,n.callCount=0,n.callTimes=[],l.lidTable[t]=n}l.lidTableOn=!0}loadLids(e){e=e||{},this.importLids(e)}convertTimestampToDate(e){let t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),u=String(t.getSeconds()).padStart(2,"0"),f=String(t.getMilliseconds()).padStart(3,"0");return`${n}-${r}-${i} ${s}:${a}:${u}.${f}`}getLids(){let e={...De.lidTable};for(let t in e){let n=e[t]||{};if(n.callTimes.length){n.dates=[];for(let r=0;r<n.callTimes.length;++r){let i=n.callTimes[r],s=this.convertTimestampToDate(i);n.dates.push(s)}}}return e}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}addToLogHistory(e){e=e||{},this.logHistory.push(Object.assign({},e))}getLogHistory(e=!0,t=at){let n=this.logHistory||[],r=[];return n.forEach(i=>{let{text:s}=i;r.push(s)}),e?r.join(t):r}getRawLogHistory(){return this.logHistory||[]}hasSeenLid(e){this.logHistory=this.logHistory||[];for(let t=0;t<this.logHistory.length;++t){let r=(this.logHistory[t]||{}).context||{};if(e===r.lid)return!0}return!1}forceEnvironment(e){this.forcedSystem=e}isNode(){return this&&this.forcedSystem?this.forcedSystem===$.NODE:pt()}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=12,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logMaxSize=0,this.options.logMaxArchives=3,this.options.logIndexArchive=0,this.options.logToRemote=void 0,this.options.addArchiveTimestamp=!0,this.options.addArchiveIndex=!0,this.options.logToRemoteUrl=void 0,this.options.logToRemoteBinaryUrl=void 0,this.options.compressArchives=!1,this.options.compressionLevel=1,this.options.protocol=void 0,this.options.host=void 0,this.options.port=void 0,this.options.pathname=void 0,this.options.binarypathname=void 0,this.options.enableDate=void 0,this.options.logToLocalStorage=void 0,this.options.logToLocalStorageMax=50}resetOptions(){this.resetLogger()}setOptions({contextLenMax:e=10,idLenMax:t=5,lidLenMax:n=6,symbolLenMax:r=2,enableTrace:i=!0,messageLenMax:s=void 0,hideLog:a=void 0,hideError:u=void 0,hideHookMessage:f=void 0,hidePassingTests:d=void 0,logToDom:h=void 0,logToFile:g=void 0,logMaxSize:p=0,logMaxArchives:L=3,logIndexArchive:O=0,addArchiveTimestamp:P=!0,addArchiveIndex:q=!0,compressArchives:I=!1,compressionLevel:V=1,logToRemote:_=void 0,logToRemoteUrl:H=void 0,logToRemoteBinaryUrl:ke=void 0,loopback:Pe=E.loopback,requiredLogLevel:_e=b.LOG,oneConsolePerContext:He=void 0,silent:ge=void 0,enableDate:Ue=void 0,logToLocalStorage:je=void 0,logToLocalStorageMax:$e=50,protocol:Be=void 0,host:Ge=void 0,port:qe=void 0,pathname:Ve=void 0,binarypathname:ze=void 0,loadHtmlToImage:We=!1}=null){if(this.options.contextLenMax=e,this.options.idLenMax=t,this.options.lidLenMax=n,this.options.messageLenMax=s,this.options.symbolLenMax=r,this.options.logMaxSize=p,this.options.logMaxArchives=L,this.options.logIndexArchive=O,this.options.addArchiveTimestamp=P,this.options.addArchiveIndex=q,this.options.compressArchives=I,this.options.compressionLevel=V,this.options.requiredLogLevel=_e,this.options.enableTrace=i,this.options.logToLocalStorageMax=$e,We){let N=dt();ft(N)}let ne;ge!==void 0?ne=!!ge:a!==void 0&&(ne=!!a),[{hideLog:ne},{oneConsolePerContext:He},{hideError:u},{enableDate:Ue},{hideHookMessage:f},{hidePassingTests:d},{logToRemote:_},{logToLocalStorage:je}].forEach(N=>{let U=Object.keys(N)[0],j=N[U];j!==void 0&&(this.options[U]=!!j)}),[{logToRemoteBinaryUrl:ke},{logToRemoteUrl:H},{loopback:Pe},{protocol:Be},{host:Ge},{port:qe},{pathname:Ve},{binarypathname:ze}].forEach(N=>{let U=Object.keys(N)[0],j=N[U];j!==void 0&&(this.options[U]=j)}),this.options.logToRemote&&!this.options.logToRemoteUrl&&(this.options.logToRemoteUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.pathname})),this.options.logToRemote&&!this.options.logToRemoteBinaryUrl&&(this.options.logToRemoteBinaryUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.binarypathname||E.binarypathname})),h===!1?this.options.logToDom=!1:h!==void 0&&(this.options.logToDom=h===!0?E.consoleDomId:h),g===!1?this.options.logToFile=!1:g!==void 0&&(this.isBrowser()||(this.options.logToFile=g||E.logFilename),l.Console.log("LogToFile is not supported in this environment. "))}updateOptions(e){this.setOptions({...this.options,...e})}getOptions(){return this.options}truncateMessage(e="",{fit:t=0,align:n=l.ALIGN.LEFT,ellipsis:r="..."}={}){return e=""+e,t&&e.length>t&&(e=e.substring(0,t-r.length)+r),e=n===l.ALIGN.LEFT?e.padEnd(t," "):e.padStart(t," "),e}onBuildLog({contextName:e,message:t="",lid:n="",symbol:r=""}={}){try{let i="",s=t.split(/\n/g);for(let a=0;a<s.length;++a){let u=s[a],f=new Date,d=("0"+f.getHours()).slice(-2)+":"+("0"+f.getMinutes()).slice(-2)+":"+("0"+f.getSeconds()).slice(-2);this.options.enableDate&&(d=f.getFullYear().toString().slice(-2)+"-"+(f.getMonth()+1).toString().padStart(2,"0")+"-"+f.getDate().toString().padStart(2,"0")+" "+d),d=this.truncateMessage(d,{fit:this.options.timeLenMax}),a>0&&(e="",n=""),e=this.truncateMessage(e,{fit:this.options.contextLenMax,align:l.ALIGN.RIGHT}),n=this.truncateMessage(n,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(u=this.truncateMessage(u,{fit:this.options.messageLenMax})),r=this.truncateMessage(r,{fit:this.options.symbolLenMax}),a<=0?i+=`[${d}] ${e}: (${n}) ${r} ${u}`:a<s.length-1?(i+=`
6
- `,i+=`[${d}] ${e} ${n} ${u}`):u&&(i+=`
7
- `,i+=`[${d}] ${e} ${n} ${u}`)}return i}catch(i){l.Console.error(`ANALOGGER_FAILURE_1001: ${i.message}`)}return""}onErrorForUserTarget(e,...t){this.errorUserTargetHandler(e,...t)}onError(e,...t){e.target===y(this,C).USER&&this.onErrorForUserTarget(e,...t)}onDisplayLog(...e){this.log(...e)}assistStask(e){try{let t=e.stack.split(`
8
- `),n=[];for(let r=0;r<t.length;++r){let i=t[r];n.push(i)}return n}catch(t){l.Console.error(`ANALOGGER_FAILURE_1002: ${t.message}`)}return e.message}onDisplayError(...e){try{let t=-1,n=null;for(let r=0;r<e.length;++r){let i=e[r];if(i instanceof Error&&i.stack){t=r,n=this.assistStask(i)||[];break}}if(!n){this.error(...e);return}for(let r=0;r<n.length;++r)e[t]=n[r],this.error(...e)}catch(t){l.Console.error(`ANALOGGER_FAILURE_1003: ${t.message}`)}}setLogFormat(e){if(typeof e!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=e.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(e){this.errorTargetHandler=e.bind(this)}setErrorHandlerForUserTarget(e){this.errorUserTargetHandler=e.bind(this)}isContextValid(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null?e.hasOwnProperty("contextName")&&e.hasOwnProperty("target"):!1}setDefaultContext(e){this.setContext(B.DEFAULT.contextName,e)}generateDefaultContext(){let e=y(this,S)[B.DEFAULT.contextName]||{};return e=Object.assign({},{lid:"",contextName:B.DEFAULT.contextName,target:T.ALL,symbol:"\u26A1",color:k[1],logLevel:b.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=k[this.indexColor++%(k.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=B.ERROR.contextName,e.name=e.contextName,e.color=k[0],e.symbol="\u274C",e.error=!0,e.logLevel=b.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=ie(this,ee,Ie).call(this,t),y(this,S)[e]=t}getContext(e){return y(this,S)[e]}setContexts(e){Object.keys(e).forEach(n=>{let r=e[n]||{};this.setContext(n,r),e[n]=y(this,S)[n]})}getContexts(){return Object.freeze(y(this,S))}setTargets(e={}){let t={};if(Array.isArray(e))try{for(let n=0;n<e.length;++n){let r=e[n];if(typeof r=="string"||r instanceof String)t[r]=r;else if(typeof r=="object"){let i=null;for(let s in r){let a=r[s];if(s=s.trim(),!s){console.error("Invalid target");break}if(typeof a=="string"||a instanceof String){a=a.trim(),i=[s,a];break}if(typeof a=="number")break}i&&(t[i[0]]=i[1])}}}catch(n){console.error({lid:4321},n.message)}else t=e;oe(this,C,Object.assign({},t,{...T}))}addTargets(e){let t=y(this,C),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(y(this,C))}setActiveTargets(e=null){if(e==null){this.activeTargets=[T.ALL];return}if(typeof e=="function"&&(e=e.call(this)),e===null){this.activeTargets=[T.ALL];return}else if(typeof e=="string"||e instanceof String)e=e.split(",");else if(typeof e=="function")e=e.call(this);else if(typeof e=="object")e=Object.values(e);else if(!Array.isArray(e))return;let t=[];for(let n=0;n<e.length;++n){let r=e[n].trim();Object.values(y(this,C)).includes(r)&&t.push(r)}this.activeTargets=t}getActiveTargets(){return this.activeTargets}getActiveTarget(){return(this.getActiveTargets()||[])[0]||T.NONE}setActiveTarget(e){this.activeTargets=[],this.setActiveTargets(e);let t=this.activeTargets[0]||T.NONE;this.activeTargets=[t]}setLogLevel(e,t){y(this,F)[e]=t}getLogLevel(e){return y(this,F)[e]}setLogLevels(e){oe(this,F,e)}getLogLevels(){return Object.freeze(y(this,F))}isTargetAllowed(e){return e===T.NONE?!1:e===T.ALL||this.getActiveTarget()===T.ALL?!0:this.activeTargets.includes(e)}getCurrentTime(){let e=new Date,t=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),r=String(e.getSeconds()).padStart(2,"0");return`${t}:${n}:${r}`}getCurrentDate(){let e=new Date,t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear()).slice(-2);return`${t}-${n}-${r}`}setColumns(e,t,n){let r=1,i=!1;for(let a in t){if(!["contextName","symbol","lid","text","enableDate","enableTime"].includes(a))continue;let u=t[a];a==="enableDate"&&(u=this.getCurrentDate()+" "+this.getCurrentTime()),a==="enableTime"&&(u=this.getCurrentTime());let f=document.createElement("span");f.classList.add("analogger-col",`analogger-col-${a}`,`analogger-col-${r}`),++r,a!=="enableDate"&&a!=="enableTime"?(f.textContent=u,e.append(f)):(f.textContent=`[${u}]`,i=f)}i&&(i.classList.add("analogger-col","analogger-col-time","analogger-col-0"),e.prepend(i));let s=document.createElement("span");s.classList.add("analogger-col","analogger-col-text",`analogger-col-${r}`),s.textContent=n,e.append(s);for(let a=1;a<=3;++a)s=document.createElement("span"),s.classList.add("analogger-col","analogger-col-extra",`analogger-extra-${a}`),e.append(s)}checkOnLoggingToDom(e,t){try{let n=e.onLoggingToDom;return typeof n!="function"?void 0:n.call(this,e,t)}catch{}}addLineToDom(e,t,{context:n,addType:r,message:i,text:s,args:a}){if(this.checkOnLoggingToDom(n,{message:i,text:s,args:a,logCounter:this.logCounter,$view:e,$line:t,addType:r})===!1)return;if(r===K.BOTTOM?e.append(t):e.insertBefore(t,e.firstChild),this.removeDomOldEntries(e)){if(e.getElementsByClassName(ce).length)return;this.showRemovedNotification(n);return}this.scrollDivToBottom(e)}showRemovedNotification(e){e.contextName=Oe,e.symbol="\u{1F5D1}",e.color="orange",e.className=ce,clearTimeout(this.timerAddLineToDomID),this.timerAddLineToDomID=setTimeout(()=>{this.timerAddLineToDomID=null,this.writeLogToDom(e,"",{addType:K.TOP,message:"Oldest entries removed"})},500)}writeLogToDom(e,t,{addType:n=K.BOTTOM,message:r="",args:i=null}={}){this.$containers=this.$containers||document.querySelectorAll(this.options.logToDom),t=r||t;for(let s=0;s<this.$containers.length;++s){let a=this.$containers[s],u=a.querySelector("."+ue);u||(u=document.createElement("div"),u.classList.add(ue),u.append(document.createElement("span")),u.append(document.createElement("span")),u.append(document.createElement("span")),a.append(u));let f=a.querySelector("."+fe);f||(f=document.createElement("div"),f.classList.add(fe),a.append(f));let d=a.querySelector("."+de);d||(d=document.createElement("div"),d.classList.add(de),d.append(document.createElement("span")),d.append(document.createElement("span")),d.append(document.createElement("span")),a.append(d));let h=document.createElement("div");h.classList.add(Se),e.className&&h.classList.add(e.className),h.style.color=e.color,this.setColumns(h,e,t,i),setTimeout(function(g,p,{addType:L,context:O,message:P,text:q,args:I}){this.addLineToDom(g,p,{addType:L,context:O,message:P,text:q,args:I})}.bind(this,f,h,{addType:n,context:e,message:r,text:t,args:i}),0)}}writeLogToFile(e){try{if(!fs.existsSync(this.options.logToFilePath)){let t=path.dirname(this.options.logToFilePath);fs.existsSync(t)||fs.mkdirSync(t,{recursive:!0}),fs.writeFileSync(this.options.logToFilePath,"")}if(this.options.logMaxSize&&fs.statSync(this.options.logToFilePath).size>this.options.logMaxSize){this.options.logIndexArchive<this.options.logMaxArchives?++this.options.logIndexArchive:this.options.logIndexArchive=1;let r=this.options.logMaxArchives.toString().length+1,{filePath:i,extension:s,basename:a,dirname:u}=lt(this.options.logToFilePath),f,d;f=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(r,"0"):"",d=this.options.addArchiveTimestamp?"."+ct():"";let h=`${i}${d}${f}${s}`,g=this.options.compressArchives?`${i}.tar.gz`:"";ut(u,a,f,s,g,this.options.compressionLevel,p=>{p&&console.error("DELETION_FAILURE: Failed to delete some files")}),fs.renameSync(this.options.logToFilePath,h),fs.writeFileSync(this.options.logToFilePath,"")}fs.appendFileSync(this.options.logToFilePath,e+this.EOL)}catch(t){l.Console.error("LOG_TO_FILE_FAILURE: ",t.message)}}writeLogToRemote(...e){try{let t=this.generateLogToRemoteUrl(this.options.logToRemoteUrl);if(!t)return null;let n=[...e],r=JSON.stringify(n);fetch(t,{method:"post",body:r,headers:{"Content-Type":"application/json"}}).then(i=>i.json()).catch(()=>null)}catch(t){l.Console.error("LOG_TO_REMOTE_FAILURE: ",t.message)}}writeLogToLocalStorage(e,...t){try{if(!this.isBrowser()||!window.localStorage)return;let n=`analogger_history_${this.instanceName}`,r=[];try{let s=localStorage.getItem(n);s&&(r=JSON.parse(s))}catch{r=[]}r.push({context:e,args:t});let i=this.options.logToLocalStorageMax||50;r.length>i&&(r=r.slice(r.length-i)),localStorage.setItem(n,JSON.stringify(r))}catch(n){l.Console.error("LOG_TO_LOCAL_STORAGE_FAILURE: ",n.message)}}restoreLogs(){try{if(!this.isBrowser()||!window.localStorage)return;let e=`analogger_history_${this.instanceName}`,t=localStorage.getItem(e);if(!t)return;let n=JSON.parse(t);if(!Array.isArray(n))return;let r=this.options.logToLocalStorage;this.options.logToLocalStorage=!1,n.forEach(i=>{let{context:s,args:a}=i;s&&(s.symbol="floppy_disk"),this.processOutput(s,...a)}),this.options.logToLocalStorage=r}catch(e){l.Console.error("RESTORE_LOGS_FAILURE: ",e.message)}}uploadDataToRemote(e,t=null,n=null){try{if(!this.options.logToRemote)return;let r=this.generateLogToRemoteUrl(this.options.logToRemoteBinaryUrl,{pathname:E.binarypathname});if(!r)return null;let i=e;t&&(i=JSON.stringify({raw:e,context:t})),fetch(r,{method:"post",body:i}).then(s=>s.json()).then(s=>n&&n(s)).catch(s=>s)}catch(r){l.Console.error("BINARY_TO_REMOTE_FAILURE: ",r.message)}}stringifyEntry(e){let t;try{t=JSON.stringify(e)}catch{}if(!t)try{t=Re(e)}catch{}return t}convertEntry(e){try{if(e==null||e==="")return e;if(typeof e=="boolean")return e;if(typeof e=="symbol"||typeof e=="number")return e;if(typeof e=="string"||myVar instanceof e)return e;if(e instanceof Date)return e}catch{}return this.stringifyEntry(e)}convertArgumentsToText(e){let t=[],n,r=e.length;for(let i=0;i<r;++i){let s,a=e[i];s=this.convertEntry(a),t.push(s)}return n=t.join("\u2022"),n}writeToConsole(e,t){let n=[e];this.isBrowser()&&n.push(`color: ${t.color}`);let r=t.contextLevel||b.LOG;r>=b.ERROR?l.Console.error(...n):r>=b.WARN?l.Console.warn(...n):r>=b.INFO?l.Console.info(...n):r>=b.LOG?l.Console.log(...n):r>=b.DEBUG&&l.Console.debug(...n)}checkPlugins(e,{message:t,text:n,args:r,logCounter:i}){try{if(!Object.keys(l.pluginTable).length)return;let s=!0;for(let a in e){let u=e[a];if(!u)continue;let f=l.pluginTable[a];if(!f||typeof f!="object")continue;let{callback:d,methodName:h,type:g}=f;if(typeof d!="function")continue;d.call(this,e,{message:t,text:n,args:r,logCounter:i,methodName:h,type:g,pluginOptions:u})===!1&&(s=!1)}return s}catch{}}checkOnLogging(e,t,n,r){if(!!r)try{let i=e[r];return typeof i!="function"?void 0:i.call(this,t,n)}catch{}}isContextMessagePattern(e){return/\{\{[^}]+}}/.test(e)}transformContextMessage(e,t){let n=e;for(let r in t){let i=`{{${r}}}`,s=t[r];n=n.replaceAll(i,s)}return n}processOutput(e={},...t){try{let n="";if(l.lidTableOn&&e.lid){let f=l.lidTable[e.lid];f?(e.message=e.message||f.message,f.callCount=f.callCount||0,++f.callCount,f.callTimes.push(Date.now())):l.lidTable[e.lid]={...e,message:t[0],lid:e.lid,callCount:1,callTimes:[Date.now()]}}if(e.message&&(this.isContextMessagePattern(e.message)&&t.length>=1&&typeof t[0]=="object"&&(e.message=this.transformContextMessage(e.message,t[0]),t.shift()),t.unshift(e.message)),this.applySymbolByName(e),this.checkOnLogging(e,e,t,"onContext"),!this.isTargetAllowed(e.target)||e.logLevel===b.OFF||this.options.requiredLogLevel>e.logLevel)return;let r=this.checkOnLogging(e,t[0],arguments,"onMessage");r!==void 0&&(arguments[1]=r);let i=t;n=this.convertArgumentsToText(i);let s="",a=this.format({...e,message:n});this.keepLog&&this.addToLogHistory({context:e,message:n,text:a}),++this.logCounter;let u=this.checkOnLogging(e,a,{message:n,args:i,logCounter:this.logCounter},"onOutput");if(u===!1||((typeof u=="string"||u instanceof String)&&(a=u),u=this.checkPlugins(e,{message:n,text:a,args:i,logCounter:this.logCounter}),u===!1)||(this.options.logToRemote&&this.writeLogToRemote(e,...i),this.options.logToLocalStorage&&this.writeLogToLocalStorage(e,...i),this.isBrowser()?(e.environnment=l.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(e,a,{message:n,args:i}),s=`%c${a}`):(e.environnment=l.ENVIRONMENT_TYPE.NODE,s=X.getTextFromColor(a,{fg:e.color,bg:e.bgColor,isBold:e.bold,isUnderline:e.underline,isReversed:e.reversed}),this.options.logToFile&&this.writeLogToFile(a)),this.options.hideLog||e.hideLog||e.silent))return;this.writeToConsole(s,e),this.errorTargetHandler(e,i)}catch{}}isExtendedOptionsPassed(e){return typeof e!="object"?!1:e.hasOwnProperty("context")||e.hasOwnProperty("target")||e.hasOwnProperty("color")||e.hasOwnProperty("contextName")||e.hasOwnProperty("raw")||e.hasOwnProperty("lid")}stringToObject(e){try{if(e=e.trim(),e.startsWith("{")&&e.endsWith("}")&&(e=e.slice(1,-1).trim()),!e)return{};let t={},n=e.split(",");for(let r of n){let i=r.trim().split(":");if(i.length<2){if(i.length===2){let d=i[0].trim().replace(/^['"]|['"]$/g,"");t[d]=i[1].trim().replace(/^['"]|['"]$/g,"")}else if(i.length===1&&Object.keys(t).length>0){let d=Object.keys(t).pop();t[d]instanceof Array?t[d].push(i[0].trim().replace(/^['"]|['"]$/g,"")):t[d]=[t[d],i[0].trim().replace(/^['"]|['"]$/g,"")]}continue}let s=i[0],a=i.slice(1).join(":"),u=s.trim().replace(/^['"]|['"]$/g,""),f=a.trim().replace(/^['"]|['"]$/g,"");!isNaN(f)&&!isNaN(parseFloat(f))?t[u]=parseFloat(f):t[u]=f}return t}catch{return null}}extractContextFromInput(e){if(typeof e=="string"||e instanceof String){if(e.toLowerCase().indexOf("lid:")!==0)return e;let t=this.stringToObject(e);t&&(e=t)}if(typeof e=="object"&&!Array.isArray(e)&&e!==null&&this.isExtendedOptionsPassed(e)){if(e.contextName){let t=y(this,S)[e.contextName];t&&(e=Object.assign({},t,e))}e.target||(e.target=this.getActiveTarget())}return e}listSymbols(){for(let e in Z)console.rawLog(Z[e]+` ${e} `)}applySymbolByName(e){try{e.symbol&&Z[e.symbol]&&(e.symbol=Z[e.symbol])}catch{}}convertToContext(e,t){e=e||t;let n=e;if(e.context&&typeof e.context=="object"){let r=Object.assign({},e);delete r.context,n=Object.assign({},e.context,r)}return n=Object.assign({},t,n),delete n.context,n}log(e,...t){if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateDefaultContext();this.processOutput.apply(this,[s,e,...t]);return}(!t||!t.length)&&(t=[e]),e={lid:Ne(this.options.lidLenMax)}}let n=this.generateDefaultContext(),r=this.convertToContext(e,n);if(r.raw){l.Console.log(...t);return}this.resolveLineCall&&(this.resolveErrorLineCall||(r.stack=he())),this.processOutput.apply(this,[r,...t])}error(e,...t){if(this.options.hideError)return;if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateErrorContext();this.processOutput.apply(this,[s,e,...t]);return}e={lid:Ne(this.options.lidLenMax)}}let n=this.generateErrorContext(),r=this.convertToContext(e,n);this.resolveErrorLineCall&&(r.stack=he()),this.log(r,...t),this.options.enableTrace&&console.trace(...t)}overrideError(){this.options.hideHookMessage||l.Console.log("AnaLogger: Hook placed on console.error"),y(this,w).error=!0,console.error=this.onDisplayError.bind(this)}attachConsole(){try{return console.rawLog=l.Console.log,console.raw=l.Console.log,console.rawInfo=l.Console.info,console.rawWarn=l.Console.warn,console.rawError=l.Console.error,console.logHistory=this.logHistory,console.logHistory=this.logHistory,mt.forEach(e=>{console[e]=function(...t){this[e](...t)}.bind(this)}),!0}catch(e){console.error({lid:4321},e.message)}return!1}overrideConsole({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){this.options.hideHookMessage||l.Console.log("AnaLogger: Hook placed on console.log"),[{log:e},{info:t},{warn:n}].forEach(function(i){let s=Object.keys(i)[0];i[s]&&(y(this,w)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),r&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=l.Console.error,y(this,w).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){e&&(console.log=l.Console.log,y(this,w).log=!1),t&&(console.info=l.Console.info,y(this,w).info=!1),n&&(console.warn=l.Console.warn,y(this,w).warn=!1),r&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!y(this,w).log){l.Console.table(...e);return}let t=console.log;console.log=l.Console.log,l.Console.table(...e),console.log=t}takeScreenshot(e={selector:"body",quality:.95,canvasHeight:480,canvasWidth:640}){return new Promise((t,n)=>{if(!this.isBrowser())return;let r="";if(!htmlToImage){r="MISSING_HTML_IMAGE_LIBRARY: htmlToImage is not defined. Please install it first.",l.Console.error(r),n(new Error);return}let{selector:i,quality:s,canvasHeight:a,canvasWidth:u}=e,f=document.querySelector(i),d={quality:s,canvasHeight:a,canvasWidth:u};htmlToImage.toPng(f,d).then(function(h,g){this.uploadDataToRemote(g,h,p=>{t({imageData:g,serverResponse:p})})}.bind(this,e)).catch(function(h){r=`IMAGE_PROCESSING_FAILURE: ${h.message}`,l.Console.error(r),n(new Error(r))})})}alert(...e){if(!this.isBrowser())return this.log(...e);let t;if(e&&(e[0]&&e[0].hasOwnProperty("lid")||this.isContextValid(e[0]))){let n=this.generateDefaultContext();t=this.convertToContext(e[0],n).lid+": "+e.slice(1).join(" | ")}else t=e.join(" | ");alert(t)}assert(e,t=!0,...n){let r;try{return typeof e=="function"?(r=e(...n),r!==t?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):e!==t?(this.error("Assert failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)}catch{this.error("Unexpected error in assert")}return!1}applyAnalogFormatting({activeTarget:e="",override:t=!1}={}){try{let r={STANDARD:null,TEST:{color:"#B18904",symbol:"diamonds"}};return this.setDefaultContext(r.DEFAULT),e&&this.setActiveTarget(e),this.setOptions({silent:!1,hideError:!1,hideHookMessage:!0,lidLenMax:6}),t&&(this.overrideConsole(),this.overrideError()),!0}catch(n){console.error({lid:3249},n.message)}return!1}applyPredefinedFormat(e=Q.DEFAULT_FORMAT,{activeTarget:t="",override:n=!1}={}){if(e===Q.DEFAULT_FORMAT)return this.applyAnalogFormatting({activeTarget:t,override:n})}static generateInstance(){return new l}static getInstance(e=0){return l.instanceCount?y(l,G)[e]:null}static generateMainInstance(){let e=l.getInstance();return e||new l}static startLogger(){l.generateMainInstance().applyPredefinedFormat(Q.DEFAULT_FORMAT,{override:!0})}static stopLogger(){let e=l.generateMainInstance();e.removeOverride(),e.removeOverrideError()}convertToUrl({protocol:e=E.protocol,host:t=E.host,port:n=E.port,pathname:r=E.pathname}={}){let i=new URL("http://localhost");return i.protocol=e,i.host=t,i.port=n,r&&(i.pathname=r),i.toString()}generateLogToRemoteUrl(e=null,{pathname:t=E.pathname}={}){if(typeof e=="string"||e instanceof String)return e;if(!this.isBrowser())return null;let n=this.options.protocol||window.location.protocol+"//",r=this.options.host||window.location.host||E.host,i=this.options.port||E.port;return t=this.options.pathname||t,this.convertToUrl({protocol:n,host:r,port:i,pathname:t})}addPlugin(e,t,n=""){n=n||e,this[e]=t,l.pluginTable[n]={type:Ce.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){l[e]=t,l.pluginTable[n]={type:Ce.GLOBAL,methodName:e,callback:t}}getPluginList(){return Object.keys(l.pluginTable)}validatePlugin(e){return l.pluginTable[e]?!0:(console.warn(`The plugin ${e} is not registered`),!1)}},v=l;G=new WeakMap,S=new WeakMap,C=new WeakMap,F=new WeakMap,w=new WeakMap,ee=new WeakSet,Ie=function(e){let t=this.generateNewContext(),n=Object.assign({},t,e);return n.color.toLowerCase().indexOf("rgb")>-1?n.color=X.rgbStringToHex(n.color):n.color.indexOf("#")===-1&&(n.color=X.colorNameToHex(n.color)),n},te=new WeakSet,Me=function(){try{this.setTargets(T),this.setLogLevels(b),this.setContexts(B)}catch(e){console.error({lid:4321},e.message)}return!1},A(v,G,[]),m(v,"Console",null),m(v,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m(v,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),m(v,"instanceCount",0),m(v,"pluginTable",{}),m(v,"lidTable",{}),m(v,"lidTableOn",!1);var De=v,xt=De,Rt=v.generateMainInstance();var Ct=v;export{Ct as AnaLogger,B as DEFAULT_LOG_CONTEXTS,b as DEFAULT_LOG_LEVELS,T as DEFAULT_LOG_TARGETS,Rt as anaLogger,xt as default};
1
+ var Ke=Object.defineProperty;var Qe=(o,e,t)=>e in o?Ke(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var m=(o,e,t)=>(Qe(o,typeof e!="symbol"?e+"":e,t),t),re=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var y=(o,e,t)=>(re(o,e,"read from private field"),t?t.call(o):e.get(o)),A=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},oe=(o,e,t,n)=>(re(o,e,"write to private field"),n?n.call(o,t):e.set(o,t),t);var ie=(o,e,t)=>(re(o,e,"access private method"),t);var pe={Foreground:38,Background:48},R="\x1B[1D",me="\x1B[0m"+R,V={Bold:"\x1B[1m"+R,Underline:"\x1B[4m"+R,Reversed:"\x1B[7m"+R},Ze={Bold:"\x1B[1m"+R,Underline:"\x1B[4m"+R,Reversed:"\x1B[7m"+R},se={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function et(o){return!!se[o]}var ye=(o,e,t)=>o===e&&e===t?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(e/255*5)+Math.round(t/255*5),be=o=>{let e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;o=o.replace(e,function(n,r,i,s){return r+r+i+i+s+s});let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return t?{red:parseInt(t[1],16),blue:parseInt(t[2],16),green:parseInt(t[3],16)}:{}},ve=function({red:o,green:e,blue:t}){let n=o<<16|e<<8|t<<0;return"#"+(16777216+n).toString(16).slice(1)},Le=function(o){let e=o.matchAll(/\d+/g),t=[];for(let n of e){let r=parseInt(n[0]);if(r>255)return null;t.push(r)}return t.length!==3?null:{red:t[0],green:t[1],blue:t[2]}},tt=function(o){let e=Le(o);return e&&ve(e)},W=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e},Te=({hue:o,saturation:e,lightness:t})=>{let n,r,i;if(e===0)n=r=i=t;else{let s=t<.5?t*(1+e):t+e-t*e,a=2*t-s;n=W(a,s,o+1/3),r=W(a,s,o),i=W(a,s,o-1/3)}return{red:Math.round(n*255),blue:Math.round(i*255),green:Math.round(r*255)}},Ee=o=>{let e=o.toLowerCase();return typeof se[e]<"u"?se[e]:""};function D({red:o,blue:e,green:t},n=!0){if(o===void 0||e===void 0||t===void 0)return"";let r=ye(o,e,t);return`\x1B[${n?pe.Foreground:pe.Background};5;`+r+"m "+R}function M(o,e=!0){let{red:t,green:n,blue:r}=be(o);return D({red:t,green:n,blue:r},e)}function Y({hue:o,saturation:e,lightness:t},n){let{red:r,green:i,blue:s}=Te({hue:o,saturation:e,lightness:t});return D({red:r,green:i,blue:s},n)}function ae(o,e=!0){try{let t;return o=o||"",o?((typeof o=="string"||o instanceof String)&&(o=o.trim()),et(o)?(t=Ee(o),M(t,e)):typeof o=="object"&&!!o.red&&!!o.blue&&!!o.green?D(o,e):typeof o=="object"&&!!o.hue&&!!o.saturation&&!!o.lightness?Y(o,e):o.startsWith("#")?M(o,e):(o=o.toString(),/^[\da-fA-F]+$/.test(o)?M("#"+o,e):"")):""}catch(t){console.error("TO_ANSI_INVALID_ARGUMENT_ERROR",t.message)}}function J(o,{fg:e,bg:t,isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){let s=!1,a="";return e&&(s=!0,a=a+e),t&&(s=!0,a=a+t),n&&(s=!0,a=a+V.Underline),r&&(s=!0,a=a+V.Bold),i&&(s=!0,a=a+V.Reversed),s?a+o+me:o}function nt(o,{fg:e={},bg:t={},isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=D({...e})),t&&(t=D({...t},!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function rt(o,{fg:e="",bg:t="",isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=Y({...e})),t&&(t=Y({...t},!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function ot(o,{fg:e="",bg:t="",isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=M(e)),t&&(t=M(t,!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function it(o,e=null){if(!e)return o;let{fg:t="",bg:n="",isUnderline:r=!1,isBold:i=!1,isReversed:s=!1}=e;return t&&(t=ae(t)),n&&(n=ae(n,!1)),J(o,{fg:t,bg:n,isUnderline:r,isBold:i,isReversed:s})}var X={fromRgb:D,fromHexa:M,fromHsl:Y,fromColor:ae,getTextFromRgb:nt,getTextFromHsl:rt,getTextFromHex:ot,getTextFromColor:it,colorNameToHex:Ee,hslToRgb:Te,hexToRgb:be,rgbToHex:ve,rgbToAnsi256:ye,rgbStringToRgb:Le,rgbStringToHex:tt,hue2rgb:W,RESET:me,FONT_STYLE:V,STYLE:Ze};var we={COLOR_TABLE:["#d2466e","#FFA07A","#FF7F50","#FF6347","#FFE4B5","#ADFF2F","#808000","#40E0D0","#1E90FF","#EE82EE","#708090","#DEB887","#FE642E","#210B61","#088A4B","#5E610B","#FA8258","#088A68","#B40431"],SYSTEM:{BROWSER:"BROWSER",NODE:"NODE"}},k=we.COLOR_TABLE,$=we.SYSTEM,le=2e3,ce="analogger-removed-notif",ue="analogger-header",fe="analogger-view",he="analogger-footer",Se="to-esm-line",K={TOP:"TOP",BOTTOM:"BOTTOM"},Oe="ANALOGGER",Q={DEFAULT_FORMAT:"FORMAT1"};var{parse:wt,stringify:st}=JSON,{keys:St}=Object,at=String,lt="string";var Ae="object",ct=(o,e)=>e;var Re=(o,e,t)=>{let n=at(e.push(t)-1);return o.set(t,n),n};var xe=(o,e,t)=>{let n=e&&typeof e===Ae?(h,d)=>h===""||-1<e.indexOf(h)?d:void 0:e||ct,r=new Map,i=[],s=[],a=+Re(r,i,n.call({"":o},"",o)),u=!a;for(;a<i.length;)u=!0,s[a]=st(i[a++],f,t);return"["+s.join(",")+"]";function f(h,d){if(u)return u=!u,d;let g=n.call(this,h,d);switch(typeof g){case Ae:if(g===null)return g;case lt:return r.get(g)||Re(r,i,g)}return g}};var T={moduleName:"analogger",protocol:"http://",host:"localhost",port:12e3,pathname:"analogger",binarypathname:"uploaded",loopback:"localhost",consoleDomId:"#analogger",logFilename:"./analogger.log"},E={ALL:"ALL",USER:"USER",NONE:"NONE"},b={FATAL:5e3,ERROR:4e3,WARN:3e3,INFO:2e3,LOG:1e3,DEBUG:500,ALL:200,OFF:0,INHERIT:-1},Ce={LOCAL:"local",GLOBAL:"global"},B={DEFAULT:{contextName:"DEFAULT",logLevel:b.LOG,symbol:"check"},LOG:{contextName:"LOG",logLevel:b.LOG,symbol:"check"},DEBUG:{contextName:"DEBUG",logLevel:b.DEBUG},INFO:{contextName:"INFO",logLevel:b.INFO,color:"#B18904",symbol:"diamonds"},WARN:{contextName:"WARN",logLevel:b.WARN,color:k[0],symbol:"cross"},ERROR:{contextName:"ERROR",logLevel:b.ERROR},CRITICAL:{contextName:"CRITICAL",logLevel:b.CRITICAL}},ut=`
2
+ `,Z={airplane:"\u2708",anchor:"\u2693",announcement:"\u{1F4E2}",arrow_backward:"\u25C0",arrow_double_up:"\u23EB",arrow_double_down:"\u23EC",arrow_forward:"\u25B6",arrow_lower_right:"\u2198",arrow_lower_left:"\u2199",arrow_right_hook:"\u21AA",arrow_up_down:"\u2195",arrow_upper_left:"\u2196",arrow_upper_right:"\u2197",ballot_box_with_check:"\u2611",biohazard:"\u2623",black_circle:"\u23FA",black_medium_small_square:"\u25FE",black_medium_square:"\u25FC",black_nib:"\u2712",black_small_square:"\u25AA",black_square:"\u23F9",chains:"\u26D3",check:"\u2714",chess_pawn:"\u265F",cloud_and_rain:"\u26C8",clubs:"\u2663",coffee:"\u2615",computer:"\u{1F4BB}",computer_disk:"\u{1F4BD}",computer_mouse:"\u{1F5B1}\uFE0F",copyright:"\xA9",cross:"\u274C",desktop_computer:"\u{1F5A5}\uFE0F",diamonds:"\u2666",divisions_ign:"\u2797",double_triangle_right:"\u23ED",double_triangle_left:"\u23EE",email:"\u2709",eject:"\u23CF",envelope:"\u2709\uFE0F",exclamation_mark:"\u2757",fast_forward:"\u23E9",female_sign:"\u2640",fire:"\u{1F525}",fist:"\u270A",floppy_disk:"\u{1F4BE}",fuel_pump:"\u26FD",gear:"\u2699",hammer_and_pick:"\u2692",hand:"\u270B",hearts:"\u2665",identification_card:"\u{1F194}",infinity:"\u267E",information:"\u2139",information_source:"\u2139\uFE0F",key:"\u{1F511}",left_right_arrow:"\u2194",leftwards_arrow_with_hook:"\u21A9",lock:"\u{1F512}",male_sign:"\u2642",minus_sign:"\u2796",money_bag:"\u{1F4B0}",no_entry:"\u26D4",old_key:"\u{1F5DD}\uFE0F",partly_sunny:"\u26C5",pencil:"\u270F",phone:"\u260E",pile_of_poo:"\u{1F4A9}",plus_sign:"\u2795",question:"\u2754",radioactive:"\u2622",raised_hand:"\u270B",recycle:"\u267B",registered:"\xAE",relaxed:"\u263A",rewind:"\u23EA",scissors:"\u2702",settings:"\u2699\uFE0F",shield:"\u{1F6E1}\uFE0F",screen_with_curl:"\u{1F4DC}",snowman:"\u2603",spades:"\u2660",sparkles:"\u2728",speech_bubble:"\u{1F4AC}",squared_cancellation_mark:"\u274E",star:"\u2B50",sunny:"\u2600",tent:"\u26FA",thought_balloon:"\u{1F4AD}",trademark:"\u2122",triangle_with_vertical_bar:"\u23EF",umbrella:"\u2614",unlock:"\u{1F513}",vertical_bars:"\u23F8",watch:"\u231A",white_frowning_face:"\u2639",white_medium_square:"\u25FB",white_medium_small_square:"\u25FD",white_small_square:"\u25AB",wheelchair:"\u267F",white_circle:"\u26AA",white_square_containing_black_small_square:"\u25FD",writing_hand:"\u270D"};function ft(o){try{let e=path.extname(o),t=path.basename(o,e),n=path.dirname(o),r=o.slice(0,o.length-e.length);return{extension:e,filePath:r,basename:t,dirname:n}}catch(e){console.error("FILEPATH_EXT_FAILURE: ",e.message)}return{extension:".log",filePath:o}}function ht(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function dt(o,e,t,n,r,i,s){fs.readdir(o,(a,u)=>{if(a){s(a,null);return}let f=[],h=0,d=(p,L)=>{if(!fs.existsSync(p)){L(null,null);return}fs.unlink(p,O=>{O?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${O}`):f.push(p),h++,h===u.length&&L(null,f)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let L=path.join(o,p);r&&mt(L,r,i),d(L,s)}else h++,h===u.length&&s(null,f)};u.length===0?s(null,f):u.forEach(g,i)})}function gt(o,e={}){let t=document.createElement("script");t.textContent=o;for(let n in e)t.setAttribute(n,e[n]);document.head.appendChild(t),t.remove()}function pt(){let o=[];return o.push(`!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).htmlToImage={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}a((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var r,i=(r=0,function(){return r+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(r)});function o(t){for(var e=[],n=0,r=t.length;n<r;n++)e.push(t[n]);return e}var u=null;function c(t){return void 0===t&&(t={}),u||(u=t.includeStyleProperties?t.includeStyleProperties:o(window.getComputedStyle(document.documentElement)))}function a(t,e){var n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function s(t,e){void 0===e&&(e={});var n,r,i,o=e.width||(r=a(n=t,"border-left-width"),i=a(n,"border-right-width"),n.clientWidth+r+i),u=e.height||function(t){var e=a(t,"border-top-width"),n=a(t,"border-bottom-width");return t.clientHeight+e+n}(t);return{width:o,height:u}}var l=16384;function f(t,e){return void 0===e&&(e={}),t.toBlob?new Promise((function(n){t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((function(n){for(var r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=r.length,o=new Uint8Array(i),u=0;u<i;u+=1)o[u]=r.charCodeAt(u);n(new Blob([o],{type:e.type?e.type:"image/png"}))}))}function h(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){r.decode().then((function(){requestAnimationFrame((function(){return e(r)}))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t}))}function d(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(t)})).then(encodeURIComponent).then((function(t){return"data:image/svg+xml;charset=utf-8,".concat(t)}))]}))}))}function v(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u;return n(this,(function(n){return e="http://www.w3.org/2000/svg",o=document.createElementNS(e,"svg"),u=document.createElementNS(e,"foreignObject"),o.setAttribute("width","".concat(r)),o.setAttribute("height","".concat(i)),o.setAttribute("viewBox","0 0 ".concat(r," ").concat(i)),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),o.appendChild(u),u.appendChild(t),[2,d(o)]}))}))}var p=function(t,e){if(t instanceof e)return!0;var n=Object.getPrototypeOf(t);return null!==n&&(n.constructor.name===e.name||p(n,e))};function g(t,e,n,r){var i=".".concat(t,":").concat(e),o=n.cssText?function(t){var e=t.getPropertyValue("content");return"".concat(t.cssText," content: '").concat(e.replace(/'|"/g,""),"';")}(n):function(t,e){return c(e).map((function(e){var n=t.getPropertyValue(e),r=t.getPropertyPriority(e);return"".concat(e,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n,r);return document.createTextNode("".concat(i,"{").concat(o,"}"))}function m(t,e,n,r){var o=window.getComputedStyle(t,n),u=o.getPropertyValue("content");if(""!==u&&"none"!==u){var c=i();try{e.className="".concat(e.className," ").concat(c)}catch(t){return}var a=document.createElement("style");a.appendChild(g(c,n,o,r)),e.appendChild(a)}}var w="application/font-woff",y="image/jpeg",b={woff:w,woff2:w,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:y,jpeg:y,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function S(t){var e=function(t){var e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return b[e]||""}function E(t){return-1!==t.search(/^(data:)/)}function x(t,e){return"data:".concat(e,";base64,").concat(t)}function C(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return[4,fetch(t,r)];case 1:if(404===(e=n.sent()).status)throw new Error('Resource "'.concat(e.url,'" not found'));return[4,e.blob()];case 2:return o=n.sent(),[2,new Promise((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(){try{t(i({res:e,result:r.result}))}catch(t){n(t)}},r.readAsDataURL(o)}))]}}))}))}var P={};function R(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u,c,a;return n(this,(function(n){switch(n.label){case 0:if(e=function(t,e,n){var r=t.replace(/\\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\\//,"")),e?"[".concat(e,"]").concat(r):r}(t,r,i.includeQueryParams),null!=P[e])return[2,P[e]];i.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+(new Date).getTime()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,C(t,i.fetchRequestInit,(function(t){var e=t.res,n=t.result;return r||(r=e.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n)}))];case 2:return u=n.sent(),o=x(u,r),[3,4];case 3:return c=n.sent(),o=i.imagePlaceholder||"",a="Failed to fetch resource: ".concat(t),c&&(a="string"==typeof c?c:c.message),a&&console.warn(a),[3,4];case 4:return P[e]=o,[2,o]}}))}))}function T(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"data:,"===(e=t.toDataURL())?[2,t.cloneNode(!1)]:[2,h(e)]}))}))}function A(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return t.currentSrc?(e=document.createElement("canvas"),i=e.getContext("2d"),e.width=t.clientWidth,e.height=t.clientHeight,null==i||i.drawImage(t,0,0,e.width,e.height),[2,h(e.toDataURL())]):(o=t.poster,u=S(o),[4,R(o,u,r)]);case 1:return[2,h(n.sent())]}}))}))}function k(t,r){var i;return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(null===(i=null==t?void 0:t.contentDocument)||void 0===i?void 0:i.body)?[4,I(t.contentDocument.body,r,!0)]:[3,2];case 1:return[2,e.sent()];case 2:return[3,4];case 3:return e.sent(),[3,4];case 4:return[2,t.cloneNode(!1)]}}))}))}var L=function(t){return null!=t.tagName&&"SVG"===t.tagName.toUpperCase()};function N(t,e,n){return p(e,Element)&&(function(t,e,n){var r=e.style;if(r){var i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):c(n).forEach((function(n){var o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){var u=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o="".concat(u,"px")}p(t,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&e.getAttribute("d")&&(o="path(".concat(e.getAttribute("d"),")")),r.setProperty(n,o,i.getPropertyPriority(n))}))}}(t,e,n),function(t,e,n){m(t,e,":before",n),m(t,e,":after",n)}(t,e,n),function(t,e){p(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),p(t,HTMLInputElement)&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(p(t,HTMLSelectElement)){var n=e,r=Array.from(n.children).find((function(e){return t.value===e.getAttribute("value")}));r&&r.setAttribute("selected","")}}(t,e)),e}function I(t,r,i){return e(this,void 0,void 0,(function(){return n(this,(function(u){return i||!r.filter||r.filter(t)?[2,Promise.resolve(t).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){return p(t,HTMLCanvasElement)?[2,T(t)]:p(t,HTMLVideoElement)?[2,A(t,r)]:p(t,HTMLIFrameElement)?[2,k(t,r)]:[2,t.cloneNode(L(t))]}))}))}(t,r)})).then((function(i){return function(t,r,i){var u,c;return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return L(r)?[2,r]:(e=[],0===(e=null!=(a=t).tagName&&"SLOT"===a.tagName.toUpperCase()&&t.assignedNodes?o(t.assignedNodes()):p(t,HTMLIFrameElement)&&(null===(u=t.contentDocument)||void 0===u?void 0:u.body)?o(t.contentDocument.body.childNodes):o((null!==(c=t.shadowRoot)&&void 0!==c?c:t).childNodes)).length||p(t,HTMLVideoElement)?[2,r]:[4,e.reduce((function(t,e){return t.then((function(){return I(e,i)})).then((function(t){t&&r.appendChild(t)}))}),Promise.resolve())]);case 1:return n.sent(),[2,r]}var a}))}))}(t,i,r)})).then((function(e){return N(t,e,r)})).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c,a,s,l,f,h,d,v,p;return n(this,(function(n){switch(n.label){case 0:if(0===(e=t.querySelectorAll?t.querySelectorAll("use"):[]).length)return[2,t];i={},p=0,n.label=1;case 1:return p<e.length?(o=e[p],(u=o.getAttribute("xlink:href"))?(c=t.querySelector(u),a=document.querySelector(u),c||!a||i[u]?[3,3]:(s=i,l=u,[4,I(a,r,!0)])):[3,3]):[3,4];case 2:s[l]=n.sent(),n.label=3;case 3:return p++,[3,1];case 4:if((f=Object.values(i)).length){for(h="http://www.w3.org/1999/xhtml",(d=document.createElementNS(h,"svg")).setAttribute("xmlns",h),d.style.position="absolute",d.style.width="0",d.style.height="0",d.style.overflow="hidden",d.style.display="none",v=document.createElementNS(h,"defs"),d.appendChild(v),p=0;p<f.length;p++)v.appendChild(f[p]);t.appendChild(d)}return[2,t]}}))}))}(t,r)}))]:[2,null]}))}))}var D=/url\\((['"]?)([^'"]+?)\\1\\)/g,H=/url\\([^)]+\\)\\s*format\\((["']?)([^"']+)\\1\\)/g,M=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function F(t,r,i,o,u){return e(this,void 0,void 0,(function(){var e,c,a,s;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),e=i?function(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}(r,i):r,c=S(r),a=void 0,u?[4,u(e)]:[3,2];case 1:return s=n.sent(),a=x(s,c),[3,4];case 2:return[4,R(e,c,o)];case 3:a=n.sent(),n.label=4;case 4:return[2,t.replace((l=r,f=l.replace(/([.*+?^$`),o.push(`{}()|\\[\\]\\/\\\\])/g,"\\\\$1"),new RegExp("(url\\\\(['\\"]?)(".concat(f,")(['\\"]?\\\\))"),"g")),"$1".concat(a,"$3"))];case 5:return n.sent(),[3,6];case 6:return[2,t]}var l,f}))}))}function V(t){return-1!==t.search(D)}function q(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){return V(t)?(e=function(t,e){var n=e.preferredFontFormat;return n?t.replace(M,(function(t){for(;;){var e=H.exec(t)||[],r=e[0],i=e[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):t}(t,i),o=function(t){var e=[];return t.replace(D,(function(t,n,r){return e.push(r),t})),e.filter((function(t){return!E(t)}))}(e),[2,o.reduce((function(t,e){return t.then((function(t){return F(t,e,r,i)}))}),Promise.resolve(e))]):[2,t]}))}))}function U(t,r,i){var o;return e(this,void 0,void 0,(function(){var e,u;return n(this,(function(n){switch(n.label){case 0:return(e=null===(o=r.style)||void 0===o?void 0:o.getPropertyValue(t))?[4,q(e,null,i)]:[3,2];case 1:return u=n.sent(),r.style.setProperty(t,u,r.style.getPropertyPriority(t)),[2,!0];case 2:return[2,!1]}}))}))}function j(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,U("background",t,r)];case 1:return n.sent()?[3,3]:[4,U("background-image",t,r)];case 2:n.sent(),n.label=3;case 3:return[4,U("mask",t,r)];case 4:return(i=n.sent())?[3,6]:[4,U("-webkit-mask",t,r)];case 5:i=n.sent(),n.label=6;case 6:return(e=i)?[3,8]:[4,U("mask-image",t,r)];case 7:e=n.sent(),n.label=8;case 8:return e?[3,10]:[4,U("-webkit-mask-image",t,r)];case 9:n.sent(),n.label=10;case 10:return[2]}}))}))}function O(t,r){return e(this,void 0,void 0,(function(){var e,i,o;return n(this,(function(n){switch(n.label){case 0:return(e=p(t,HTMLImageElement))&&!E(t.src)||p(t,SVGImageElement)&&!E(t.href.baseVal)?[4,R(i=e?t.src:t.href.baseVal,S(i),r)]:[2];case 1:return o=n.sent(),[4,new Promise((function(n,i){t.onload=n,t.onerror=r.onImageErrorHandler?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{n(r.onImageErrorHandler.apply(r,t))}catch(t){i(t)}}:i;var u=t;u.decode&&(u.decode=n),"lazy"===u.loading&&(u.loading="eager"),e?(t.srcset="",t.src=o):t.href.baseVal=o}))];case 2:return n.sent(),[2]}}))}))}function B(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return e=o(t.childNodes),i=e.map((function(t){return z(t,r)})),[4,Promise.all(i).then((function(){return t}))];case 1:return n.sent(),[2]}}))}))}function z(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return p(t,Element)?[4,j(t,r)]:[3,4];case 1:return e.sent(),[4,O(t,r)];case 2:return e.sent(),[4,B(t,r)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}var W={};function $(t){return e(this,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:return null!=(e=W[t])?[2,e]:[4,fetch(t)];case 1:return[4,n.sent().text()];case 2:return r=n.sent(),e={url:t,cssText:r},W[t]=e,[2,e]}}))}))}function G(t,r){return e(this,void 0,void 0,(function(){var i,o,u,c,a=this;return n(this,(function(s){return i=t.cssText,o=/url\\(["']?([^"')]+)["']?\\)/g,u=i.match(/url\\([^)]+\\)/g)||[],c=u.map((function(u){return e(a,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=u.replace(o,"$1")).startsWith("https://")||(e=new URL(e,t.url).href),[2,C(e,r.fetchRequestInit,(function(t){var e=t.result;return i=i.replace(u,"url(".concat(e,")")),[u,e]}))]}))}))})),[2,Promise.all(c).then((function(){return i}))]}))}))}function _(t){if(null==t)return[];for(var e=[],n=t.replace(/(\\/\\*[\\s\\S]*?\\*\\/)/gi,""),r=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");;){if(null===(u=r.exec(n)))break;e.push(u[0])}n=n.replace(r,"");for(var i=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,o=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");;){var u;if(null===(u=i.exec(n))){if(null===(u=o.exec(n)))break;i.lastIndex=o.lastIndex}else o.lastIndex=i.lastIndex;e.push(u[0])}return e}function J(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){return e=[],i=[],t.forEach((function(e){if("cssRules"in e)try{o(e.cssRules||[]).forEach((function(t,n){if(t.type===CSSRule.IMPORT_RULE){var o=n+1,u=$(t.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){try{e.insertRule(t,t.startsWith("@import")?o+=1:e.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}}))})).catch((function(t){console.error("Error loading remote css",t.toString())}));i.push(u)}}))}catch(o){var n=t.find((function(t){return null==t.href}))||document.styleSheets[0];null!=e.href&&i.push($(e.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){n.insertRule(t,n.cssRules.length)}))})).catch((function(t){console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",o)}})),[2,Promise.all(i).then((function(){return t.forEach((function(t){if("cssRules"in t)try{o(t.cssRules||[]).forEach((function(t){e.push(t)}))}catch(e){console.error("Error while reading CSS rules from ".concat(t.href),e)}})),e}))]}))}))}function Q(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return V(t.style.getPropertyValue("src"))}))}function X(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");return[4,J(o(t.ownerDocument.styleSheets),r)];case 1:return[2,Q(e.sent())]}}))}))}function K(t){return t.trim().replace(/["']/g,"")}function Y(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,X(t,r)];case 1:return e=n.sent(),i=function(t){var e=new Set;return function t(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((function(t){e.add(K(t))})),Array.from(n.children).forEach((function(e){e instanceof HTMLElement&&t(e)}))}(t),e}(t),[4,Promise.all(e.filter((function(t){return i.has(K(t.style.fontFamily))})).map((function(t){var e=t.parentStyleSheet?t.parentStyleSheet.href:null;return q(t.cssText,e,r)})))];case 2:return[2,n.sent().join("\\n")]}}))}))}function Z(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c;return n(this,(function(n){switch(n.label){case 0:return null==r.fontEmbedCSS?[3,1]:(i=r.fontEmbedCSS,[3,5]);case 1:return r.skipFonts?(o=null,[3,4]):[3,2];case 2:return[4,Y(t,r)];case 3:o=n.sent(),n.label=4;case 4:i=o,n.label=5;case 5:return(e=i)&&(u=document.createElement("style"),c=document.createTextNode(e),u.appendChild(c),t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),[2]}}))}))}function tt(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,I(t,r,!0)];case 1:return[4,Z(u=n.sent(),r)];case 2:return n.sent(),[4,z(u,r)];case 3:return n.sent(),function(t,e){var n=t.style;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width="".concat(e.width,"px")),e.height&&(n.height="".concat(e.height,"px"));var r=e.style;null!=r&&Object.keys(r).forEach((function(t){n[t]=r[t]}))}(u,r),[4,v(u,i,o)];case 4:return[2,n.sent()]}}))}))}function et(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u,c,a,f,d,v;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,tt(t,r)];case 1:return[4,h(n.sent())];case 2:return u=n.sent(),c=document.createElement("canvas"),a=c.getContext("2d"),f=r.pixelRatio||function(){var t,e;try{e=process}catch(t){}var n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),d=r.canvasWidth||i,v=r.canvasHeight||o,c.width=d*f,c.height=v*f,r.skipAutoScale||function(t){(t.width>l||t.height>l)&&(t.width>l&&t.height>l?t.width>t.height?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l):t.width>l?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l))}(c),c.style.width="".concat(d),c.style.height="".concat(v),r.backgroundColor&&(a.fillStyle=r.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(u,0,0,c.width,c.height),[2,c]}}))}))}t.getFontEmbedCSS=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Y(t,r)]}))}))},t.toBlob=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[4,f(e.sent())];case 2:return[2,e.sent()]}}))}))},t.toCanvas=et,t.toJpeg=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL("image/jpeg",r.quality||1)]}}))}))},t.toPixelData=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,et(t,r)];case 1:return u=n.sent(),[2,u.getContext("2d").getImageData(0,0,i,o).data]}}))}))},t.toPng=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL()]}}))}))},t.toSvg=tt}));`),o.join("")}function mt(o,e,t=1){try{if(!fs.existsSync(o))return;if(!fs.existsSync(e)){let r=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-init-"));try{let i=path.join(r,path.basename(o));fs.copyFileSync(o,i),c({sync:!0,gzip:{level:t},file:e,cwd:r,portable:!0},[path.basename(o)])}finally{fs.rmSync(r,{recursive:!0,force:!0})}return}let n=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-append-"));try{x({file:e,cwd:n,sync:!0});let r=path.join(n,path.basename(o));fs.copyFileSync(o,r),c({gzip:!0,file:e,cwd:n,sync:!0,portable:!0},fs.readdirSync(n))}finally{fs.rmSync(n,{recursive:!0,force:!0})}}catch(n){console.error(`ARCHIVE_FAILURE: ${n.message}`)}}function de(){try{let e=new Error().stack,t="ana-logger",n=!1,r=null,i,s=[];if(e){let a=e.split(`
3
+ `),u=null;if(a.length>=3){let f=0;for(let h=0,d=a.length;h<d;h++){let g=a[h],p=g.split(":");if(p.length<3){s.push(g);continue}if(f=h,u=p[p.length-3],g.indexOf(t)===-1)break;if(g.indexOf("getInvocationLine")===-1){n=!0,t=u.split(/[\\/]/).pop();break}break}for(let h=f+1,d=a.length;h<d;h++){let g=a[h];if(g.indexOf(u)>-1)continue;let p=g.split(":");if(p.length<3)continue;i=s.join(`
4
+ `)+a.slice(h).join(`
5
+ `);let L=parseInt(p.pop()),O=parseInt(p.pop()),P=p.pop(),I=p.pop().split(" "),z=null;for(let _=0;_<I.length;_++){let H=I[_];if(!!H&&H.indexOf("at")!==0){z=H;break}}r={file:P,line:O,col:L,method:z,isMinified:n,stack:i};break}return r}}}catch{}return null}function Ne(o=8){try{let e=de();if(!e)return`LID${Date.now()}`;let n=e.method.split(".")[0].toUpperCase().substring(0,3);if(n.length>=o)return n.substring(0,o);let r=`${n}:${e.line}`;if(r.length>=o)return r=r.replaceAll(":",""),r.substring(0,o);let i=`${n}:${e.line}:${e.col}`;return i.length>o?i.substring(0,o).endsWith(":")?`${n}${e.line}:${e.col}`.substring(0,o):i.substring(0,o):`${n}${e.line}:${e.col}`.substring(0,o)}catch{return`ERR_LID${Date.now()}`}}function Fe(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?$.NODE:$.BROWSER}var yt=Fe();function bt(){return yt===$.NODE}var vt=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],G,S,C,F,w,ee,Ie,te,Me,l=class{constructor({name:e="default"}={}){A(this,ee);A(this,te);m(this,"system","");m(this,"instanceId","");m(this,"instanceName","");m(this,"logIndex",0);m(this,"logCounter",0);A(this,S,[]);A(this,C,{...E});A(this,F,{});m(this,"activeTargets",[Object.values(E)]);m(this,"indexColor",0);m(this,"format","");m(this,"keepLog",!1);m(this,"logHistory",[]);m(this,"$containers",null);m(this,"options",{hideHookMessage:!1});A(this,w,{log:!1,info:!1,warn:!1,error:!1});m(this,"originalFormatFunction");m(this,"forceLidOn",!1);m(this,"resolveLineCall",!1);m(this,"resolveErrorLineCall",!1);m(this,"removeDomOldEntries",e=>{if(e.childElementCount>le){let n=Math.ceil(le/10);for(let r=0;r<n;++r)e.removeChild(e.firstChild);return n}return 0});m(this,"scrollDivToBottom",e=>{let t=e.scrollHeight-(e.clientHeight+e.scrollTop),n=e.clientHeight||e.offsetHeight;t>n/2||(e.scrollTop=e.scrollHeight)});this.system=Fe(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=e,this.instanceId=l.instanceCount+"-"+Date.now(),y(l,G)[l.instanceCount]=this,++l.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),l.Console||(l.Console={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug,table:console.table}),this.rawLog=l.Console.log,this.rawInfo=l.Console.info,this.rawWarn=l.Console.warn,this.rawError=l.Console.error,this.ALIGN=l.ALIGN,this.ENVIRONMENT_TYPE=l.ENVIRONMENT_TYPE,ie(this,te,Me).call(this),this.resetLogHistory()}getName(){return this.instanceName}getId(){return this.instanceId}forceLid(e=!0){this.forceLidOn=!!e}forceResolveLineCall(e=!0){this.resolveLineCall=!!e}forceResolveErrorLineCall(e=!0){this.resolveErrorLineCall=!!e}importLids(e){for(let t in e){let n=e[t]||{};n.lid=n.lid||t,n.callCount=0,n.callTimes=[],l.lidTable[t]=n}l.lidTableOn=!0}loadLids(e){e=e||{},this.importLids(e)}convertTimestampToDate(e){let t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),u=String(t.getSeconds()).padStart(2,"0"),f=String(t.getMilliseconds()).padStart(3,"0");return`${n}-${r}-${i} ${s}:${a}:${u}.${f}`}getLids(){let e={...De.lidTable};for(let t in e){let n=e[t]||{};if(n.callTimes.length){n.dates=[];for(let r=0;r<n.callTimes.length;++r){let i=n.callTimes[r],s=this.convertTimestampToDate(i);n.dates.push(s)}}}return e}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}addToLogHistory(e){e=e||{},this.logHistory.push(Object.assign({},e))}getLogHistory(e=!0,t=ut){let n=this.logHistory||[],r=[];return n.forEach(i=>{let{text:s}=i;r.push(s)}),e?r.join(t):r}getRawLogHistory(){return this.logHistory||[]}hasSeenLid(e){this.logHistory=this.logHistory||[];for(let t=0;t<this.logHistory.length;++t){let r=(this.logHistory[t]||{}).context||{};if(e===r.lid)return!0}return!1}forceEnvironment(e){this.forcedSystem=e}isNode(){return this&&this.forcedSystem?this.forcedSystem===$.NODE:bt()}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=12,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logMaxSize=0,this.options.logMaxArchives=3,this.options.logIndexArchive=0,this.options.logToRemote=void 0,this.options.addArchiveTimestamp=!0,this.options.addArchiveIndex=!0,this.options.logToRemoteUrl=void 0,this.options.logToRemoteBinaryUrl=void 0,this.options.compressArchives=!1,this.options.compressionLevel=1,this.options.protocol=void 0,this.options.host=void 0,this.options.port=void 0,this.options.pathname=void 0,this.options.binarypathname=void 0,this.options.enableDate=void 0,this.options.logToLocalStorage=void 0,this.options.logToLocalStorageMax=50,this.options.logToLocalStorageSize=1e4,this.options.logToRemoteMaxEntries=void 0,this.options.logToRemoteDebounce=void 0,this.remoteBuffer=[],this.remoteTimer=null}resetOptions(){this.resetLogger()}setOptions({contextLenMax:e=10,idLenMax:t=5,lidLenMax:n=6,symbolLenMax:r=2,enableTrace:i=!0,messageLenMax:s=void 0,hideLog:a=void 0,hideError:u=void 0,hideHookMessage:f=void 0,hidePassingTests:h=void 0,logToDom:d=void 0,logToFile:g=void 0,logMaxSize:p=0,logMaxArchives:L=3,logIndexArchive:O=0,addArchiveTimestamp:P=!0,addArchiveIndex:q=!0,compressArchives:I=!1,compressionLevel:z=1,logToRemote:_=void 0,logToRemoteUrl:H=void 0,logToRemoteBinaryUrl:ke=void 0,loopback:Pe=T.loopback,requiredLogLevel:_e=b.LOG,oneConsolePerContext:He=void 0,silent:ge=void 0,enableDate:Ue=void 0,logToLocalStorage:je=void 0,logToLocalStorageMax:$e=50,logToLocalStorageSize:Be=1e4,logToRemoteMaxEntries:Ge=void 0,logToRemoteDebounce:qe=void 0,protocol:ze=void 0,host:Ve=void 0,port:We=void 0,pathname:Ye=void 0,binarypathname:Je=void 0,loadHtmlToImage:Xe=!1}=null){if(this.options.contextLenMax=e,this.options.idLenMax=t,this.options.lidLenMax=n,this.options.messageLenMax=s,this.options.symbolLenMax=r,this.options.logMaxSize=p,this.options.logMaxArchives=L,this.options.logIndexArchive=O,this.options.addArchiveTimestamp=P,this.options.addArchiveIndex=q,this.options.compressArchives=I,this.options.compressionLevel=z,this.options.requiredLogLevel=_e,this.options.enableTrace=i,this.options.logToLocalStorageMax=$e,this.options.logToLocalStorageSize=Be,this.options.logToRemoteMaxEntries=Ge,this.options.logToRemoteDebounce=qe,Xe){let N=pt();gt(N)}let ne;ge!==void 0?ne=!!ge:a!==void 0&&(ne=!!a),[{hideLog:ne},{oneConsolePerContext:He},{hideError:u},{enableDate:Ue},{hideHookMessage:f},{hidePassingTests:h},{logToRemote:_},{logToLocalStorage:je}].forEach(N=>{let U=Object.keys(N)[0],j=N[U];j!==void 0&&(this.options[U]=!!j)}),[{logToRemoteBinaryUrl:ke},{logToRemoteUrl:H},{loopback:Pe},{protocol:ze},{host:Ve},{port:We},{pathname:Ye},{binarypathname:Je}].forEach(N=>{let U=Object.keys(N)[0],j=N[U];j!==void 0&&(this.options[U]=j)}),this.options.logToRemote&&!this.options.logToRemoteUrl&&(this.options.logToRemoteUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.pathname})),this.options.logToRemote&&!this.options.logToRemoteBinaryUrl&&(this.options.logToRemoteBinaryUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.binarypathname||T.binarypathname})),d===!1?this.options.logToDom=!1:d!==void 0&&(this.options.logToDom=d===!0?T.consoleDomId:d),g===!1?this.options.logToFile=!1:g!==void 0&&(this.isBrowser()||(this.options.logToFile=g||T.logFilename),l.Console.log("LogToFile is not supported in this environment. "))}updateOptions(e){this.setOptions({...this.options,...e})}getOptions(){return this.options}truncateMessage(e="",{fit:t=0,align:n=l.ALIGN.LEFT,ellipsis:r="..."}={}){return e=""+e,t&&e.length>t&&(e=e.substring(0,t-r.length)+r),e=n===l.ALIGN.LEFT?e.padEnd(t," "):e.padStart(t," "),e}onBuildLog({contextName:e,message:t="",lid:n="",symbol:r=""}={}){try{let i="",s=t.split(/\n/g);for(let a=0;a<s.length;++a){let u=s[a],f=new Date,h=("0"+f.getHours()).slice(-2)+":"+("0"+f.getMinutes()).slice(-2)+":"+("0"+f.getSeconds()).slice(-2);this.options.enableDate&&(h=f.getFullYear().toString().slice(-2)+"-"+(f.getMonth()+1).toString().padStart(2,"0")+"-"+f.getDate().toString().padStart(2,"0")+" "+h),h=this.truncateMessage(h,{fit:this.options.timeLenMax}),a>0&&(e="",n=""),e=this.truncateMessage(e,{fit:this.options.contextLenMax,align:l.ALIGN.RIGHT}),n=this.truncateMessage(n,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(u=this.truncateMessage(u,{fit:this.options.messageLenMax})),r=this.truncateMessage(r,{fit:this.options.symbolLenMax}),a<=0?i+=`[${h}] ${e}: (${n}) ${r} ${u}`:a<s.length-1?(i+=`
6
+ `,i+=`[${h}] ${e} ${n} ${u}`):u&&(i+=`
7
+ `,i+=`[${h}] ${e} ${n} ${u}`)}return i}catch(i){l.Console.error(`ANALOGGER_FAILURE_1001: ${i.message}`)}return""}onErrorForUserTarget(e,...t){this.errorUserTargetHandler(e,...t)}onError(e,...t){e.target===y(this,C).USER&&this.onErrorForUserTarget(e,...t)}onDisplayLog(...e){this.log(...e)}assistStask(e){try{let t=e.stack.split(`
8
+ `),n=[];for(let r=0;r<t.length;++r){let i=t[r];n.push(i)}return n}catch(t){l.Console.error(`ANALOGGER_FAILURE_1002: ${t.message}`)}return e.message}onDisplayError(...e){try{let t=-1,n=null;for(let r=0;r<e.length;++r){let i=e[r];if(i instanceof Error&&i.stack){t=r,n=this.assistStask(i)||[];break}}if(!n){this.error(...e);return}for(let r=0;r<n.length;++r)e[t]=n[r],this.error(...e)}catch(t){l.Console.error(`ANALOGGER_FAILURE_1003: ${t.message}`)}}setLogFormat(e){if(typeof e!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=e.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(e){this.errorTargetHandler=e.bind(this)}setErrorHandlerForUserTarget(e){this.errorUserTargetHandler=e.bind(this)}isContextValid(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null?e.hasOwnProperty("contextName")&&e.hasOwnProperty("target"):!1}setDefaultContext(e){this.setContext(B.DEFAULT.contextName,e)}generateDefaultContext(){let e=y(this,S)[B.DEFAULT.contextName]||{};return e=Object.assign({},{lid:"",contextName:B.DEFAULT.contextName,target:E.ALL,symbol:"\u26A1",color:k[1],logLevel:b.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=k[this.indexColor++%(k.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=B.ERROR.contextName,e.name=e.contextName,e.color=k[0],e.symbol="\u274C",e.error=!0,e.logLevel=b.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=ie(this,ee,Ie).call(this,t),y(this,S)[e]=t}getContext(e){return y(this,S)[e]}setContexts(e){Object.keys(e).forEach(n=>{let r=e[n]||{};this.setContext(n,r),e[n]=y(this,S)[n]})}getContexts(){return Object.freeze(y(this,S))}setTargets(e={}){let t={};if(Array.isArray(e))try{for(let n=0;n<e.length;++n){let r=e[n];if(typeof r=="string"||r instanceof String)t[r]=r;else if(typeof r=="object"){let i=null;for(let s in r){let a=r[s];if(s=s.trim(),!s){console.error("Invalid target");break}if(typeof a=="string"||a instanceof String){a=a.trim(),i=[s,a];break}if(typeof a=="number")break}i&&(t[i[0]]=i[1])}}}catch(n){console.error({lid:4321},n.message)}else t=e;oe(this,C,Object.assign({},t,{...E}))}addTargets(e){let t=y(this,C),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(y(this,C))}setActiveTargets(e=null){if(e==null){this.activeTargets=[E.ALL];return}if(typeof e=="function"&&(e=e.call(this)),e===null){this.activeTargets=[E.ALL];return}else if(typeof e=="string"||e instanceof String)e=e.split(",");else if(typeof e=="function")e=e.call(this);else if(typeof e=="object")e=Object.values(e);else if(!Array.isArray(e))return;let t=[];for(let n=0;n<e.length;++n){let r=e[n].trim();Object.values(y(this,C)).includes(r)&&t.push(r)}this.activeTargets=t}getActiveTargets(){return this.activeTargets}getActiveTarget(){return(this.getActiveTargets()||[])[0]||E.NONE}setActiveTarget(e){this.activeTargets=[],this.setActiveTargets(e);let t=this.activeTargets[0]||E.NONE;this.activeTargets=[t]}setLogLevel(e,t){y(this,F)[e]=t}getLogLevel(e){return y(this,F)[e]}setLogLevels(e){oe(this,F,e)}getLogLevels(){return Object.freeze(y(this,F))}isTargetAllowed(e){return e===E.NONE?!1:e===E.ALL||this.getActiveTarget()===E.ALL?!0:this.activeTargets.includes(e)}getCurrentTime(){let e=new Date,t=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),r=String(e.getSeconds()).padStart(2,"0");return`${t}:${n}:${r}`}getCurrentDate(){let e=new Date,t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear()).slice(-2);return`${t}-${n}-${r}`}setColumns(e,t,n){let r=1,i=!1;for(let a in t){if(!["contextName","symbol","lid","text","enableDate","enableTime"].includes(a))continue;let u=t[a];a==="enableDate"&&(u=this.getCurrentDate()+" "+this.getCurrentTime()),a==="enableTime"&&(u=this.getCurrentTime());let f=document.createElement("span");f.classList.add("analogger-col",`analogger-col-${a}`,`analogger-col-${r}`),++r,a!=="enableDate"&&a!=="enableTime"?(f.textContent=u,e.append(f)):(f.textContent=`[${u}]`,i=f)}i&&(i.classList.add("analogger-col","analogger-col-time","analogger-col-0"),e.prepend(i));let s=document.createElement("span");s.classList.add("analogger-col","analogger-col-text",`analogger-col-${r}`),s.textContent=n,e.append(s);for(let a=1;a<=3;++a)s=document.createElement("span"),s.classList.add("analogger-col","analogger-col-extra",`analogger-extra-${a}`),e.append(s)}checkOnLoggingToDom(e,t){try{let n=e.onLoggingToDom;return typeof n!="function"?void 0:n.call(this,e,t)}catch{}}addLineToDom(e,t,{context:n,addType:r,message:i,text:s,args:a}){if(this.checkOnLoggingToDom(n,{message:i,text:s,args:a,logCounter:this.logCounter,$view:e,$line:t,addType:r})===!1)return;if(r===K.BOTTOM?e.append(t):e.insertBefore(t,e.firstChild),this.removeDomOldEntries(e)){if(e.getElementsByClassName(ce).length)return;this.showRemovedNotification(n);return}this.scrollDivToBottom(e)}showRemovedNotification(e){e.contextName=Oe,e.symbol="\u{1F5D1}",e.color="orange",e.className=ce,clearTimeout(this.timerAddLineToDomID),this.timerAddLineToDomID=setTimeout(()=>{this.timerAddLineToDomID=null,this.writeLogToDom(e,"",{addType:K.TOP,message:"Oldest entries removed"})},500)}writeLogToDom(e,t,{addType:n=K.BOTTOM,message:r="",args:i=null}={}){this.$containers=this.$containers||document.querySelectorAll(this.options.logToDom),t=r||t;for(let s=0;s<this.$containers.length;++s){let a=this.$containers[s],u=a.querySelector("."+ue);u||(u=document.createElement("div"),u.classList.add(ue),u.append(document.createElement("span")),u.append(document.createElement("span")),u.append(document.createElement("span")),a.append(u));let f=a.querySelector("."+fe);f||(f=document.createElement("div"),f.classList.add(fe),a.append(f));let h=a.querySelector("."+he);h||(h=document.createElement("div"),h.classList.add(he),h.append(document.createElement("span")),h.append(document.createElement("span")),h.append(document.createElement("span")),a.append(h));let d=document.createElement("div");d.classList.add(Se),e.className&&d.classList.add(e.className),d.style.color=e.color,this.setColumns(d,e,t,i),setTimeout(function(g,p,{addType:L,context:O,message:P,text:q,args:I}){this.addLineToDom(g,p,{addType:L,context:O,message:P,text:q,args:I})}.bind(this,f,d,{addType:n,context:e,message:r,text:t,args:i}),0)}}writeLogToFile(e){try{if(!fs.existsSync(this.options.logToFilePath)){let t=path.dirname(this.options.logToFilePath);fs.existsSync(t)||fs.mkdirSync(t,{recursive:!0}),fs.writeFileSync(this.options.logToFilePath,"")}if(this.options.logMaxSize&&fs.statSync(this.options.logToFilePath).size>this.options.logMaxSize){this.options.logIndexArchive<this.options.logMaxArchives?++this.options.logIndexArchive:this.options.logIndexArchive=1;let r=this.options.logMaxArchives.toString().length+1,{filePath:i,extension:s,basename:a,dirname:u}=ft(this.options.logToFilePath),f,h;f=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(r,"0"):"",h=this.options.addArchiveTimestamp?"."+ht():"";let d=`${i}${h}${f}${s}`,g=this.options.compressArchives?`${i}.tar.gz`:"";dt(u,a,f,s,g,this.options.compressionLevel,p=>{p&&console.error("DELETION_FAILURE: Failed to delete some files")}),fs.renameSync(this.options.logToFilePath,d),fs.writeFileSync(this.options.logToFilePath,"")}fs.appendFileSync(this.options.logToFilePath,e+this.EOL)}catch(t){l.Console.error("LOG_TO_FILE_FAILURE: ",t.message)}}writeLogToRemote(...e){try{if(this.options.logToRemoteMaxEntries===void 0&&this.options.logToRemoteDebounce===void 0){this.performRemotePost([...e]);return}if(this.remoteBuffer.push([...e]),this.options.logToRemoteMaxEntries!==void 0&&this.remoteBuffer.length>=this.options.logToRemoteMaxEntries){this.flushRemoteLogs();return}this.options.logToRemoteDebounce!==void 0&&!this.remoteTimer&&(this.remoteTimer=setTimeout(()=>{this.flushRemoteLogs()},this.options.logToRemoteDebounce))}catch(t){l.Console.error("LOG_TO_REMOTE_FAILURE: ",t.message)}}flushRemoteLogs(){if(this.remoteTimer&&(clearTimeout(this.remoteTimer),this.remoteTimer=null),this.remoteBuffer.length===0)return;let e=[...this.remoteBuffer];this.remoteBuffer=[],this.performRemotePost(e)}performRemotePost(e){try{let t=this.generateLogToRemoteUrl(this.options.logToRemoteUrl);if(!t)return null;let n=JSON.stringify(e);fetch(t,{method:"post",body:n,headers:{"Content-Type":"application/json"}}).then(r=>r.json()).catch(()=>null)}catch(t){l.Console.error("REMOTE_POST_FAILURE: ",t.message)}}writeLogToLocalStorage(e,...t){try{if(!this.isBrowser()||!window.localStorage)return;let n=`analogger_history_${this.instanceName}`,r=[];try{let u=localStorage.getItem(n);u&&(r=JSON.parse(u))}catch{r=[]}r.push({context:e,args:t});let i=this.options.logToLocalStorageMax||50;r.length>i&&(r=r.slice(r.length-i));let s=this.options.logToLocalStorageSize||1e4,a=JSON.stringify(r);for(;a.length>s&&r.length>1;)r.shift(),a=JSON.stringify(r);localStorage.setItem(n,a)}catch(n){l.Console.error("LOG_TO_LOCAL_STORAGE_FAILURE: ",n.message)}}restoreLogs(){try{if(!this.isBrowser()||!window.localStorage)return;let e=`analogger_history_${this.instanceName}`,t=localStorage.getItem(e);if(!t)return;let n=JSON.parse(t);if(!Array.isArray(n))return;let r=this.options.logToLocalStorage;this.options.logToLocalStorage=!1,n.forEach(i=>{let{context:s,args:a}=i;s&&(s.symbol="floppy_disk"),this.processOutput(s,...a)}),this.options.logToLocalStorage=r}catch(e){l.Console.error("RESTORE_LOGS_FAILURE: ",e.message)}}uploadDataToRemote(e,t=null,n=null){try{if(!this.options.logToRemote)return;let r=this.generateLogToRemoteUrl(this.options.logToRemoteBinaryUrl,{pathname:T.binarypathname});if(!r)return null;let i=e;t&&(i=JSON.stringify({raw:e,context:t})),fetch(r,{method:"post",body:i}).then(s=>s.json()).then(s=>n&&n(s)).catch(s=>s)}catch(r){l.Console.error("BINARY_TO_REMOTE_FAILURE: ",r.message)}}stringifyEntry(e){let t;try{t=JSON.stringify(e)}catch{}if(!t)try{t=xe(e)}catch{}return t}convertEntry(e){try{if(e==null||e==="")return e;if(typeof e=="boolean")return e;if(typeof e=="symbol"||typeof e=="number")return e;if(typeof e=="string"||myVar instanceof e)return e;if(e instanceof Date)return e}catch{}return this.stringifyEntry(e)}convertArgumentsToText(e){let t=[],n,r=e.length;for(let i=0;i<r;++i){let s,a=e[i];s=this.convertEntry(a),t.push(s)}return n=t.join("\u2022"),n}writeToConsole(e,t){let n=[e];this.isBrowser()&&n.push(`color: ${t.color}`);let r=t.contextLevel||b.LOG;r>=b.ERROR?l.Console.error(...n):r>=b.WARN?l.Console.warn(...n):r>=b.INFO?l.Console.info(...n):r>=b.LOG?l.Console.log(...n):r>=b.DEBUG&&l.Console.debug(...n)}checkPlugins(e,{message:t,text:n,args:r,logCounter:i}){try{if(!Object.keys(l.pluginTable).length)return;let s=!0;for(let a in e){let u=e[a];if(!u)continue;let f=l.pluginTable[a];if(!f||typeof f!="object")continue;let{callback:h,methodName:d,type:g}=f;if(typeof h!="function")continue;h.call(this,e,{message:t,text:n,args:r,logCounter:i,methodName:d,type:g,pluginOptions:u})===!1&&(s=!1)}return s}catch{}}checkOnLogging(e,t,n,r){if(!!r)try{let i=e[r];return typeof i!="function"?void 0:i.call(this,t,n)}catch{}}isContextMessagePattern(e){return/\{\{[^}]+}}/.test(e)}transformContextMessage(e,t){let n=e;for(let r in t){let i=`{{${r}}}`,s=t[r];n=n.replaceAll(i,s)}return n}processOutput(e={},...t){try{let n="";if(l.lidTableOn&&e.lid){let f=l.lidTable[e.lid];f?(e.message=e.message||f.message,f.callCount=f.callCount||0,++f.callCount,f.callTimes.push(Date.now())):l.lidTable[e.lid]={...e,message:t[0],lid:e.lid,callCount:1,callTimes:[Date.now()]}}if(e.message&&(this.isContextMessagePattern(e.message)&&t.length>=1&&typeof t[0]=="object"&&(e.message=this.transformContextMessage(e.message,t[0]),t.shift()),t.unshift(e.message)),this.applySymbolByName(e),this.checkOnLogging(e,e,t,"onContext"),!this.isTargetAllowed(e.target)||e.logLevel===b.OFF||this.options.requiredLogLevel>e.logLevel)return;let r=this.checkOnLogging(e,t[0],arguments,"onMessage");r!==void 0&&(arguments[1]=r);let i=t;n=this.convertArgumentsToText(i);let s="",a=this.format({...e,message:n});this.keepLog&&this.addToLogHistory({context:e,message:n,text:a}),++this.logCounter;let u=this.checkOnLogging(e,a,{message:n,args:i,logCounter:this.logCounter},"onOutput");if(u===!1||((typeof u=="string"||u instanceof String)&&(a=u),u=this.checkPlugins(e,{message:n,text:a,args:i,logCounter:this.logCounter}),u===!1)||(this.options.logToRemote&&this.writeLogToRemote(e,...i),this.options.logToLocalStorage&&this.writeLogToLocalStorage(e,...i),this.isBrowser()?(e.environnment=l.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(e,a,{message:n,args:i}),s=`%c${a}`):(e.environnment=l.ENVIRONMENT_TYPE.NODE,s=X.getTextFromColor(a,{fg:e.color,bg:e.bgColor,isBold:e.bold,isUnderline:e.underline,isReversed:e.reversed}),this.options.logToFile&&this.writeLogToFile(a)),this.options.hideLog||e.hideLog||e.silent))return;this.writeToConsole(s,e),this.errorTargetHandler(e,i)}catch{}}isExtendedOptionsPassed(e){return typeof e!="object"?!1:e.hasOwnProperty("context")||e.hasOwnProperty("target")||e.hasOwnProperty("color")||e.hasOwnProperty("contextName")||e.hasOwnProperty("raw")||e.hasOwnProperty("lid")}stringToObject(e){try{if(e=e.trim(),e.startsWith("{")&&e.endsWith("}")&&(e=e.slice(1,-1).trim()),!e)return{};let t={},n=e.split(",");for(let r of n){let i=r.trim().split(":");if(i.length<2){if(i.length===2){let h=i[0].trim().replace(/^['"]|['"]$/g,"");t[h]=i[1].trim().replace(/^['"]|['"]$/g,"")}else if(i.length===1&&Object.keys(t).length>0){let h=Object.keys(t).pop();t[h]instanceof Array?t[h].push(i[0].trim().replace(/^['"]|['"]$/g,"")):t[h]=[t[h],i[0].trim().replace(/^['"]|['"]$/g,"")]}continue}let s=i[0],a=i.slice(1).join(":"),u=s.trim().replace(/^['"]|['"]$/g,""),f=a.trim().replace(/^['"]|['"]$/g,"");!isNaN(f)&&!isNaN(parseFloat(f))?t[u]=parseFloat(f):t[u]=f}return t}catch{return null}}extractContextFromInput(e){if(typeof e=="string"||e instanceof String){if(e.toLowerCase().indexOf("lid:")!==0)return e;let t=this.stringToObject(e);t&&(e=t)}if(typeof e=="object"&&!Array.isArray(e)&&e!==null&&this.isExtendedOptionsPassed(e)){if(e.contextName){let t=y(this,S)[e.contextName];t&&(e=Object.assign({},t,e))}e.target||(e.target=this.getActiveTarget())}return e}listSymbols(){for(let e in Z)console.rawLog(Z[e]+` ${e} `)}applySymbolByName(e){try{e.symbol&&Z[e.symbol]&&(e.symbol=Z[e.symbol])}catch{}}convertToContext(e,t){e=e||t;let n=e;if(e.context&&typeof e.context=="object"){let r=Object.assign({},e);delete r.context,n=Object.assign({},e.context,r)}return n=Object.assign({},t,n),delete n.context,n}log(e,...t){if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateDefaultContext();this.processOutput.apply(this,[s,e,...t]);return}(!t||!t.length)&&(t=[e]),e={lid:Ne(this.options.lidLenMax)}}let n=this.generateDefaultContext(),r=this.convertToContext(e,n);if(r.raw){l.Console.log(...t);return}this.resolveLineCall&&(this.resolveErrorLineCall||(r.stack=de())),this.processOutput.apply(this,[r,...t])}error(e,...t){if(this.options.hideError)return;if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateErrorContext();this.processOutput.apply(this,[s,e,...t]);return}e={lid:Ne(this.options.lidLenMax)}}let n=this.generateErrorContext(),r=this.convertToContext(e,n);this.resolveErrorLineCall&&(r.stack=de()),this.log(r,...t),this.options.enableTrace&&console.trace(...t)}overrideError(){this.options.hideHookMessage||l.Console.log("AnaLogger: Hook placed on console.error"),y(this,w).error=!0,console.error=this.onDisplayError.bind(this)}attachConsole(){try{return console.rawLog=l.Console.log,console.raw=l.Console.log,console.rawInfo=l.Console.info,console.rawWarn=l.Console.warn,console.rawError=l.Console.error,console.logHistory=this.logHistory,console.logHistory=this.logHistory,vt.forEach(e=>{console[e]=function(...t){this[e](...t)}.bind(this)}),!0}catch(e){console.error({lid:4321},e.message)}return!1}overrideConsole({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){this.options.hideHookMessage||l.Console.log("AnaLogger: Hook placed on console.log"),[{log:e},{info:t},{warn:n}].forEach(function(i){let s=Object.keys(i)[0];i[s]&&(y(this,w)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),r&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=l.Console.error,y(this,w).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){e&&(console.log=l.Console.log,y(this,w).log=!1),t&&(console.info=l.Console.info,y(this,w).info=!1),n&&(console.warn=l.Console.warn,y(this,w).warn=!1),r&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!y(this,w).log){l.Console.table(...e);return}let t=console.log;console.log=l.Console.log,l.Console.table(...e),console.log=t}takeScreenshot(e={selector:"body",quality:.95,canvasHeight:480,canvasWidth:640}){return new Promise((t,n)=>{if(!this.isBrowser())return;let r="";if(!htmlToImage){r="MISSING_HTML_IMAGE_LIBRARY: htmlToImage is not defined. Please install it first.",l.Console.error(r),n(new Error);return}let{selector:i,quality:s,canvasHeight:a,canvasWidth:u}=e,f=document.querySelector(i),h={quality:s,canvasHeight:a,canvasWidth:u};htmlToImage.toPng(f,h).then(function(d,g){this.uploadDataToRemote(g,d,p=>{t({imageData:g,serverResponse:p})})}.bind(this,e)).catch(function(d){r=`IMAGE_PROCESSING_FAILURE: ${d.message}`,l.Console.error(r),n(new Error(r))})})}alert(...e){if(!this.isBrowser())return this.log(...e);let t;if(e&&(e[0]&&e[0].hasOwnProperty("lid")||this.isContextValid(e[0]))){let n=this.generateDefaultContext();t=this.convertToContext(e[0],n).lid+": "+e.slice(1).join(" | ")}else t=e.join(" | ");alert(t)}assert(e,t=!0,...n){let r;try{return typeof e=="function"?(r=e(...n),r!==t?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):e!==t?(this.error("Assert failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)}catch{this.error("Unexpected error in assert")}return!1}applyAnalogFormatting({activeTarget:e="",override:t=!1}={}){try{let r={STANDARD:null,TEST:{color:"#B18904",symbol:"diamonds"}};return this.setDefaultContext(r.DEFAULT),e&&this.setActiveTarget(e),this.setOptions({silent:!1,hideError:!1,hideHookMessage:!0,lidLenMax:6}),t&&(this.overrideConsole(),this.overrideError()),!0}catch(n){console.error({lid:3249},n.message)}return!1}applyPredefinedFormat(e=Q.DEFAULT_FORMAT,{activeTarget:t="",override:n=!1}={}){if(e===Q.DEFAULT_FORMAT)return this.applyAnalogFormatting({activeTarget:t,override:n})}static generateInstance(){return new l}static getInstance(e=0){return l.instanceCount?y(l,G)[e]:null}static generateMainInstance(){let e=l.getInstance();return e||new l}static startLogger(){l.generateMainInstance().applyPredefinedFormat(Q.DEFAULT_FORMAT,{override:!0})}static stopLogger(){let e=l.generateMainInstance();e.removeOverride(),e.removeOverrideError()}convertToUrl({protocol:e=T.protocol,host:t=T.host,port:n=T.port,pathname:r=T.pathname}={}){let i=new URL("http://localhost");return i.protocol=e,i.host=t,i.port=n,r&&(i.pathname=r),i.toString()}generateLogToRemoteUrl(e=null,{pathname:t=T.pathname}={}){if(typeof e=="string"||e instanceof String)return e;if(!this.isBrowser())return null;let n=this.options.protocol||window.location.protocol+"//",r=this.options.host||window.location.host||T.host,i=this.options.port||T.port;return t=this.options.pathname||t,this.convertToUrl({protocol:n,host:r,port:i,pathname:t})}addPlugin(e,t,n=""){n=n||e,this[e]=t,l.pluginTable[n]={type:Ce.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){l[e]=t,l.pluginTable[n]={type:Ce.GLOBAL,methodName:e,callback:t}}getPluginList(){return Object.keys(l.pluginTable)}validatePlugin(e){return l.pluginTable[e]?!0:(console.warn(`The plugin ${e} is not registered`),!1)}},v=l;G=new WeakMap,S=new WeakMap,C=new WeakMap,F=new WeakMap,w=new WeakMap,ee=new WeakSet,Ie=function(e){let t=this.generateNewContext(),n=Object.assign({},t,e);return n.color.toLowerCase().indexOf("rgb")>-1?n.color=X.rgbStringToHex(n.color):n.color.indexOf("#")===-1&&(n.color=X.colorNameToHex(n.color)),n},te=new WeakSet,Me=function(){try{this.setTargets(E),this.setLogLevels(b),this.setContexts(B)}catch(e){console.error({lid:4321},e.message)}return!1},A(v,G,[]),m(v,"Console",null),m(v,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m(v,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),m(v,"instanceCount",0),m(v,"pluginTable",{}),m(v,"lidTable",{}),m(v,"lidTableOn",!1);var De=v,Nt=De,Ft=v.generateMainInstance();var It=v;export{It as AnaLogger,B as DEFAULT_LOG_CONTEXTS,b as DEFAULT_LOG_LEVELS,E as DEFAULT_LOG_TARGETS,Ft as anaLogger,Nt as default};
9
9
 
@@ -940,6 +940,11 @@ class ____AnaLogger
940
940
  this.options.enableDate = undefined;
941
941
  this.options.logToLocalStorage = undefined;
942
942
  this.options.logToLocalStorageMax = 50;
943
+ this.options.logToLocalStorageSize = 10000;
944
+ this.options.logToRemoteMaxEntries = undefined;
945
+ this.options.logToRemoteDebounce = undefined;
946
+ this.remoteBuffer = [];
947
+ this.remoteTimer = null;
943
948
  }
944
949
 
945
950
  resetOptions()
@@ -977,6 +982,9 @@ class ____AnaLogger
977
982
  enableDate = undefined,
978
983
  logToLocalStorage = undefined,
979
984
  logToLocalStorageMax = 50,
985
+ logToLocalStorageSize = 10000,
986
+ logToRemoteMaxEntries = undefined,
987
+ logToRemoteDebounce = undefined,
980
988
  /** Remote - all optional **/
981
989
  protocol = undefined,
982
990
  host = undefined,
@@ -1004,6 +1012,9 @@ class ____AnaLogger
1004
1012
  this.options.enableTrace = enableTrace;
1005
1013
 
1006
1014
  this.options.logToLocalStorageMax = logToLocalStorageMax;
1015
+ this.options.logToLocalStorageSize = logToLocalStorageSize;
1016
+ this.options.logToRemoteMaxEntries = logToRemoteMaxEntries;
1017
+ this.options.logToRemoteDebounce = logToRemoteDebounce;
1007
1018
 
1008
1019
  if (loadHtmlToImage) {
1009
1020
  const code = getHtmlToImage();
@@ -1999,6 +2010,58 @@ class ____AnaLogger
1999
2010
  }
2000
2011
 
2001
2012
  writeLogToRemote(...data)
2013
+ {
2014
+ try
2015
+ {
2016
+ if (this.options.logToRemoteMaxEntries === undefined && this.options.logToRemoteDebounce === undefined)
2017
+ {
2018
+ this.performRemotePost([...data]);
2019
+ return;
2020
+ }
2021
+
2022
+ this.remoteBuffer.push([...data]);
2023
+
2024
+ if (this.options.logToRemoteMaxEntries !== undefined && this.remoteBuffer.length >= this.options.logToRemoteMaxEntries)
2025
+ {
2026
+ this.flushRemoteLogs();
2027
+ return;
2028
+ }
2029
+
2030
+ if (this.options.logToRemoteDebounce !== undefined && !this.remoteTimer)
2031
+ {
2032
+ this.remoteTimer = setTimeout(() =>
2033
+ {
2034
+ this.flushRemoteLogs();
2035
+ }, this.options.logToRemoteDebounce);
2036
+ }
2037
+ }
2038
+ catch (e)
2039
+ {
2040
+ /* istanbul ignore next */
2041
+ ____AnaLogger.Console.error("LOG_TO_REMOTE_FAILURE: ", e.message);
2042
+ }
2043
+ }
2044
+
2045
+ flushRemoteLogs()
2046
+ {
2047
+ if (this.remoteTimer)
2048
+ {
2049
+ clearTimeout(this.remoteTimer);
2050
+ this.remoteTimer = null;
2051
+ }
2052
+
2053
+ if (this.remoteBuffer.length === 0)
2054
+ {
2055
+ return;
2056
+ }
2057
+
2058
+ const dataToFlush = [...this.remoteBuffer];
2059
+ this.remoteBuffer = [];
2060
+
2061
+ this.performRemotePost(dataToFlush);
2062
+ }
2063
+
2064
+ performRemotePost(data)
2002
2065
  {
2003
2066
  try
2004
2067
  {
@@ -2008,8 +2071,7 @@ class ____AnaLogger
2008
2071
  return null;
2009
2072
  }
2010
2073
 
2011
- const entry = [...data];
2012
- const stringified = JSON.stringify(entry);
2074
+ const stringified = JSON.stringify(data);
2013
2075
  fetch(urlDest, {
2014
2076
  method : "post",
2015
2077
  body : stringified,
@@ -2021,7 +2083,7 @@ class ____AnaLogger
2021
2083
  catch (e)
2022
2084
  {
2023
2085
  /* istanbul ignore next */
2024
- ____AnaLogger.Console.error("LOG_TO_REMOTE_FAILURE: ", e.message);
2086
+ ____AnaLogger.Console.error("REMOTE_POST_FAILURE: ", e.message);
2025
2087
  }
2026
2088
  }
2027
2089
 
@@ -2057,7 +2119,16 @@ class ____AnaLogger
2057
2119
  history = history.slice(history.length - max);
2058
2120
  }
2059
2121
 
2060
- localStorage.setItem(key, JSON.stringify(history));
2122
+ const maxSize = this.options.logToLocalStorageSize || 10000;
2123
+ let serialized = JSON.stringify(history);
2124
+
2125
+ while (serialized.length > maxSize && history.length > 1)
2126
+ {
2127
+ history.shift();
2128
+ serialized = JSON.stringify(history);
2129
+ }
2130
+
2131
+ localStorage.setItem(key, serialized);
2061
2132
  }
2062
2133
  catch (e)
2063
2134
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "analogger",
3
- "version": "2.1.1",
3
+ "version": "2.2.1",
4
4
  "description": "Js Logger",
5
5
  "main": "./src/ana-logger.cjs",
6
6
  "module": "./esm/src/ana-logger.mjs",
@@ -926,6 +926,11 @@ class ____AnaLogger
926
926
  this.options.enableDate = undefined;
927
927
  this.options.logToLocalStorage = undefined;
928
928
  this.options.logToLocalStorageMax = 50;
929
+ this.options.logToLocalStorageSize = 10000;
930
+ this.options.logToRemoteMaxEntries = undefined;
931
+ this.options.logToRemoteDebounce = undefined;
932
+ this.remoteBuffer = [];
933
+ this.remoteTimer = null;
929
934
  }
930
935
 
931
936
  resetOptions()
@@ -963,6 +968,9 @@ class ____AnaLogger
963
968
  enableDate = undefined,
964
969
  logToLocalStorage = undefined,
965
970
  logToLocalStorageMax = 50,
971
+ logToLocalStorageSize = 10000,
972
+ logToRemoteMaxEntries = undefined,
973
+ logToRemoteDebounce = undefined,
966
974
  /** Remote - all optional **/
967
975
  protocol = undefined,
968
976
  host = undefined,
@@ -990,6 +998,9 @@ class ____AnaLogger
990
998
  this.options.enableTrace = enableTrace;
991
999
 
992
1000
  this.options.logToLocalStorageMax = logToLocalStorageMax;
1001
+ this.options.logToLocalStorageSize = logToLocalStorageSize;
1002
+ this.options.logToRemoteMaxEntries = logToRemoteMaxEntries;
1003
+ this.options.logToRemoteDebounce = logToRemoteDebounce;
993
1004
 
994
1005
  if (loadHtmlToImage) {
995
1006
  const code = getHtmlToImage();
@@ -1987,6 +1998,58 @@ class ____AnaLogger
1987
1998
  }
1988
1999
 
1989
2000
  writeLogToRemote(...data)
2001
+ {
2002
+ try
2003
+ {
2004
+ if (this.options.logToRemoteMaxEntries === undefined && this.options.logToRemoteDebounce === undefined)
2005
+ {
2006
+ this.performRemotePost([...data]);
2007
+ return;
2008
+ }
2009
+
2010
+ this.remoteBuffer.push([...data]);
2011
+
2012
+ if (this.options.logToRemoteMaxEntries !== undefined && this.remoteBuffer.length >= this.options.logToRemoteMaxEntries)
2013
+ {
2014
+ this.flushRemoteLogs();
2015
+ return;
2016
+ }
2017
+
2018
+ if (this.options.logToRemoteDebounce !== undefined && !this.remoteTimer)
2019
+ {
2020
+ this.remoteTimer = setTimeout(() =>
2021
+ {
2022
+ this.flushRemoteLogs();
2023
+ }, this.options.logToRemoteDebounce);
2024
+ }
2025
+ }
2026
+ catch (e)
2027
+ {
2028
+ /* istanbul ignore next */
2029
+ ____AnaLogger.Console.error("LOG_TO_REMOTE_FAILURE: ", e.message);
2030
+ }
2031
+ }
2032
+
2033
+ flushRemoteLogs()
2034
+ {
2035
+ if (this.remoteTimer)
2036
+ {
2037
+ clearTimeout(this.remoteTimer);
2038
+ this.remoteTimer = null;
2039
+ }
2040
+
2041
+ if (this.remoteBuffer.length === 0)
2042
+ {
2043
+ return;
2044
+ }
2045
+
2046
+ const dataToFlush = [...this.remoteBuffer];
2047
+ this.remoteBuffer = [];
2048
+
2049
+ this.performRemotePost(dataToFlush);
2050
+ }
2051
+
2052
+ performRemotePost(data)
1990
2053
  {
1991
2054
  try
1992
2055
  {
@@ -1996,8 +2059,7 @@ class ____AnaLogger
1996
2059
  return null;
1997
2060
  }
1998
2061
 
1999
- const entry = [...data];
2000
- const stringified = JSON.stringify(entry);
2062
+ const stringified = JSON.stringify(data);
2001
2063
  fetch(urlDest, {
2002
2064
  method : "post",
2003
2065
  body : stringified,
@@ -2009,7 +2071,7 @@ class ____AnaLogger
2009
2071
  catch (e)
2010
2072
  {
2011
2073
  /* istanbul ignore next */
2012
- ____AnaLogger.Console.error("LOG_TO_REMOTE_FAILURE: ", e.message);
2074
+ ____AnaLogger.Console.error("REMOTE_POST_FAILURE: ", e.message);
2013
2075
  }
2014
2076
  }
2015
2077
 
@@ -2045,7 +2107,16 @@ class ____AnaLogger
2045
2107
  history = history.slice(history.length - max);
2046
2108
  }
2047
2109
 
2048
- localStorage.setItem(key, JSON.stringify(history));
2110
+ const maxSize = this.options.logToLocalStorageSize || 10000;
2111
+ let serialized = JSON.stringify(history);
2112
+
2113
+ while (serialized.length > maxSize && history.length > 1)
2114
+ {
2115
+ history.shift();
2116
+ serialized = JSON.stringify(history);
2117
+ }
2118
+
2119
+ localStorage.setItem(key, serialized);
2049
2120
  }
2050
2121
  catch (e)
2051
2122
  {