analogger 2.3.1 → 2.3.3
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 +31 -0
- package/ana-logger.d.cts +8 -2
- package/browser/ana-logger.mjs +57 -11
- package/dist/analogger-browser.min.mjs +4 -4
- package/dist/html-to-image-plugin.min.mjs +4 -4
- package/esm/ana-logger.mjs +57 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -379,6 +379,37 @@ _The data received by your server may look like this:_
|
|
|
379
379
|
> Your server must support the POST method.
|
|
380
380
|
|
|
381
381
|
|
|
382
|
+
<br/>
|
|
383
|
+
|
|
384
|
+
##### Backend implementation example
|
|
385
|
+
|
|
386
|
+
To receive remote logs from the frontend, you can implement a simple endpoint in your Node.js/Express-like backend:
|
|
387
|
+
|
|
388
|
+
```javascript
|
|
389
|
+
// Endpoint to receive remote logs from the frontend
|
|
390
|
+
router.post("/api/logs", (req, res) => {
|
|
391
|
+
try {
|
|
392
|
+
const logs = req.body;
|
|
393
|
+
if (Array.isArray(logs)) {
|
|
394
|
+
if (logs.length > 0) {
|
|
395
|
+
for (const log of logs) {
|
|
396
|
+
const context = log[0] || {};
|
|
397
|
+
const message = log[1];
|
|
398
|
+
anaLogger.log({
|
|
399
|
+
lid: "REMOTE00",
|
|
400
|
+
symbol: "airplane"
|
|
401
|
+
}, `[${context.lid}][${context.contextName}] ${message}`);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
res.json({ success: true });
|
|
406
|
+
} catch (error) {
|
|
407
|
+
anaLogger.error({ lid: "API10017" }, "Error processing remote logs:", error);
|
|
408
|
+
res.status(status.INTERNAL_SERVER_ERROR).json({ success: false, error: status[status.INTERNAL_SERVER_ERROR] });
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
```
|
|
412
|
+
|
|
382
413
|
<br/>
|
|
383
414
|
<br/>
|
|
384
415
|
|
package/ana-logger.d.cts
CHANGED
|
@@ -115,9 +115,15 @@ declare class ____AnaLogger {
|
|
|
115
115
|
* @returns {boolean}
|
|
116
116
|
*/
|
|
117
117
|
isBrowser(): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Get a unique identifier generated once by the logger and saved in the local storage.
|
|
120
|
+
* @returns {string|null}
|
|
121
|
+
*/
|
|
122
|
+
getUid(): string | null;
|
|
118
123
|
resetLogger(): void;
|
|
124
|
+
remoteWaitCount: any;
|
|
119
125
|
resetOptions(): void;
|
|
120
|
-
setOptions({ timeLenMax, 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, enableMillisec, logToLocalStorage, logToLocalStorageMax, logToLocalStorageSize, logToRemoteMaxEntries, logToRemoteDebounce, logToRemoteMaxSize, logToRemoteMinSize, protocol, host, port, pathname, binarypathname, loadHtmlToImage }?: any): void;
|
|
126
|
+
setOptions({ timeLenMax, 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, enableMillisec, logToLocalStorage, logToLocalStorageMax, logToLocalStorageSize, logToRemoteMaxEntries, logToRemoteDebounce, logToRemoteMaxSize, logToRemoteMinSize, logUidToRemote, protocol, host, port, pathname, binarypathname, loadHtmlToImage }?: any): void;
|
|
121
127
|
EOL: string;
|
|
122
128
|
updateOptions(options: any): void;
|
|
123
129
|
getOptions(): {
|
|
@@ -262,7 +268,7 @@ declare class ____AnaLogger {
|
|
|
262
268
|
}): void;
|
|
263
269
|
writeLogToFile(text: any): void;
|
|
264
270
|
writeLogToRemote(...data: any[]): void;
|
|
265
|
-
flushRemoteLogs(): void;
|
|
271
|
+
flushRemoteLogs(force?: boolean): void;
|
|
266
272
|
performRemotePost(data: any): any;
|
|
267
273
|
writeLogToLocalStorage(context: any, ...args: any[]): void;
|
|
268
274
|
restoreLogs(): void;
|
package/browser/ana-logger.mjs
CHANGED
|
@@ -902,10 +902,33 @@ class ____AnaLogger
|
|
|
902
902
|
return !this.isNode();
|
|
903
903
|
}
|
|
904
904
|
|
|
905
|
+
/**
|
|
906
|
+
* Get a unique identifier generated once by the logger and saved in the local storage.
|
|
907
|
+
* @returns {string|null}
|
|
908
|
+
*/
|
|
909
|
+
getUid()
|
|
910
|
+
{
|
|
911
|
+
if (!this.isBrowser() || typeof window === "undefined" || !window.localStorage)
|
|
912
|
+
{
|
|
913
|
+
return null;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
const key = "analogger-uid";
|
|
917
|
+
let uid = window.localStorage.getItem(key);
|
|
918
|
+
|
|
919
|
+
if (!uid)
|
|
920
|
+
{
|
|
921
|
+
uid = "uid-" + Date.now() + "-" + Math.floor(Math.random() * 1000000);
|
|
922
|
+
window.localStorage.setItem(key, uid);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
return uid;
|
|
926
|
+
}
|
|
927
|
+
|
|
905
928
|
resetLogger()
|
|
906
929
|
{
|
|
907
930
|
this.options = {};
|
|
908
|
-
this.options.timeLenMax =
|
|
931
|
+
this.options.timeLenMax = 12;
|
|
909
932
|
this.options.contextLenMax = 10;
|
|
910
933
|
this.options.idLenMax = 5;
|
|
911
934
|
this.options.lidLenMax = 6;
|
|
@@ -942,8 +965,10 @@ class ____AnaLogger
|
|
|
942
965
|
this.options.logToRemoteDebounce = undefined;
|
|
943
966
|
this.options.logToRemoteMaxSize = undefined;
|
|
944
967
|
this.options.logToRemoteMinSize = undefined;
|
|
968
|
+
this.options.logUidToRemote = undefined;
|
|
945
969
|
this.remoteBuffer = [];
|
|
946
970
|
this.remoteTimer = null;
|
|
971
|
+
this.remoteWaitCount = 0;
|
|
947
972
|
}
|
|
948
973
|
|
|
949
974
|
resetOptions()
|
|
@@ -988,6 +1013,7 @@ class ____AnaLogger
|
|
|
988
1013
|
logToRemoteDebounce = undefined,
|
|
989
1014
|
logToRemoteMaxSize = undefined,
|
|
990
1015
|
logToRemoteMinSize = undefined,
|
|
1016
|
+
logUidToRemote = undefined,
|
|
991
1017
|
/** Remote - all optional **/
|
|
992
1018
|
protocol = undefined,
|
|
993
1019
|
host = undefined,
|
|
@@ -1034,6 +1060,7 @@ class ____AnaLogger
|
|
|
1034
1060
|
this.options.logToRemoteDebounce = logToRemoteDebounce;
|
|
1035
1061
|
this.options.logToRemoteMaxSize = logToRemoteMaxSize;
|
|
1036
1062
|
this.options.logToRemoteMinSize = logToRemoteMinSize;
|
|
1063
|
+
this.options.logUidToRemote = logUidToRemote;
|
|
1037
1064
|
|
|
1038
1065
|
if (loadHtmlToImage) {
|
|
1039
1066
|
const code = getHtmlToImage();
|
|
@@ -1061,6 +1088,7 @@ class ____AnaLogger
|
|
|
1061
1088
|
{hidePassingTests},
|
|
1062
1089
|
{logToRemote},
|
|
1063
1090
|
{logToLocalStorage},
|
|
1091
|
+
{logUidToRemote},
|
|
1064
1092
|
].forEach((feature) =>
|
|
1065
1093
|
{
|
|
1066
1094
|
const key = Object.keys(feature)[0];
|
|
@@ -2060,7 +2088,7 @@ class ____AnaLogger
|
|
|
2060
2088
|
|
|
2061
2089
|
if (this.options.logToRemoteMaxEntries !== undefined && this.remoteBuffer.length >= this.options.logToRemoteMaxEntries)
|
|
2062
2090
|
{
|
|
2063
|
-
this.flushRemoteLogs();
|
|
2091
|
+
this.flushRemoteLogs(true);
|
|
2064
2092
|
return;
|
|
2065
2093
|
}
|
|
2066
2094
|
|
|
@@ -2069,7 +2097,7 @@ class ____AnaLogger
|
|
|
2069
2097
|
const currentSize = JSON.stringify(this.remoteBuffer).length;
|
|
2070
2098
|
if (currentSize >= this.options.logToRemoteMaxSize)
|
|
2071
2099
|
{
|
|
2072
|
-
this.flushRemoteLogs();
|
|
2100
|
+
this.flushRemoteLogs(true);
|
|
2073
2101
|
return;
|
|
2074
2102
|
}
|
|
2075
2103
|
}
|
|
@@ -2090,27 +2118,38 @@ class ____AnaLogger
|
|
|
2090
2118
|
}
|
|
2091
2119
|
}
|
|
2092
2120
|
|
|
2093
|
-
flushRemoteLogs()
|
|
2121
|
+
flushRemoteLogs(force = false)
|
|
2094
2122
|
{
|
|
2095
2123
|
if (this.remoteBuffer.length === 0)
|
|
2096
2124
|
{
|
|
2097
2125
|
return;
|
|
2098
2126
|
}
|
|
2099
2127
|
|
|
2100
|
-
if (this.options.logToRemoteMinSize !== undefined)
|
|
2128
|
+
if (!force && this.options.logToRemoteMinSize !== undefined)
|
|
2101
2129
|
{
|
|
2102
2130
|
const currentSize = JSON.stringify(this.remoteBuffer).length;
|
|
2103
2131
|
if (currentSize < this.options.logToRemoteMinSize)
|
|
2104
2132
|
{
|
|
2105
|
-
// If we haven't reached min size,
|
|
2106
|
-
|
|
2133
|
+
// If we haven't reached min size, increment wait count
|
|
2134
|
+
this.remoteWaitCount = (this.remoteWaitCount || 0) + 1;
|
|
2135
|
+
|
|
2136
|
+
// If we've waited long enough (e.g. 1 consecutive skip), flush anyway
|
|
2137
|
+
if (this.remoteWaitCount < 2)
|
|
2107
2138
|
{
|
|
2108
|
-
|
|
2139
|
+
// If we haven't reached min size, and there's no timer, start one if debounce is set
|
|
2140
|
+
if (this.options.logToRemoteDebounce !== undefined)
|
|
2109
2141
|
{
|
|
2110
|
-
this.
|
|
2111
|
-
|
|
2142
|
+
if (this.remoteTimer)
|
|
2143
|
+
{
|
|
2144
|
+
clearTimeout(this.remoteTimer);
|
|
2145
|
+
}
|
|
2146
|
+
this.remoteTimer = setTimeout(() =>
|
|
2147
|
+
{
|
|
2148
|
+
this.flushRemoteLogs();
|
|
2149
|
+
}, this.options.logToRemoteDebounce);
|
|
2150
|
+
}
|
|
2151
|
+
return;
|
|
2112
2152
|
}
|
|
2113
|
-
return;
|
|
2114
2153
|
}
|
|
2115
2154
|
}
|
|
2116
2155
|
|
|
@@ -2120,6 +2159,7 @@ class ____AnaLogger
|
|
|
2120
2159
|
this.remoteTimer = null;
|
|
2121
2160
|
}
|
|
2122
2161
|
|
|
2162
|
+
this.remoteWaitCount = 0;
|
|
2123
2163
|
const dataToFlush = [...this.remoteBuffer];
|
|
2124
2164
|
this.remoteBuffer = [];
|
|
2125
2165
|
|
|
@@ -2614,6 +2654,12 @@ class ____AnaLogger
|
|
|
2614
2654
|
|
|
2615
2655
|
message = this.convertArgumentsToText(args);
|
|
2616
2656
|
|
|
2657
|
+
// Ensure UID is set early so it's available in history/context when requested
|
|
2658
|
+
if (this.options.logUidToRemote)
|
|
2659
|
+
{
|
|
2660
|
+
context.uid = this.getUid();
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2617
2663
|
let output = "";
|
|
2618
2664
|
let text = this.format({...context, message});
|
|
2619
2665
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
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 pt(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 mt(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function bt(o,e,t,n,r,i,s){fs.readdir(o,(a,u)=>{if(a){s(a,null);return}let f=[],h=0,d=(p,v)=>{if(!fs.existsSync(p)){v(null,null);return}fs.unlink(p,S=>{S?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${S}`):f.push(p),h++,h===u.length&&v(null,f)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let v=path.join(o,p);r&&Lt(v,r,i),d(v,s)}else h++,h===u.length&&s(null,f)};u.length===0?s(null,f):u.forEach(g,i)})}function yt(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 vt(){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 Lt(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(`
|
|
1
|
+
var nt=Object.defineProperty;var rt=(o,e,t)=>e in o?nt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var m=(o,e,t)=>(rt(o,typeof e!="symbol"?e+"":e,t),t),re=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var b=(o,e,t)=>(re(o,e,"read from private field"),t?t.call(o):e.get(o)),R=(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 ve={Foreground:38,Background:48},A="\x1B[1D",Te="\x1B[0m"+A,V={Bold:"\x1B[1m"+A,Underline:"\x1B[4m"+A,Reversed:"\x1B[7m"+A},ot={Bold:"\x1B[1m"+A,Underline:"\x1B[4m"+A,Reversed:"\x1B[7m"+A},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 it(o){return!!se[o]}var Le=(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),Ee=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)}:{}},we=function({red:o,green:e,blue:t}){let n=o<<16|e<<8|t<<0;return"#"+(16777216+n).toString(16).slice(1)},Se=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]}},st=function(o){let e=Se(o);return e&&we(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},Oe=({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)}},xe=o=>{let e=o.toLowerCase();return typeof se[e]<"u"?se[e]:""};function P({red:o,blue:e,green:t},n=!0){if(o===void 0||e===void 0||t===void 0)return"";let r=Le(o,e,t);return`\x1B[${n?ve.Foreground:ve.Background};5;`+r+"m "+A}function k(o,e=!0){let{red:t,green:n,blue:r}=Ee(o);return P({red:t,green:n,blue:r},e)}function Y({hue:o,saturation:e,lightness:t},n){let{red:r,green:i,blue:s}=Oe({hue:o,saturation:e,lightness:t});return P({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()),it(o)?(t=xe(o),k(t,e)):typeof o=="object"&&!!o.red&&!!o.blue&&!!o.green?P(o,e):typeof o=="object"&&!!o.hue&&!!o.saturation&&!!o.lightness?Y(o,e):o.startsWith("#")?k(o,e):(o=o.toString(),/^[\da-fA-F]+$/.test(o)?k("#"+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+Te:o}function at(o,{fg:e={},bg:t={},isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=P({...e})),t&&(t=P({...t},!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function lt(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 ct(o,{fg:e="",bg:t="",isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=k(e)),t&&(t=k(t,!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function ut(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:P,fromHexa:k,fromHsl:Y,fromColor:ae,getTextFromRgb:at,getTextFromHsl:lt,getTextFromHex:ct,getTextFromColor:ut,colorNameToHex:xe,hslToRgb:Oe,hexToRgb:Ee,rgbToHex:we,rgbToAnsi256:Le,rgbStringToRgb:Se,rgbStringToHex:st,hue2rgb:W,RESET:Te,FONT_STYLE:V,STYLE:ot};var Re={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"}},_=Re.COLOR_TABLE,j=Re.SYSTEM,le=2e3,ce="analogger-removed-notif",ue="analogger-header",fe="analogger-view",he="analogger-footer",Ae="to-esm-line",K={TOP:"TOP",BOTTOM:"BOTTOM"},Ce="ANALOGGER",Q={DEFAULT_FORMAT:"FORMAT1"};var{parse:At,stringify:ft}=JSON,{keys:Ct}=Object,ht=String,dt="string";var Me="object",gt=(o,e)=>e;var Ne=(o,e,t)=>{let n=ht(e.push(t)-1);return o.set(t,n),n};var Fe=(o,e,t)=>{let n=e&&typeof e===Me?(h,d)=>h===""||-1<e.indexOf(h)?d:void 0:e||gt,r=new Map,i=[],s=[],a=+Ne(r,i,n.call({"":o},"",o)),u=!a;for(;a<i.length;)u=!0,s[a]=ft(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 Me:if(g===null)return g;case dt:return r.get(g)||Ne(r,i,g)}return g}};var L={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"},y={FATAL:5e3,ERROR:4e3,WARN:3e3,INFO:2e3,LOG:1e3,DEBUG:500,ALL:200,OFF:0,INHERIT:-1},De={LOCAL:"local",GLOBAL:"global"},$={DEFAULT:{contextName:"DEFAULT",logLevel:y.LOG,symbol:"check"},LOG:{contextName:"LOG",logLevel:y.LOG,symbol:"check"},DEBUG:{contextName:"DEBUG",logLevel:y.DEBUG},INFO:{contextName:"INFO",logLevel:y.INFO,color:"#B18904",symbol:"diamonds"},WARN:{contextName:"WARN",logLevel:y.WARN,color:_[0],symbol:"cross"},ERROR:{contextName:"ERROR",logLevel:y.ERROR},CRITICAL:{contextName:"CRITICAL",logLevel:y.CRITICAL}},pt=`
|
|
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 mt(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 bt(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function yt(o,e,t,n,r,i,s){fs.readdir(o,(a,u)=>{if(a){s(a,null);return}let f=[],h=0,d=(p,v)=>{if(!fs.existsSync(p)){v(null,null);return}fs.unlink(p,S=>{S?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${S}`):f.push(p),h++,h===u.length&&v(null,f)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let v=path.join(o,p);r&&Lt(v,r,i),d(v,s)}else h++,h===u.length&&s(null,f)};u.length===0?s(null,f):u.forEach(g,i)})}function vt(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 Tt(){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 Lt(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
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
4
|
`)+a.slice(h).join(`
|
|
5
|
-
`);let v=parseInt(p.pop()),S=parseInt(p.pop()),F=p.pop(),D=p.pop().split(" "),q=null;for(let H=0;H<D.length;H++){let I=D[H];if(!!I&&I.indexOf("at")!==0){q=I;break}}r={file:F,line:S,col:v,method:q,isMinified:n,stack:i};break}return r}}}catch{}return null}function De(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 Ie(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?j.NODE:j.BROWSER}var Tt=Ie();function Et(){return Tt===j.NODE}var wt=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],G,O,C,M,w,ee,ke,te,Pe,l=class{constructor({name:e="default"}={}){R(this,ee);R(this,te);m(this,"system","");m(this,"instanceId","");m(this,"instanceName","");m(this,"logIndex",0);m(this,"logCounter",0);R(this,O,[]);R(this,C,{...E});R(this,M,{});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});m(this,"remoteBuffer",[]);m(this,"remoteTimer",null);R(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=Ie(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=e,this.instanceId=l.instanceCount+"-"+Date.now(),b(l,G)[l.instanceCount]=this,++l.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.remoteBuffer=[],this.remoteTimer=null,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,Pe).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={..._e.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=gt){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===j.NODE:Et()}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=8,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.enableMillisec=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.options.logToRemoteMaxSize=void 0,this.options.logToRemoteMinSize=void 0,this.remoteBuffer=[],this.remoteTimer=null}resetOptions(){this.resetLogger()}setOptions({timeLenMax:e=void 0,contextLenMax:t=10,idLenMax:n=5,lidLenMax:r=6,symbolLenMax:i=2,enableTrace:s=!0,messageLenMax:a=void 0,hideLog:u=void 0,hideError:f=void 0,hideHookMessage:h=void 0,hidePassingTests:d=void 0,logToDom:g=void 0,logToFile:p=void 0,logMaxSize:v=0,logMaxArchives:S=3,logIndexArchive:F=0,addArchiveTimestamp:z=!0,addArchiveIndex:D=!0,compressArchives:q=!1,compressionLevel:H=1,logToRemote:I=void 0,logToRemoteUrl:ge=void 0,logToRemoteBinaryUrl:pe=void 0,loopback:He=T.loopback,requiredLogLevel:Ue=y.LOG,oneConsolePerContext:Be=void 0,silent:me=void 0,enableDate:je=void 0,enableMillisec:be=void 0,logToLocalStorage:$e=void 0,logToLocalStorageMax:Ge=50,logToLocalStorageSize:ze=1e4,logToRemoteMaxEntries:qe=void 0,logToRemoteDebounce:Ve=void 0,logToRemoteMaxSize:We=void 0,logToRemoteMinSize:Ye=void 0,protocol:Je=void 0,host:Xe=void 0,port:Ke=void 0,pathname:Qe=void 0,binarypathname:Ze=void 0,loadHtmlToImage:et=!1}=null){if(this.options.contextLenMax=t,this.options.idLenMax=n,this.options.lidLenMax=r,this.options.messageLenMax=a,this.options.symbolLenMax=i,this.options.enableMillisec=be,this.options.timeLenMax=e,this.options.logMaxSize=v,this.options.logMaxArchives=S,this.options.logIndexArchive=F,this.options.addArchiveTimestamp=z,this.options.addArchiveIndex=D,this.options.compressArchives=q,this.options.compressionLevel=H,this.options.requiredLogLevel=Ue,this.options.enableTrace=s,this.options.enableMillisec=be,this.options.enableMillisec&&(this.options.timeLenMax+=4),this.options.logToLocalStorageMax=Ge,this.options.logToLocalStorageSize=ze,this.options.logToRemote=I,this.options.logToRemoteUrl=ge,this.options.logToRemoteBinaryUrl=pe,this.options.logToRemoteMaxEntries=qe,this.options.logToRemoteDebounce=Ve,this.options.logToRemoteMaxSize=We,this.options.logToRemoteMinSize=Ye,et){let N=vt();yt(N)}let ne;me!==void 0?ne=!!me:u!==void 0&&(ne=!!u),[{hideLog:ne},{oneConsolePerContext:Be},{hideError:f},{enableDate:je},{hideHookMessage:h},{hidePassingTests:d},{logToRemote:I},{logToLocalStorage:$e}].forEach(N=>{let U=Object.keys(N)[0],B=N[U];B!==void 0&&(this.options[U]=!!B)}),[{logToRemoteBinaryUrl:pe},{logToRemoteUrl:ge},{loopback:He},{protocol:Je},{host:Xe},{port:Ke},{pathname:Qe},{binarypathname:Ze}].forEach(N=>{let U=Object.keys(N)[0],B=N[U];B!==void 0&&(this.options[U]=B)}),this.options.enableDate&&this.options.timeLenMax===void 0&&(this.options.timeLenMax=17),this.options.timeLenMax===void 0&&(this.options.enableDate?this.options.timeLenMax=17:this.options.timeLenMax=8),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})),g===!1?this.options.logToDom=!1:g!==void 0&&(this.options.logToDom=g===!0?T.consoleDomId:g),p===!1?this.options.logToFile=!1:p!==void 0&&(this.isBrowser()||(this.options.logToFile=p||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(e={}){try{let{contextName:t,message:n="",lid:r="",symbol:i=""}=e,s="",a=n.split(/\n/g);for(let u=0;u<a.length;++u){let f=a[u],h=new Date,d=("0"+h.getHours()).slice(-2)+":"+("0"+h.getMinutes()).slice(-2)+":"+("0"+h.getSeconds()).slice(-2);(e.hasOwnProperty("enableMillisec")?e.enableMillisec:this.options.enableMillisec)&&(d+=","+("00"+h.getMilliseconds()).slice(-3)),(e.hasOwnProperty("enableDate")?e.enableDate:this.options.enableDate)&&(d=h.getFullYear().toString().slice(-2)+"-"+(h.getMonth()+1).toString().padStart(2,"0")+"-"+h.getDate().toString().padStart(2,"0")+" "+d);let v=e.hasOwnProperty("timeLenMax")?e.timeLenMax:this.options.timeLenMax;d=this.truncateMessage(d,{fit:v}),u>0&&(t="",r=""),t=this.truncateMessage(t,{fit:this.options.contextLenMax,align:l.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),(e.hasOwnProperty("messageLenMax")?e.messageLenMax:this.options.messageLenMax)!==void 0&&(f=this.truncateMessage(f,{fit:this.options.messageLenMax})),i=this.truncateMessage(i,{fit:this.options.symbolLenMax}),u<=0?s+=`[${d}] ${t}: (${r}) ${i} ${f}`:u<a.length-1?(s+=`
|
|
5
|
+
`);let v=parseInt(p.pop()),S=parseInt(p.pop()),F=p.pop(),D=p.pop().split(" "),q=null;for(let H=0;H<D.length;H++){let I=D[H];if(!!I&&I.indexOf("at")!==0){q=I;break}}r={file:F,line:S,col:v,method:q,isMinified:n,stack:i};break}return r}}}catch{}return null}function Ie(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 ke(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?j.NODE:j.BROWSER}var Et=ke();function wt(){return Et===j.NODE}var St=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],G,O,C,N,w,ee,Pe,te,_e,l=class{constructor({name:e="default"}={}){R(this,ee);R(this,te);m(this,"system","");m(this,"instanceId","");m(this,"instanceName","");m(this,"logIndex",0);m(this,"logCounter",0);R(this,O,[]);R(this,C,{...E});R(this,N,{});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});m(this,"remoteBuffer",[]);m(this,"remoteTimer",null);R(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=ke(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=e,this.instanceId=l.instanceCount+"-"+Date.now(),b(l,G)[l.instanceCount]=this,++l.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.remoteBuffer=[],this.remoteTimer=null,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,_e).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={...He.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=pt){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===j.NODE:wt()}isBrowser(){return!this.isNode()}getUid(){if(!this.isBrowser()||typeof window>"u"||!window.localStorage)return null;let e="analogger-uid",t=window.localStorage.getItem(e);return t||(t="uid-"+Date.now()+"-"+Math.floor(Math.random()*1e6),window.localStorage.setItem(e,t)),t}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.enableMillisec=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.options.logToRemoteMaxSize=void 0,this.options.logToRemoteMinSize=void 0,this.options.logUidToRemote=void 0,this.remoteBuffer=[],this.remoteTimer=null,this.remoteWaitCount=0}resetOptions(){this.resetLogger()}setOptions({timeLenMax:e=void 0,contextLenMax:t=10,idLenMax:n=5,lidLenMax:r=6,symbolLenMax:i=2,enableTrace:s=!0,messageLenMax:a=void 0,hideLog:u=void 0,hideError:f=void 0,hideHookMessage:h=void 0,hidePassingTests:d=void 0,logToDom:g=void 0,logToFile:p=void 0,logMaxSize:v=0,logMaxArchives:S=3,logIndexArchive:F=0,addArchiveTimestamp:z=!0,addArchiveIndex:D=!0,compressArchives:q=!1,compressionLevel:H=1,logToRemote:I=void 0,logToRemoteUrl:ge=void 0,logToRemoteBinaryUrl:pe=void 0,loopback:Ue=L.loopback,requiredLogLevel:Be=y.LOG,oneConsolePerContext:je=void 0,silent:me=void 0,enableDate:$e=void 0,enableMillisec:be=void 0,logToLocalStorage:Ge=void 0,logToLocalStorageMax:ze=50,logToLocalStorageSize:qe=1e4,logToRemoteMaxEntries:Ve=void 0,logToRemoteDebounce:We=void 0,logToRemoteMaxSize:Ye=void 0,logToRemoteMinSize:Je=void 0,logUidToRemote:ye=void 0,protocol:Xe=void 0,host:Ke=void 0,port:Qe=void 0,pathname:Ze=void 0,binarypathname:et=void 0,loadHtmlToImage:tt=!1}=null){if(this.options.contextLenMax=t,this.options.idLenMax=n,this.options.lidLenMax=r,this.options.messageLenMax=a,this.options.symbolLenMax=i,this.options.enableMillisec=be,this.options.timeLenMax=e,this.options.logMaxSize=v,this.options.logMaxArchives=S,this.options.logIndexArchive=F,this.options.addArchiveTimestamp=z,this.options.addArchiveIndex=D,this.options.compressArchives=q,this.options.compressionLevel=H,this.options.requiredLogLevel=Be,this.options.enableTrace=s,this.options.enableMillisec=be,this.options.enableMillisec&&(this.options.timeLenMax+=4),this.options.logToLocalStorageMax=ze,this.options.logToLocalStorageSize=qe,this.options.logToRemote=I,this.options.logToRemoteUrl=ge,this.options.logToRemoteBinaryUrl=pe,this.options.logToRemoteMaxEntries=Ve,this.options.logToRemoteDebounce=We,this.options.logToRemoteMaxSize=Ye,this.options.logToRemoteMinSize=Je,this.options.logUidToRemote=ye,tt){let M=Tt();vt(M)}let ne;me!==void 0?ne=!!me:u!==void 0&&(ne=!!u),[{hideLog:ne},{oneConsolePerContext:je},{hideError:f},{enableDate:$e},{hideHookMessage:h},{hidePassingTests:d},{logToRemote:I},{logToLocalStorage:Ge},{logUidToRemote:ye}].forEach(M=>{let U=Object.keys(M)[0],B=M[U];B!==void 0&&(this.options[U]=!!B)}),[{logToRemoteBinaryUrl:pe},{logToRemoteUrl:ge},{loopback:Ue},{protocol:Xe},{host:Ke},{port:Qe},{pathname:Ze},{binarypathname:et}].forEach(M=>{let U=Object.keys(M)[0],B=M[U];B!==void 0&&(this.options[U]=B)}),this.options.enableDate&&this.options.timeLenMax===void 0&&(this.options.timeLenMax=17),this.options.timeLenMax===void 0&&(this.options.enableDate?this.options.timeLenMax=17:this.options.timeLenMax=8),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||L.binarypathname})),g===!1?this.options.logToDom=!1:g!==void 0&&(this.options.logToDom=g===!0?L.consoleDomId:g),p===!1?this.options.logToFile=!1:p!==void 0&&(this.isBrowser()||(this.options.logToFile=p||L.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(e={}){try{let{contextName:t,message:n="",lid:r="",symbol:i=""}=e,s="",a=n.split(/\n/g);for(let u=0;u<a.length;++u){let f=a[u],h=new Date,d=("0"+h.getHours()).slice(-2)+":"+("0"+h.getMinutes()).slice(-2)+":"+("0"+h.getSeconds()).slice(-2);(e.hasOwnProperty("enableMillisec")?e.enableMillisec:this.options.enableMillisec)&&(d+=","+("00"+h.getMilliseconds()).slice(-3)),(e.hasOwnProperty("enableDate")?e.enableDate:this.options.enableDate)&&(d=h.getFullYear().toString().slice(-2)+"-"+(h.getMonth()+1).toString().padStart(2,"0")+"-"+h.getDate().toString().padStart(2,"0")+" "+d);let v=e.hasOwnProperty("timeLenMax")?e.timeLenMax:this.options.timeLenMax;d=this.truncateMessage(d,{fit:v}),u>0&&(t="",r=""),t=this.truncateMessage(t,{fit:this.options.contextLenMax,align:l.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),(e.hasOwnProperty("messageLenMax")?e.messageLenMax:this.options.messageLenMax)!==void 0&&(f=this.truncateMessage(f,{fit:this.options.messageLenMax})),i=this.truncateMessage(i,{fit:this.options.symbolLenMax}),u<=0?s+=`[${d}] ${t}: (${r}) ${i} ${f}`:u<a.length-1?(s+=`
|
|
6
6
|
`,s+=`[${d}] ${t} ${r} ${f}`):f&&(s+=`
|
|
7
7
|
`,s+=`[${d}] ${t} ${r} ${f}`)}return s}catch(t){l.Console.error(`ANALOGGER_FAILURE_1001: ${t.message}`)}return""}onErrorForUserTarget(e,...t){this.errorUserTargetHandler(e,...t)}onError(e,...t){e.target===b(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($.DEFAULT.contextName,e)}generateDefaultContext(){let e=b(this,O)[$.DEFAULT.contextName]||{};return e=Object.assign({},{lid:"",contextName:$.DEFAULT.contextName,target:E.ALL,symbol:"\u26A1",color:_[1],logLevel:y.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=_[this.indexColor++%(_.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=$.ERROR.contextName,e.name=e.contextName,e.color=_[0],e.symbol="\u274C",e.error=!0,e.logLevel=y.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=ie(this,ee,ke).call(this,t),b(this,O)[e]=t}getContext(e){return b(this,O)[e]}setContexts(e){Object.keys(e).forEach(n=>{let r=e[n]||{};this.setContext(n,r),e[n]=b(this,O)[n]})}getContexts(){return Object.freeze(b(this,O))}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=b(this,C),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(b(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(b(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){b(this,M)[e]=t}getLogLevel(e){return b(this,M)[e]}setLogLevels(e){oe(this,M,e)}getLogLevels(){return Object.freeze(b(this,M))}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=Ae,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(Re),e.className&&d.classList.add(e.className),d.style.color=e.color,this.setColumns(d,e,t,i),setTimeout(function(g,p,{addType:v,context:S,message:F,text:z,args:D}){this.addLineToDom(g,p,{addType:v,context:S,message:F,text:z,args:D})}.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}=pt(this.options.logToFilePath),f,h;f=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(r,"0"):"",h=this.options.addArchiveTimestamp?"."+mt():"";let d=`${i}${h}${f}${s}`,g=this.options.compressArchives?`${i}.tar.gz`:"";bt(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.options.logToRemoteMaxSize===void 0){this.performRemotePost([...e]);return}if(Array.isArray(this.remoteBuffer)){if(this.remoteBuffer.push([...e]),this.options.logToRemoteMaxEntries!==void 0&&this.remoteBuffer.length>=this.options.logToRemoteMaxEntries){this.flushRemoteLogs();return}if(this.options.logToRemoteMaxSize!==void 0&&JSON.stringify(this.remoteBuffer).length>=this.options.logToRemoteMaxSize){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.remoteBuffer.length===0)return;if(this.options.logToRemoteMinSize!==void 0&&JSON.stringify(this.remoteBuffer).length<this.options.logToRemoteMinSize){this.options.logToRemoteDebounce!==void 0&&!this.remoteTimer&&(this.remoteTimer=setTimeout(()=>{this.flushRemoteLogs()},this.options.logToRemoteDebounce));return}this.remoteTimer&&(clearTimeout(this.remoteTimer),this.remoteTimer=null);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=Me(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||y.LOG;r>=y.ERROR?l.Console.error(...n):r>=y.WARN?l.Console.warn(...n):r>=y.INFO?l.Console.info(...n):r>=y.LOG?l.Console.log(...n):r>=y.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===y.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=b(this,O)[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:De(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:De(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"),b(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,wt.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]&&(b(this,w)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),r&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=l.Console.error,b(this,w).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){e&&(console.log=l.Console.log,b(this,w).log=!1),t&&(console.info=l.Console.info,b(this,w).info=!1),n&&(console.warn=l.Console.warn,b(this,w).warn=!1),r&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!b(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?b(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:Fe.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){l[e]=t,l.pluginTable[n]={type:Fe.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)}},L=l;G=new WeakMap,O=new WeakMap,C=new WeakMap,M=new WeakMap,w=new WeakMap,ee=new WeakSet,ke=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,Pe=function(){try{this.setTargets(E),this.setLogLevels(y),this.setContexts($)}catch(e){console.error({lid:4321},e.message)}return!1},R(L,G,[]),m(L,"Console",null),m(L,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m(L,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),m(L,"instanceCount",0),m(L,"pluginTable",{}),m(L,"lidTable",{}),m(L,"lidTableOn",!1);var _e=L,It=_e,kt=L.generateMainInstance();var Pt=L;export{Pt as AnaLogger,$ as DEFAULT_LOG_CONTEXTS,y as DEFAULT_LOG_LEVELS,E as DEFAULT_LOG_TARGETS,kt as anaLogger,It as default};
|
|
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($.DEFAULT.contextName,e)}generateDefaultContext(){let e=b(this,O)[$.DEFAULT.contextName]||{};return e=Object.assign({},{lid:"",contextName:$.DEFAULT.contextName,target:E.ALL,symbol:"\u26A1",color:_[1],logLevel:y.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=_[this.indexColor++%(_.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=$.ERROR.contextName,e.name=e.contextName,e.color=_[0],e.symbol="\u274C",e.error=!0,e.logLevel=y.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=ie(this,ee,Pe).call(this,t),b(this,O)[e]=t}getContext(e){return b(this,O)[e]}setContexts(e){Object.keys(e).forEach(n=>{let r=e[n]||{};this.setContext(n,r),e[n]=b(this,O)[n]})}getContexts(){return Object.freeze(b(this,O))}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=b(this,C),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(b(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(b(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){b(this,N)[e]=t}getLogLevel(e){return b(this,N)[e]}setLogLevels(e){oe(this,N,e)}getLogLevels(){return Object.freeze(b(this,N))}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=Ce,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(Ae),e.className&&d.classList.add(e.className),d.style.color=e.color,this.setColumns(d,e,t,i),setTimeout(function(g,p,{addType:v,context:S,message:F,text:z,args:D}){this.addLineToDom(g,p,{addType:v,context:S,message:F,text:z,args:D})}.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}=mt(this.options.logToFilePath),f,h;f=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(r,"0"):"",h=this.options.addArchiveTimestamp?"."+bt():"";let d=`${i}${h}${f}${s}`,g=this.options.compressArchives?`${i}.tar.gz`:"";yt(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.options.logToRemoteMaxSize===void 0){this.performRemotePost([...e]);return}if(Array.isArray(this.remoteBuffer)){if(this.remoteBuffer.push([...e]),this.options.logToRemoteMaxEntries!==void 0&&this.remoteBuffer.length>=this.options.logToRemoteMaxEntries){this.flushRemoteLogs(!0);return}if(this.options.logToRemoteMaxSize!==void 0&&JSON.stringify(this.remoteBuffer).length>=this.options.logToRemoteMaxSize){this.flushRemoteLogs(!0);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(e=!1){if(this.remoteBuffer.length===0)return;if(!e&&this.options.logToRemoteMinSize!==void 0&&JSON.stringify(this.remoteBuffer).length<this.options.logToRemoteMinSize&&(this.remoteWaitCount=(this.remoteWaitCount||0)+1,this.remoteWaitCount<2)){this.options.logToRemoteDebounce!==void 0&&(this.remoteTimer&&clearTimeout(this.remoteTimer),this.remoteTimer=setTimeout(()=>{this.flushRemoteLogs()},this.options.logToRemoteDebounce));return}this.remoteTimer&&(clearTimeout(this.remoteTimer),this.remoteTimer=null),this.remoteWaitCount=0;let t=[...this.remoteBuffer];this.remoteBuffer=[],this.performRemotePost(t)}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:L.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=Fe(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||y.LOG;r>=y.ERROR?l.Console.error(...n):r>=y.WARN?l.Console.warn(...n):r>=y.INFO?l.Console.info(...n):r>=y.LOG?l.Console.log(...n):r>=y.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===y.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),this.options.logUidToRemote&&(e.uid=this.getUid());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=b(this,O)[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:Ie(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:Ie(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"),b(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,St.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]&&(b(this,w)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),r&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=l.Console.error,b(this,w).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){e&&(console.log=l.Console.log,b(this,w).log=!1),t&&(console.info=l.Console.info,b(this,w).info=!1),n&&(console.warn=l.Console.warn,b(this,w).warn=!1),r&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!b(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?b(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=L.protocol,host:t=L.host,port:n=L.port,pathname:r=L.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=L.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||L.host,i=this.options.port||L.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:De.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){l[e]=t,l.pluginTable[n]={type:De.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)}},T=l;G=new WeakMap,O=new WeakMap,C=new WeakMap,N=new WeakMap,w=new WeakMap,ee=new WeakSet,Pe=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,_e=function(){try{this.setTargets(E),this.setLogLevels(y),this.setContexts($)}catch(e){console.error({lid:4321},e.message)}return!1},R(T,G,[]),m(T,"Console",null),m(T,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m(T,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),m(T,"instanceCount",0),m(T,"pluginTable",{}),m(T,"lidTable",{}),m(T,"lidTableOn",!1);var He=T,kt=He,Pt=T.generateMainInstance();var _t=T;export{_t as AnaLogger,$ as DEFAULT_LOG_CONTEXTS,y as DEFAULT_LOG_LEVELS,E as DEFAULT_LOG_TARGETS,Pt as anaLogger,kt as default};
|
|
9
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
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 pt(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 mt(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function bt(o,e,t,n,r,i,s){fs.readdir(o,(a,u)=>{if(a){s(a,null);return}let f=[],h=0,d=(p,v)=>{if(!fs.existsSync(p)){v(null,null);return}fs.unlink(p,S=>{S?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${S}`):f.push(p),h++,h===u.length&&v(null,f)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let v=path.join(o,p);r&&Lt(v,r,i),d(v,s)}else h++,h===u.length&&s(null,f)};u.length===0?s(null,f):u.forEach(g,i)})}function yt(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 vt(){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 Lt(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(`
|
|
1
|
+
var nt=Object.defineProperty;var rt=(o,e,t)=>e in o?nt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var m=(o,e,t)=>(rt(o,typeof e!="symbol"?e+"":e,t),t),re=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var b=(o,e,t)=>(re(o,e,"read from private field"),t?t.call(o):e.get(o)),R=(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 ve={Foreground:38,Background:48},A="\x1B[1D",Te="\x1B[0m"+A,V={Bold:"\x1B[1m"+A,Underline:"\x1B[4m"+A,Reversed:"\x1B[7m"+A},ot={Bold:"\x1B[1m"+A,Underline:"\x1B[4m"+A,Reversed:"\x1B[7m"+A},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 it(o){return!!se[o]}var Le=(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),Ee=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)}:{}},we=function({red:o,green:e,blue:t}){let n=o<<16|e<<8|t<<0;return"#"+(16777216+n).toString(16).slice(1)},Se=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]}},st=function(o){let e=Se(o);return e&&we(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},Oe=({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)}},xe=o=>{let e=o.toLowerCase();return typeof se[e]<"u"?se[e]:""};function P({red:o,blue:e,green:t},n=!0){if(o===void 0||e===void 0||t===void 0)return"";let r=Le(o,e,t);return`\x1B[${n?ve.Foreground:ve.Background};5;`+r+"m "+A}function k(o,e=!0){let{red:t,green:n,blue:r}=Ee(o);return P({red:t,green:n,blue:r},e)}function Y({hue:o,saturation:e,lightness:t},n){let{red:r,green:i,blue:s}=Oe({hue:o,saturation:e,lightness:t});return P({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()),it(o)?(t=xe(o),k(t,e)):typeof o=="object"&&!!o.red&&!!o.blue&&!!o.green?P(o,e):typeof o=="object"&&!!o.hue&&!!o.saturation&&!!o.lightness?Y(o,e):o.startsWith("#")?k(o,e):(o=o.toString(),/^[\da-fA-F]+$/.test(o)?k("#"+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+Te:o}function at(o,{fg:e={},bg:t={},isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=P({...e})),t&&(t=P({...t},!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function lt(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 ct(o,{fg:e="",bg:t="",isUnderline:n=!1,isBold:r=!1,isReversed:i=!1}){return e&&(e=k(e)),t&&(t=k(t,!1)),J(o,{fg:e,bg:t,isUnderline:n,isBold:r,isReversed:i})}function ut(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:P,fromHexa:k,fromHsl:Y,fromColor:ae,getTextFromRgb:at,getTextFromHsl:lt,getTextFromHex:ct,getTextFromColor:ut,colorNameToHex:xe,hslToRgb:Oe,hexToRgb:Ee,rgbToHex:we,rgbToAnsi256:Le,rgbStringToRgb:Se,rgbStringToHex:st,hue2rgb:W,RESET:Te,FONT_STYLE:V,STYLE:ot};var Re={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"}},_=Re.COLOR_TABLE,j=Re.SYSTEM,le=2e3,ce="analogger-removed-notif",ue="analogger-header",fe="analogger-view",he="analogger-footer",Ae="to-esm-line",K={TOP:"TOP",BOTTOM:"BOTTOM"},Ce="ANALOGGER",Q={DEFAULT_FORMAT:"FORMAT1"};var{parse:At,stringify:ft}=JSON,{keys:Ct}=Object,ht=String,dt="string";var Me="object",gt=(o,e)=>e;var Ne=(o,e,t)=>{let n=ht(e.push(t)-1);return o.set(t,n),n};var Fe=(o,e,t)=>{let n=e&&typeof e===Me?(h,d)=>h===""||-1<e.indexOf(h)?d:void 0:e||gt,r=new Map,i=[],s=[],a=+Ne(r,i,n.call({"":o},"",o)),u=!a;for(;a<i.length;)u=!0,s[a]=ft(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 Me:if(g===null)return g;case dt:return r.get(g)||Ne(r,i,g)}return g}};var L={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"},y={FATAL:5e3,ERROR:4e3,WARN:3e3,INFO:2e3,LOG:1e3,DEBUG:500,ALL:200,OFF:0,INHERIT:-1},De={LOCAL:"local",GLOBAL:"global"},$={DEFAULT:{contextName:"DEFAULT",logLevel:y.LOG,symbol:"check"},LOG:{contextName:"LOG",logLevel:y.LOG,symbol:"check"},DEBUG:{contextName:"DEBUG",logLevel:y.DEBUG},INFO:{contextName:"INFO",logLevel:y.INFO,color:"#B18904",symbol:"diamonds"},WARN:{contextName:"WARN",logLevel:y.WARN,color:_[0],symbol:"cross"},ERROR:{contextName:"ERROR",logLevel:y.ERROR},CRITICAL:{contextName:"CRITICAL",logLevel:y.CRITICAL}},pt=`
|
|
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 mt(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 bt(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function yt(o,e,t,n,r,i,s){fs.readdir(o,(a,u)=>{if(a){s(a,null);return}let f=[],h=0,d=(p,v)=>{if(!fs.existsSync(p)){v(null,null);return}fs.unlink(p,S=>{S?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${S}`):f.push(p),h++,h===u.length&&v(null,f)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let v=path.join(o,p);r&&Lt(v,r,i),d(v,s)}else h++,h===u.length&&s(null,f)};u.length===0?s(null,f):u.forEach(g,i)})}function vt(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 Tt(){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 Lt(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
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
4
|
`)+a.slice(h).join(`
|
|
5
|
-
`);let v=parseInt(p.pop()),S=parseInt(p.pop()),F=p.pop(),D=p.pop().split(" "),q=null;for(let H=0;H<D.length;H++){let I=D[H];if(!!I&&I.indexOf("at")!==0){q=I;break}}r={file:F,line:S,col:v,method:q,isMinified:n,stack:i};break}return r}}}catch{}return null}function De(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 Ie(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?j.NODE:j.BROWSER}var Tt=Ie();function Et(){return Tt===j.NODE}var wt=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],G,O,C,M,w,ee,ke,te,Pe,l=class{constructor({name:e="default"}={}){R(this,ee);R(this,te);m(this,"system","");m(this,"instanceId","");m(this,"instanceName","");m(this,"logIndex",0);m(this,"logCounter",0);R(this,O,[]);R(this,C,{...E});R(this,M,{});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});m(this,"remoteBuffer",[]);m(this,"remoteTimer",null);R(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=Ie(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=e,this.instanceId=l.instanceCount+"-"+Date.now(),b(l,G)[l.instanceCount]=this,++l.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.remoteBuffer=[],this.remoteTimer=null,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,Pe).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={..._e.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=gt){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===j.NODE:Et()}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=8,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.enableMillisec=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.options.logToRemoteMaxSize=void 0,this.options.logToRemoteMinSize=void 0,this.remoteBuffer=[],this.remoteTimer=null}resetOptions(){this.resetLogger()}setOptions({timeLenMax:e=void 0,contextLenMax:t=10,idLenMax:n=5,lidLenMax:r=6,symbolLenMax:i=2,enableTrace:s=!0,messageLenMax:a=void 0,hideLog:u=void 0,hideError:f=void 0,hideHookMessage:h=void 0,hidePassingTests:d=void 0,logToDom:g=void 0,logToFile:p=void 0,logMaxSize:v=0,logMaxArchives:S=3,logIndexArchive:F=0,addArchiveTimestamp:z=!0,addArchiveIndex:D=!0,compressArchives:q=!1,compressionLevel:H=1,logToRemote:I=void 0,logToRemoteUrl:ge=void 0,logToRemoteBinaryUrl:pe=void 0,loopback:He=T.loopback,requiredLogLevel:Ue=y.LOG,oneConsolePerContext:Be=void 0,silent:me=void 0,enableDate:je=void 0,enableMillisec:be=void 0,logToLocalStorage:$e=void 0,logToLocalStorageMax:Ge=50,logToLocalStorageSize:ze=1e4,logToRemoteMaxEntries:qe=void 0,logToRemoteDebounce:Ve=void 0,logToRemoteMaxSize:We=void 0,logToRemoteMinSize:Ye=void 0,protocol:Je=void 0,host:Xe=void 0,port:Ke=void 0,pathname:Qe=void 0,binarypathname:Ze=void 0,loadHtmlToImage:et=!1}=null){if(this.options.contextLenMax=t,this.options.idLenMax=n,this.options.lidLenMax=r,this.options.messageLenMax=a,this.options.symbolLenMax=i,this.options.enableMillisec=be,this.options.timeLenMax=e,this.options.logMaxSize=v,this.options.logMaxArchives=S,this.options.logIndexArchive=F,this.options.addArchiveTimestamp=z,this.options.addArchiveIndex=D,this.options.compressArchives=q,this.options.compressionLevel=H,this.options.requiredLogLevel=Ue,this.options.enableTrace=s,this.options.enableMillisec=be,this.options.enableMillisec&&(this.options.timeLenMax+=4),this.options.logToLocalStorageMax=Ge,this.options.logToLocalStorageSize=ze,this.options.logToRemote=I,this.options.logToRemoteUrl=ge,this.options.logToRemoteBinaryUrl=pe,this.options.logToRemoteMaxEntries=qe,this.options.logToRemoteDebounce=Ve,this.options.logToRemoteMaxSize=We,this.options.logToRemoteMinSize=Ye,et){let N=vt();yt(N)}let ne;me!==void 0?ne=!!me:u!==void 0&&(ne=!!u),[{hideLog:ne},{oneConsolePerContext:Be},{hideError:f},{enableDate:je},{hideHookMessage:h},{hidePassingTests:d},{logToRemote:I},{logToLocalStorage:$e}].forEach(N=>{let U=Object.keys(N)[0],B=N[U];B!==void 0&&(this.options[U]=!!B)}),[{logToRemoteBinaryUrl:pe},{logToRemoteUrl:ge},{loopback:He},{protocol:Je},{host:Xe},{port:Ke},{pathname:Qe},{binarypathname:Ze}].forEach(N=>{let U=Object.keys(N)[0],B=N[U];B!==void 0&&(this.options[U]=B)}),this.options.enableDate&&this.options.timeLenMax===void 0&&(this.options.timeLenMax=17),this.options.timeLenMax===void 0&&(this.options.enableDate?this.options.timeLenMax=17:this.options.timeLenMax=8),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})),g===!1?this.options.logToDom=!1:g!==void 0&&(this.options.logToDom=g===!0?T.consoleDomId:g),p===!1?this.options.logToFile=!1:p!==void 0&&(this.isBrowser()||(this.options.logToFile=p||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(e={}){try{let{contextName:t,message:n="",lid:r="",symbol:i=""}=e,s="",a=n.split(/\n/g);for(let u=0;u<a.length;++u){let f=a[u],h=new Date,d=("0"+h.getHours()).slice(-2)+":"+("0"+h.getMinutes()).slice(-2)+":"+("0"+h.getSeconds()).slice(-2);(e.hasOwnProperty("enableMillisec")?e.enableMillisec:this.options.enableMillisec)&&(d+=","+("00"+h.getMilliseconds()).slice(-3)),(e.hasOwnProperty("enableDate")?e.enableDate:this.options.enableDate)&&(d=h.getFullYear().toString().slice(-2)+"-"+(h.getMonth()+1).toString().padStart(2,"0")+"-"+h.getDate().toString().padStart(2,"0")+" "+d);let v=e.hasOwnProperty("timeLenMax")?e.timeLenMax:this.options.timeLenMax;d=this.truncateMessage(d,{fit:v}),u>0&&(t="",r=""),t=this.truncateMessage(t,{fit:this.options.contextLenMax,align:l.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),(e.hasOwnProperty("messageLenMax")?e.messageLenMax:this.options.messageLenMax)!==void 0&&(f=this.truncateMessage(f,{fit:this.options.messageLenMax})),i=this.truncateMessage(i,{fit:this.options.symbolLenMax}),u<=0?s+=`[${d}] ${t}: (${r}) ${i} ${f}`:u<a.length-1?(s+=`
|
|
5
|
+
`);let v=parseInt(p.pop()),S=parseInt(p.pop()),F=p.pop(),D=p.pop().split(" "),q=null;for(let H=0;H<D.length;H++){let I=D[H];if(!!I&&I.indexOf("at")!==0){q=I;break}}r={file:F,line:S,col:v,method:q,isMinified:n,stack:i};break}return r}}}catch{}return null}function Ie(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 ke(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?j.NODE:j.BROWSER}var Et=ke();function wt(){return Et===j.NODE}var St=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],G,O,C,N,w,ee,Pe,te,_e,l=class{constructor({name:e="default"}={}){R(this,ee);R(this,te);m(this,"system","");m(this,"instanceId","");m(this,"instanceName","");m(this,"logIndex",0);m(this,"logCounter",0);R(this,O,[]);R(this,C,{...E});R(this,N,{});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});m(this,"remoteBuffer",[]);m(this,"remoteTimer",null);R(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=ke(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=e,this.instanceId=l.instanceCount+"-"+Date.now(),b(l,G)[l.instanceCount]=this,++l.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.remoteBuffer=[],this.remoteTimer=null,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,_e).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={...He.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=pt){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===j.NODE:wt()}isBrowser(){return!this.isNode()}getUid(){if(!this.isBrowser()||typeof window>"u"||!window.localStorage)return null;let e="analogger-uid",t=window.localStorage.getItem(e);return t||(t="uid-"+Date.now()+"-"+Math.floor(Math.random()*1e6),window.localStorage.setItem(e,t)),t}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.enableMillisec=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.options.logToRemoteMaxSize=void 0,this.options.logToRemoteMinSize=void 0,this.options.logUidToRemote=void 0,this.remoteBuffer=[],this.remoteTimer=null,this.remoteWaitCount=0}resetOptions(){this.resetLogger()}setOptions({timeLenMax:e=void 0,contextLenMax:t=10,idLenMax:n=5,lidLenMax:r=6,symbolLenMax:i=2,enableTrace:s=!0,messageLenMax:a=void 0,hideLog:u=void 0,hideError:f=void 0,hideHookMessage:h=void 0,hidePassingTests:d=void 0,logToDom:g=void 0,logToFile:p=void 0,logMaxSize:v=0,logMaxArchives:S=3,logIndexArchive:F=0,addArchiveTimestamp:z=!0,addArchiveIndex:D=!0,compressArchives:q=!1,compressionLevel:H=1,logToRemote:I=void 0,logToRemoteUrl:ge=void 0,logToRemoteBinaryUrl:pe=void 0,loopback:Ue=L.loopback,requiredLogLevel:Be=y.LOG,oneConsolePerContext:je=void 0,silent:me=void 0,enableDate:$e=void 0,enableMillisec:be=void 0,logToLocalStorage:Ge=void 0,logToLocalStorageMax:ze=50,logToLocalStorageSize:qe=1e4,logToRemoteMaxEntries:Ve=void 0,logToRemoteDebounce:We=void 0,logToRemoteMaxSize:Ye=void 0,logToRemoteMinSize:Je=void 0,logUidToRemote:ye=void 0,protocol:Xe=void 0,host:Ke=void 0,port:Qe=void 0,pathname:Ze=void 0,binarypathname:et=void 0,loadHtmlToImage:tt=!1}=null){if(this.options.contextLenMax=t,this.options.idLenMax=n,this.options.lidLenMax=r,this.options.messageLenMax=a,this.options.symbolLenMax=i,this.options.enableMillisec=be,this.options.timeLenMax=e,this.options.logMaxSize=v,this.options.logMaxArchives=S,this.options.logIndexArchive=F,this.options.addArchiveTimestamp=z,this.options.addArchiveIndex=D,this.options.compressArchives=q,this.options.compressionLevel=H,this.options.requiredLogLevel=Be,this.options.enableTrace=s,this.options.enableMillisec=be,this.options.enableMillisec&&(this.options.timeLenMax+=4),this.options.logToLocalStorageMax=ze,this.options.logToLocalStorageSize=qe,this.options.logToRemote=I,this.options.logToRemoteUrl=ge,this.options.logToRemoteBinaryUrl=pe,this.options.logToRemoteMaxEntries=Ve,this.options.logToRemoteDebounce=We,this.options.logToRemoteMaxSize=Ye,this.options.logToRemoteMinSize=Je,this.options.logUidToRemote=ye,tt){let M=Tt();vt(M)}let ne;me!==void 0?ne=!!me:u!==void 0&&(ne=!!u),[{hideLog:ne},{oneConsolePerContext:je},{hideError:f},{enableDate:$e},{hideHookMessage:h},{hidePassingTests:d},{logToRemote:I},{logToLocalStorage:Ge},{logUidToRemote:ye}].forEach(M=>{let U=Object.keys(M)[0],B=M[U];B!==void 0&&(this.options[U]=!!B)}),[{logToRemoteBinaryUrl:pe},{logToRemoteUrl:ge},{loopback:Ue},{protocol:Xe},{host:Ke},{port:Qe},{pathname:Ze},{binarypathname:et}].forEach(M=>{let U=Object.keys(M)[0],B=M[U];B!==void 0&&(this.options[U]=B)}),this.options.enableDate&&this.options.timeLenMax===void 0&&(this.options.timeLenMax=17),this.options.timeLenMax===void 0&&(this.options.enableDate?this.options.timeLenMax=17:this.options.timeLenMax=8),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||L.binarypathname})),g===!1?this.options.logToDom=!1:g!==void 0&&(this.options.logToDom=g===!0?L.consoleDomId:g),p===!1?this.options.logToFile=!1:p!==void 0&&(this.isBrowser()||(this.options.logToFile=p||L.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(e={}){try{let{contextName:t,message:n="",lid:r="",symbol:i=""}=e,s="",a=n.split(/\n/g);for(let u=0;u<a.length;++u){let f=a[u],h=new Date,d=("0"+h.getHours()).slice(-2)+":"+("0"+h.getMinutes()).slice(-2)+":"+("0"+h.getSeconds()).slice(-2);(e.hasOwnProperty("enableMillisec")?e.enableMillisec:this.options.enableMillisec)&&(d+=","+("00"+h.getMilliseconds()).slice(-3)),(e.hasOwnProperty("enableDate")?e.enableDate:this.options.enableDate)&&(d=h.getFullYear().toString().slice(-2)+"-"+(h.getMonth()+1).toString().padStart(2,"0")+"-"+h.getDate().toString().padStart(2,"0")+" "+d);let v=e.hasOwnProperty("timeLenMax")?e.timeLenMax:this.options.timeLenMax;d=this.truncateMessage(d,{fit:v}),u>0&&(t="",r=""),t=this.truncateMessage(t,{fit:this.options.contextLenMax,align:l.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),(e.hasOwnProperty("messageLenMax")?e.messageLenMax:this.options.messageLenMax)!==void 0&&(f=this.truncateMessage(f,{fit:this.options.messageLenMax})),i=this.truncateMessage(i,{fit:this.options.symbolLenMax}),u<=0?s+=`[${d}] ${t}: (${r}) ${i} ${f}`:u<a.length-1?(s+=`
|
|
6
6
|
`,s+=`[${d}] ${t} ${r} ${f}`):f&&(s+=`
|
|
7
7
|
`,s+=`[${d}] ${t} ${r} ${f}`)}return s}catch(t){l.Console.error(`ANALOGGER_FAILURE_1001: ${t.message}`)}return""}onErrorForUserTarget(e,...t){this.errorUserTargetHandler(e,...t)}onError(e,...t){e.target===b(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($.DEFAULT.contextName,e)}generateDefaultContext(){let e=b(this,O)[$.DEFAULT.contextName]||{};return e=Object.assign({},{lid:"",contextName:$.DEFAULT.contextName,target:E.ALL,symbol:"\u26A1",color:_[1],logLevel:y.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=_[this.indexColor++%(_.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=$.ERROR.contextName,e.name=e.contextName,e.color=_[0],e.symbol="\u274C",e.error=!0,e.logLevel=y.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=ie(this,ee,ke).call(this,t),b(this,O)[e]=t}getContext(e){return b(this,O)[e]}setContexts(e){Object.keys(e).forEach(n=>{let r=e[n]||{};this.setContext(n,r),e[n]=b(this,O)[n]})}getContexts(){return Object.freeze(b(this,O))}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=b(this,C),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(b(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(b(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){b(this,M)[e]=t}getLogLevel(e){return b(this,M)[e]}setLogLevels(e){oe(this,M,e)}getLogLevels(){return Object.freeze(b(this,M))}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=Ae,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(Re),e.className&&d.classList.add(e.className),d.style.color=e.color,this.setColumns(d,e,t,i),setTimeout(function(g,p,{addType:v,context:S,message:F,text:z,args:D}){this.addLineToDom(g,p,{addType:v,context:S,message:F,text:z,args:D})}.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}=pt(this.options.logToFilePath),f,h;f=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(r,"0"):"",h=this.options.addArchiveTimestamp?"."+mt():"";let d=`${i}${h}${f}${s}`,g=this.options.compressArchives?`${i}.tar.gz`:"";bt(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.options.logToRemoteMaxSize===void 0){this.performRemotePost([...e]);return}if(Array.isArray(this.remoteBuffer)){if(this.remoteBuffer.push([...e]),this.options.logToRemoteMaxEntries!==void 0&&this.remoteBuffer.length>=this.options.logToRemoteMaxEntries){this.flushRemoteLogs();return}if(this.options.logToRemoteMaxSize!==void 0&&JSON.stringify(this.remoteBuffer).length>=this.options.logToRemoteMaxSize){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.remoteBuffer.length===0)return;if(this.options.logToRemoteMinSize!==void 0&&JSON.stringify(this.remoteBuffer).length<this.options.logToRemoteMinSize){this.options.logToRemoteDebounce!==void 0&&!this.remoteTimer&&(this.remoteTimer=setTimeout(()=>{this.flushRemoteLogs()},this.options.logToRemoteDebounce));return}this.remoteTimer&&(clearTimeout(this.remoteTimer),this.remoteTimer=null);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=Me(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||y.LOG;r>=y.ERROR?l.Console.error(...n):r>=y.WARN?l.Console.warn(...n):r>=y.INFO?l.Console.info(...n):r>=y.LOG?l.Console.log(...n):r>=y.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===y.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=b(this,O)[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:De(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:De(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"),b(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,wt.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]&&(b(this,w)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),r&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=l.Console.error,b(this,w).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){e&&(console.log=l.Console.log,b(this,w).log=!1),t&&(console.info=l.Console.info,b(this,w).info=!1),n&&(console.warn=l.Console.warn,b(this,w).warn=!1),r&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!b(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?b(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:Fe.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){l[e]=t,l.pluginTable[n]={type:Fe.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)}},L=l;G=new WeakMap,O=new WeakMap,C=new WeakMap,M=new WeakMap,w=new WeakMap,ee=new WeakSet,ke=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,Pe=function(){try{this.setTargets(E),this.setLogLevels(y),this.setContexts($)}catch(e){console.error({lid:4321},e.message)}return!1},R(L,G,[]),m(L,"Console",null),m(L,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m(L,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),m(L,"instanceCount",0),m(L,"pluginTable",{}),m(L,"lidTable",{}),m(L,"lidTableOn",!1);var _e=L,It=_e,kt=L.generateMainInstance();var Pt=L;export{Pt as AnaLogger,$ as DEFAULT_LOG_CONTEXTS,y as DEFAULT_LOG_LEVELS,E as DEFAULT_LOG_TARGETS,kt as anaLogger,It as default};
|
|
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($.DEFAULT.contextName,e)}generateDefaultContext(){let e=b(this,O)[$.DEFAULT.contextName]||{};return e=Object.assign({},{lid:"",contextName:$.DEFAULT.contextName,target:E.ALL,symbol:"\u26A1",color:_[1],logLevel:y.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=_[this.indexColor++%(_.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=$.ERROR.contextName,e.name=e.contextName,e.color=_[0],e.symbol="\u274C",e.error=!0,e.logLevel=y.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=ie(this,ee,Pe).call(this,t),b(this,O)[e]=t}getContext(e){return b(this,O)[e]}setContexts(e){Object.keys(e).forEach(n=>{let r=e[n]||{};this.setContext(n,r),e[n]=b(this,O)[n]})}getContexts(){return Object.freeze(b(this,O))}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=b(this,C),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(b(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(b(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){b(this,N)[e]=t}getLogLevel(e){return b(this,N)[e]}setLogLevels(e){oe(this,N,e)}getLogLevels(){return Object.freeze(b(this,N))}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=Ce,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(Ae),e.className&&d.classList.add(e.className),d.style.color=e.color,this.setColumns(d,e,t,i),setTimeout(function(g,p,{addType:v,context:S,message:F,text:z,args:D}){this.addLineToDom(g,p,{addType:v,context:S,message:F,text:z,args:D})}.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}=mt(this.options.logToFilePath),f,h;f=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(r,"0"):"",h=this.options.addArchiveTimestamp?"."+bt():"";let d=`${i}${h}${f}${s}`,g=this.options.compressArchives?`${i}.tar.gz`:"";yt(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.options.logToRemoteMaxSize===void 0){this.performRemotePost([...e]);return}if(Array.isArray(this.remoteBuffer)){if(this.remoteBuffer.push([...e]),this.options.logToRemoteMaxEntries!==void 0&&this.remoteBuffer.length>=this.options.logToRemoteMaxEntries){this.flushRemoteLogs(!0);return}if(this.options.logToRemoteMaxSize!==void 0&&JSON.stringify(this.remoteBuffer).length>=this.options.logToRemoteMaxSize){this.flushRemoteLogs(!0);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(e=!1){if(this.remoteBuffer.length===0)return;if(!e&&this.options.logToRemoteMinSize!==void 0&&JSON.stringify(this.remoteBuffer).length<this.options.logToRemoteMinSize&&(this.remoteWaitCount=(this.remoteWaitCount||0)+1,this.remoteWaitCount<2)){this.options.logToRemoteDebounce!==void 0&&(this.remoteTimer&&clearTimeout(this.remoteTimer),this.remoteTimer=setTimeout(()=>{this.flushRemoteLogs()},this.options.logToRemoteDebounce));return}this.remoteTimer&&(clearTimeout(this.remoteTimer),this.remoteTimer=null),this.remoteWaitCount=0;let t=[...this.remoteBuffer];this.remoteBuffer=[],this.performRemotePost(t)}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:L.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=Fe(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||y.LOG;r>=y.ERROR?l.Console.error(...n):r>=y.WARN?l.Console.warn(...n):r>=y.INFO?l.Console.info(...n):r>=y.LOG?l.Console.log(...n):r>=y.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===y.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),this.options.logUidToRemote&&(e.uid=this.getUid());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=b(this,O)[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:Ie(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:Ie(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"),b(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,St.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]&&(b(this,w)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),r&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=l.Console.error,b(this,w).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){e&&(console.log=l.Console.log,b(this,w).log=!1),t&&(console.info=l.Console.info,b(this,w).info=!1),n&&(console.warn=l.Console.warn,b(this,w).warn=!1),r&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!b(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?b(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=L.protocol,host:t=L.host,port:n=L.port,pathname:r=L.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=L.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||L.host,i=this.options.port||L.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:De.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){l[e]=t,l.pluginTable[n]={type:De.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)}},T=l;G=new WeakMap,O=new WeakMap,C=new WeakMap,N=new WeakMap,w=new WeakMap,ee=new WeakSet,Pe=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,_e=function(){try{this.setTargets(E),this.setLogLevels(y),this.setContexts($)}catch(e){console.error({lid:4321},e.message)}return!1},R(T,G,[]),m(T,"Console",null),m(T,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m(T,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),m(T,"instanceCount",0),m(T,"pluginTable",{}),m(T,"lidTable",{}),m(T,"lidTableOn",!1);var He=T,kt=He,Pt=T.generateMainInstance();var _t=T;export{_t as AnaLogger,$ as DEFAULT_LOG_CONTEXTS,y as DEFAULT_LOG_LEVELS,E as DEFAULT_LOG_TARGETS,Pt as anaLogger,kt as default};
|
|
9
9
|
|
package/esm/ana-logger.mjs
CHANGED
|
@@ -912,10 +912,33 @@ class ____AnaLogger
|
|
|
912
912
|
return !this.isNode();
|
|
913
913
|
}
|
|
914
914
|
|
|
915
|
+
/**
|
|
916
|
+
* Get a unique identifier generated once by the logger and saved in the local storage.
|
|
917
|
+
* @returns {string|null}
|
|
918
|
+
*/
|
|
919
|
+
getUid()
|
|
920
|
+
{
|
|
921
|
+
if (!this.isBrowser() || typeof window === "undefined" || !window.localStorage)
|
|
922
|
+
{
|
|
923
|
+
return null;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
const key = "analogger-uid";
|
|
927
|
+
let uid = window.localStorage.getItem(key);
|
|
928
|
+
|
|
929
|
+
if (!uid)
|
|
930
|
+
{
|
|
931
|
+
uid = "uid-" + Date.now() + "-" + Math.floor(Math.random() * 1000000);
|
|
932
|
+
window.localStorage.setItem(key, uid);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
return uid;
|
|
936
|
+
}
|
|
937
|
+
|
|
915
938
|
resetLogger()
|
|
916
939
|
{
|
|
917
940
|
this.options = {};
|
|
918
|
-
this.options.timeLenMax =
|
|
941
|
+
this.options.timeLenMax = 12;
|
|
919
942
|
this.options.contextLenMax = 10;
|
|
920
943
|
this.options.idLenMax = 5;
|
|
921
944
|
this.options.lidLenMax = 6;
|
|
@@ -952,8 +975,10 @@ class ____AnaLogger
|
|
|
952
975
|
this.options.logToRemoteDebounce = undefined;
|
|
953
976
|
this.options.logToRemoteMaxSize = undefined;
|
|
954
977
|
this.options.logToRemoteMinSize = undefined;
|
|
978
|
+
this.options.logUidToRemote = undefined;
|
|
955
979
|
this.remoteBuffer = [];
|
|
956
980
|
this.remoteTimer = null;
|
|
981
|
+
this.remoteWaitCount = 0;
|
|
957
982
|
}
|
|
958
983
|
|
|
959
984
|
resetOptions()
|
|
@@ -998,6 +1023,7 @@ class ____AnaLogger
|
|
|
998
1023
|
logToRemoteDebounce = undefined,
|
|
999
1024
|
logToRemoteMaxSize = undefined,
|
|
1000
1025
|
logToRemoteMinSize = undefined,
|
|
1026
|
+
logUidToRemote = undefined,
|
|
1001
1027
|
/** Remote - all optional **/
|
|
1002
1028
|
protocol = undefined,
|
|
1003
1029
|
host = undefined,
|
|
@@ -1044,6 +1070,7 @@ class ____AnaLogger
|
|
|
1044
1070
|
this.options.logToRemoteDebounce = logToRemoteDebounce;
|
|
1045
1071
|
this.options.logToRemoteMaxSize = logToRemoteMaxSize;
|
|
1046
1072
|
this.options.logToRemoteMinSize = logToRemoteMinSize;
|
|
1073
|
+
this.options.logUidToRemote = logUidToRemote;
|
|
1047
1074
|
|
|
1048
1075
|
if (loadHtmlToImage) {
|
|
1049
1076
|
const code = getHtmlToImage();
|
|
@@ -1071,6 +1098,7 @@ class ____AnaLogger
|
|
|
1071
1098
|
{hidePassingTests},
|
|
1072
1099
|
{logToRemote},
|
|
1073
1100
|
{logToLocalStorage},
|
|
1101
|
+
{logUidToRemote},
|
|
1074
1102
|
].forEach((feature) =>
|
|
1075
1103
|
{
|
|
1076
1104
|
const key = Object.keys(feature)[0];
|
|
@@ -2073,7 +2101,7 @@ class ____AnaLogger
|
|
|
2073
2101
|
|
|
2074
2102
|
if (this.options.logToRemoteMaxEntries !== undefined && this.remoteBuffer.length >= this.options.logToRemoteMaxEntries)
|
|
2075
2103
|
{
|
|
2076
|
-
this.flushRemoteLogs();
|
|
2104
|
+
this.flushRemoteLogs(true);
|
|
2077
2105
|
return;
|
|
2078
2106
|
}
|
|
2079
2107
|
|
|
@@ -2082,7 +2110,7 @@ class ____AnaLogger
|
|
|
2082
2110
|
const currentSize = JSON.stringify(this.remoteBuffer).length;
|
|
2083
2111
|
if (currentSize >= this.options.logToRemoteMaxSize)
|
|
2084
2112
|
{
|
|
2085
|
-
this.flushRemoteLogs();
|
|
2113
|
+
this.flushRemoteLogs(true);
|
|
2086
2114
|
return;
|
|
2087
2115
|
}
|
|
2088
2116
|
}
|
|
@@ -2103,27 +2131,38 @@ class ____AnaLogger
|
|
|
2103
2131
|
}
|
|
2104
2132
|
}
|
|
2105
2133
|
|
|
2106
|
-
flushRemoteLogs()
|
|
2134
|
+
flushRemoteLogs(force = false)
|
|
2107
2135
|
{
|
|
2108
2136
|
if (this.remoteBuffer.length === 0)
|
|
2109
2137
|
{
|
|
2110
2138
|
return;
|
|
2111
2139
|
}
|
|
2112
2140
|
|
|
2113
|
-
if (this.options.logToRemoteMinSize !== undefined)
|
|
2141
|
+
if (!force && this.options.logToRemoteMinSize !== undefined)
|
|
2114
2142
|
{
|
|
2115
2143
|
const currentSize = JSON.stringify(this.remoteBuffer).length;
|
|
2116
2144
|
if (currentSize < this.options.logToRemoteMinSize)
|
|
2117
2145
|
{
|
|
2118
|
-
// If we haven't reached min size,
|
|
2119
|
-
|
|
2146
|
+
// If we haven't reached min size, increment wait count
|
|
2147
|
+
this.remoteWaitCount = (this.remoteWaitCount || 0) + 1;
|
|
2148
|
+
|
|
2149
|
+
// If we've waited long enough (e.g. 1 consecutive skip), flush anyway
|
|
2150
|
+
if (this.remoteWaitCount < 2)
|
|
2120
2151
|
{
|
|
2121
|
-
|
|
2152
|
+
// If we haven't reached min size, and there's no timer, start one if debounce is set
|
|
2153
|
+
if (this.options.logToRemoteDebounce !== undefined)
|
|
2122
2154
|
{
|
|
2123
|
-
this.
|
|
2124
|
-
|
|
2155
|
+
if (this.remoteTimer)
|
|
2156
|
+
{
|
|
2157
|
+
clearTimeout(this.remoteTimer);
|
|
2158
|
+
}
|
|
2159
|
+
this.remoteTimer = setTimeout(() =>
|
|
2160
|
+
{
|
|
2161
|
+
this.flushRemoteLogs();
|
|
2162
|
+
}, this.options.logToRemoteDebounce);
|
|
2163
|
+
}
|
|
2164
|
+
return;
|
|
2125
2165
|
}
|
|
2126
|
-
return;
|
|
2127
2166
|
}
|
|
2128
2167
|
}
|
|
2129
2168
|
|
|
@@ -2133,6 +2172,7 @@ class ____AnaLogger
|
|
|
2133
2172
|
this.remoteTimer = null;
|
|
2134
2173
|
}
|
|
2135
2174
|
|
|
2175
|
+
this.remoteWaitCount = 0;
|
|
2136
2176
|
const dataToFlush = [...this.remoteBuffer];
|
|
2137
2177
|
this.remoteBuffer = [];
|
|
2138
2178
|
|
|
@@ -2627,6 +2667,12 @@ class ____AnaLogger
|
|
|
2627
2667
|
|
|
2628
2668
|
message = this.convertArgumentsToText(args);
|
|
2629
2669
|
|
|
2670
|
+
// Ensure UID is set early so it's available in history/context when requested
|
|
2671
|
+
if (this.options.logUidToRemote)
|
|
2672
|
+
{
|
|
2673
|
+
context.uid = this.getUid();
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2630
2676
|
let output = "";
|
|
2631
2677
|
let text = this.format({...context, message});
|
|
2632
2678
|
|