@canva/cli 0.0.1-beta.1 → 0.0.1-beta.11
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 +184 -108
- package/cli.js +446 -359
- package/lib/cjs/index.cjs +392 -0
- package/lib/esm/index.esm +392 -0
- package/package.json +11 -2
- package/templates/base/backend/routers/oauth.ts +393 -0
- package/templates/base/eslint.config.mjs +5 -277
- package/templates/base/package.json +26 -23
- package/templates/base/scripts/copy-env.ts +10 -0
- package/templates/base/utils/backend/bearer_middleware/bearer_middleware.ts +101 -0
- package/templates/base/utils/backend/bearer_middleware/index.ts +1 -0
- package/templates/base/utils/backend/bearer_middleware/tests/bearer_middleware.tests.ts +192 -0
- package/templates/base/utils/use_add_element.ts +48 -0
- package/templates/base/utils/use_feature_support.ts +28 -0
- package/templates/base/webpack.config.cjs +3 -1
- package/templates/common/.gitignore.template +5 -6
- package/templates/common/.nvmrc +1 -0
- package/templates/common/.prettierrc +21 -0
- package/templates/common/.vscode/extensions.json +6 -0
- package/templates/common/README.md +4 -74
- package/templates/common/conf/eslint-general.mjs +303 -0
- package/templates/common/conf/eslint-i18n.mjs +41 -0
- package/templates/common/conf/eslint-local-i18n-rules/index.mjs +181 -0
- package/templates/common/jest.config.mjs +29 -2
- package/templates/common/jest.setup.ts +19 -0
- package/templates/common/utils/backend/base_backend/create.ts +104 -0
- package/templates/common/utils/table_wrapper.ts +477 -0
- package/templates/common/utils/tests/table_wrapper.tests.ts +252 -0
- package/templates/common/utils/use_add_element.ts +48 -0
- package/templates/common/utils/use_feature_support.ts +28 -0
- package/templates/common/utils/use_overlay_hook.ts +74 -0
- package/templates/common/utils/use_selection_hook.ts +37 -0
- package/templates/dam/backend/server.ts +0 -7
- package/templates/dam/eslint.config.mjs +6 -275
- package/templates/dam/package.json +43 -35
- package/templates/dam/scripts/copy-env.ts +10 -0
- package/templates/dam/src/app.tsx +2 -135
- package/templates/dam/webpack.config.cjs +3 -1
- package/templates/gen_ai/README.md +1 -1
- package/templates/gen_ai/backend/routers/image.ts +3 -3
- package/templates/gen_ai/backend/server.ts +0 -7
- package/templates/gen_ai/eslint.config.mjs +5 -277
- package/templates/gen_ai/package.json +46 -38
- package/templates/gen_ai/scripts/copy-env.ts +10 -0
- package/templates/gen_ai/src/api/api.ts +1 -39
- package/templates/gen_ai/src/app.tsx +16 -10
- package/templates/gen_ai/src/components/footer.messages.ts +0 -5
- package/templates/gen_ai/src/components/footer.tsx +2 -16
- package/templates/gen_ai/src/components/image_grid.tsx +9 -7
- package/templates/gen_ai/src/components/index.ts +0 -1
- package/templates/gen_ai/src/components/prompt_input.tsx +2 -0
- package/templates/gen_ai/src/components/tests/remaining_credit.tests.tsx +43 -0
- package/templates/gen_ai/src/context/app_context.tsx +4 -26
- package/templates/gen_ai/src/context/context.messages.ts +1 -12
- package/templates/gen_ai/src/home.tsx +13 -0
- package/templates/gen_ai/src/index.tsx +2 -18
- package/templates/gen_ai/src/routes/routes.tsx +2 -2
- package/templates/gen_ai/utils/backend/bearer_middleware/bearer_middleware.ts +101 -0
- package/templates/gen_ai/utils/backend/bearer_middleware/index.ts +1 -0
- package/templates/gen_ai/utils/backend/bearer_middleware/tests/bearer_middleware.tests.ts +192 -0
- package/templates/gen_ai/webpack.config.cjs +3 -1
- package/templates/hello_world/eslint.config.mjs +5 -277
- package/templates/hello_world/package.json +46 -28
- package/templates/hello_world/scripts/copy-env.ts +10 -0
- package/templates/hello_world/src/app.tsx +25 -3
- package/templates/hello_world/src/tests/__snapshots__/app.tests.tsx.snap +45 -0
- package/templates/hello_world/src/tests/app.tests.tsx +86 -0
- package/templates/hello_world/utils/use_add_element.ts +48 -0
- package/templates/hello_world/utils/use_feature_support.ts +28 -0
- package/templates/hello_world/webpack.config.cjs +3 -1
- package/templates/dam/backend/database/database.ts +0 -42
- package/templates/dam/backend/routers/auth.ts +0 -285
- package/templates/gen_ai/backend/routers/auth.ts +0 -285
- package/templates/gen_ai/src/components/logged_in_status.tsx +0 -44
- package/templates/gen_ai/src/services/auth.tsx +0 -31
- package/templates/gen_ai/src/services/index.ts +0 -1
- /package/templates/{gen_ai → common}/utils/backend/jwt_middleware/index.ts +0 -0
- /package/templates/{gen_ai → common}/utils/backend/jwt_middleware/jwt_middleware.ts +0 -0
- /package/templates/{gen_ai → common}/utils/backend/jwt_middleware/tests/jwt_middleware.tests.ts +0 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
// Copyright 2024 Canva Inc. All Rights Reserved.
|
|
2
|
+
"use strict";var Fa=Object.create;var Ir=Object.defineProperty;var Ba=Object.getOwnPropertyDescriptor;var Wa=Object.getOwnPropertyNames;var Ua=Object.getPrototypeOf,Ga=Object.prototype.hasOwnProperty;var le=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),ja=(s,t)=>{for(var e in t)Ir(s,e,{get:t[e],enumerable:!0})},xi=(s,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Wa(t))!Ga.call(s,i)&&i!==e&&Ir(s,i,{get:()=>t[i],enumerable:!(r=Ba(t,i))||r.enumerable});return s};var ys=(s,t,e)=>(e=s!=null?Fa(Ua(s)):{},xi(t||!s||!s.__esModule?Ir(e,"default",{value:s,enumerable:!0}):e,s)),za=s=>xi(Ir({},"__esModule",{value:!0}),s);var Fi=le((Yd,$l)=>{$l.exports={name:"systeminformation",version:"5.23.5",description:"Advanced, lightweight system and OS information library",license:"MIT",author:"Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",homepage:"https://systeminformation.io",main:"./lib/index.js",bin:{systeminformation:"lib/cli.js"},types:"./lib/index.d.ts",scripts:{test:"node ./test/test.js"},files:["lib/"],keywords:["system information","sysinfo","monitor","monitoring","os","linux","osx","windows","freebsd","openbsd","netbsd","cpu","cpuload","physical cores","logical cores","processor","cores","threads","socket type","memory","file system","fsstats","diskio","block devices","netstats","network","network interfaces","network connections","network stats","iface","printer","processes","users","internet","battery","docker","docker stats","docker processes","graphics","graphic card","graphic controller","gpu","display","smart","disk layout","usb","audio","bluetooth","wifi","wifinetworks","virtual box","virtualbox","vm","backend","hardware","BIOS","chassis"],repository:{type:"git",url:"https://github.com/sebhildebrandt/systeminformation.git"},funding:{type:"Buy me a coffee",url:"https://www.buymeacoffee.com/systeminfo"},os:["darwin","linux","win32","freebsd","openbsd","netbsd","sunos","android"],engines:{node:">=8.0.0"}}});var ce=le(U=>{"use strict";var gt=require("os"),Ke=require("fs"),Yl=require("path"),Ln=require("child_process").spawn,Xl=require("child_process").exec,Ps=require("child_process").execSync,En=require("util"),ls=process.platform,Pn=ls==="linux"||ls==="android",Gi=ls==="darwin",Tn=ls==="win32",ji=ls==="freebsd",zi=ls==="openbsd",qi=ls==="netbsd",vn=0,os="",ze="",ht=null,yt=null,Hi=process.env.WINDIR||"C:\\Windows",me,Es="",Js=[],Vn=!1,Bi="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",wn="--###START###--",Wi="--ERROR--",Ar="--###ENDCMD###--",Cn="--##ID##--",Qs={windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})},$i={maxBuffer:1024*2e4,encoding:"UTF-8",stdio:["pipe","pipe","ignore"]};function Kl(s){let t=parseInt(s,10);return isNaN(t)&&(t=0),t}function Zl(s){let t=!1,e="",r="";for(let i of s)i>="0"&&i<="9"||t?(t=!0,e+=i):r+=i;return[r,e]}var On=new String().replace,In=new String().toLowerCase,Yi=new String().toString,Xi=new String().substr,Jl=new String().trim,Ql=new String().startsWith,Ki=Math.min;function ec(s){return s&&{}.toString.call(s)==="[object Function]"}function tc(s){let t=[],e={};for(let r=0;r<s.length;r++){let i=Object.keys(s[r]);i.sort(function(o,a){return o-a});let n="";for(let o=0;o<i.length;o++)n+=JSON.stringify(i[o]),n+=JSON.stringify(s[r][i[o]]);({}).hasOwnProperty.call(e,n)||(t.push(s[r]),e[n]=!0)}return t}function sc(s,t){return s.sort(function(e,r){let i="",n="";return t.forEach(function(o){i=i+e[o],n=n+r[o]}),i<n?-1:i>n?1:0})}function rc(){return vn===0&&(vn=gt.cpus().length),vn}function as(s,t,e,r,i){e=e||":",t=t.toLowerCase(),r=r||!1,i=i||!1;let n="";return s.some(o=>{let a=o.toLowerCase().replace(/\t/g,"");if(r&&(a=a.trim()),a.startsWith(t)&&(!i||a.match(t+e)||a.match(t+" "+e))){let l=r?o.trim().split(e):o.split(e);if(l.length>=2)return l.shift(),n=l.join(e).trim(),!0}}),n}function nc(s,t){return t=t||16,s.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],t))})}function ic(s){let t="",e=0;return s.split("").forEach(r=>{r>="0"&&r<="9"?e===1&&e++:(e===0&&e++,e===1&&(t+=r))}),t}function oc(s,t){t=t||"",s=s.toUpperCase();let e=0,r=0,i=ic(s),n=s.split(i);if(n.length>=2){n[2]&&(n[1]+=n[2]);let o=n[1]&&n[1].toLowerCase().indexOf("pm")>-1||n[1].toLowerCase().indexOf("p.m.")>-1||n[1].toLowerCase().indexOf("p. m.")>-1||n[1].toLowerCase().indexOf("n")>-1||n[1].toLowerCase().indexOf("ch")>-1||n[1].toLowerCase().indexOf("\xF6s")>-1||t&&n[1].toLowerCase().indexOf(t)>-1;return e=parseInt(n[0],10),r=parseInt(n[1],10),e=o&&e<12?e+12:e,("0"+e).substr(-2)+":"+("0"+r).substr(-2)}}function ac(s,t){let e={date:"",time:""};t=t||{};let r=(t.dateFormat||"").toLowerCase(),i=t.pmDesignator||"",n=s.split(" ");if(n[0]){if(n[0].indexOf("/")>=0){let o=n[0].split("/");o.length===3&&(o[0].length===4?e.date=o[0]+"-"+("0"+o[1]).substr(-2)+"-"+("0"+o[2]).substr(-2):o[2].length===2?(r.indexOf("/d/")>-1||r.indexOf("/dd/")>-1,e.date="20"+o[2]+"-"+("0"+o[1]).substr(-2)+"-"+("0"+o[0]).substr(-2)):(s.toLowerCase().indexOf("pm")>-1||s.toLowerCase().indexOf("p.m.")>-1||s.toLowerCase().indexOf("p. m.")>-1||s.toLowerCase().indexOf("am")>-1||s.toLowerCase().indexOf("a.m.")>-1||s.toLowerCase().indexOf("a. m.")>-1||r.indexOf("/d/")>-1||r.indexOf("/dd/")>-1)&&r.indexOf("dd/")!==0?e.date=o[2]+"-"+("0"+o[0]).substr(-2)+"-"+("0"+o[1]).substr(-2):e.date=o[2]+"-"+("0"+o[1]).substr(-2)+"-"+("0"+o[0]).substr(-2))}if(n[0].indexOf(".")>=0){let o=n[0].split(".");o.length===3&&(r.indexOf(".d.")>-1||r.indexOf(".dd.")>-1?e.date=o[2]+"-"+("0"+o[0]).substr(-2)+"-"+("0"+o[1]).substr(-2):e.date=o[2]+"-"+("0"+o[1]).substr(-2)+"-"+("0"+o[0]).substr(-2))}if(n[0].indexOf("-")>=0){let o=n[0].split("-");o.length===3&&(e.date=o[0]+"-"+("0"+o[1]).substr(-2)+"-"+("0"+o[2]).substr(-2))}}if(n[1]){n.shift();let o=n.join(" ");e.time=oc(o,i)}return e}function lc(s,t){let e=t>0,r=1,i=0,n=0,o=[];for(let l=0;l<s.length;l++)r<=t?(/\s/.test(s[l])&&!e&&(n=l-1,o.push({from:i,to:n+1,cap:s.substring(i,n+1)}),i=n+2,r++),e=s[l]===" "):(!/\s/.test(s[l])&&e&&(n=l-1,i<n&&o.push({from:i,to:n,cap:s.substring(i,n)}),i=n+1,r++),e=s[l]===" ");n=5e3,o.push({from:i,to:n,cap:s.substring(i,n)});let a=o.length;for(let l=0;l<a;l++)o[l].cap.replace(/\s/g,"").length===0&&l+1<a&&(o[l].to=o[l+1].to,o[l].cap=o[l].cap+o[l+1].cap,o.splice(l+1,1),a=a-1);return o}function cc(s,t,e){for(let r=0;r<s.length;r++)if(s[r][t]===e)return r;return-1}function Zi(){if(gt.type()==="Windows_NT"&&!os&&(os=Hi+"\\system32\\wbem\\wmic.exe",!Ke.existsSync(os)))try{let s=Ps("WHERE WMIC",Qs).toString().split(`\r
|
|
3
|
+
`);s&&s.length?os=s[0]:os="wmic"}catch{os="wmic"}return os}function uc(s){return new Promise(t=>{process.nextTick(()=>{try{Ji(Zi()+" "+s).then(e=>{t(e,"")})}catch(e){t("",e)}})})}function pc(){return Tn?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"}function xn(s){let t="",e,r="";if(s.indexOf(wn)>=0){e=s.split(wn);let n=e[1].split(Cn);t=n[0],n.length>1&&(s=n.slice(1).join(Cn))}s.indexOf(Ar)>=0&&(e=s.split(Ar),r=e[0]);let i=-1;for(let n=0;n<Js.length;n++)Js[n].id===t&&(i=n,Js[n].callback(r));i>=0&&Js.splice(i,1)}function fc(){me||(me=Ln("powershell.exe",["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})}),me&&me.pid&&(Vn=!0,me.stdout.on("data",function(s){Es=Es+s.toString("utf8"),s.indexOf(Ar)>=0&&(xn(Es),Es="")}),me.stderr.on("data",function(){xn(Es+Wi)}),me.on("error",function(){xn(Es+Wi)}),me.on("close",function(){me&&me.kill()})))}function dc(){try{me&&(me.stdin.write("exit"+gt.EOL),me.stdin.end(),Vn=!1)}catch{me&&me.kill()}me=null}function Ji(s){if(Vn){let t=Math.random().toString(36).substring(2,12);return new Promise(e=>{process.nextTick(()=>{function r(i){e(i)}Js.push({id:t,cmd:s,callback:r,start:new Date});try{me&&me.pid&&me.stdin.write(Bi+"echo "+wn+t+Cn+"; "+gt.EOL+s+gt.EOL+"echo "+Ar+gt.EOL)}catch{e("")}})})}else{let t="";return new Promise(e=>{process.nextTick(()=>{try{let r=Ln("powershell.exe",["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-ExecutionPolicy","Unrestricted","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:2048e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})});if(r&&!r.pid&&r.on("error",function(){e(t)}),r&&r.pid){r.stdout.on("data",function(i){t=t+i.toString("utf8")}),r.stderr.on("data",function(){r.kill(),e(t)}),r.on("close",function(){r.kill(),e(t)}),r.on("error",function(){r.kill(),e(t)});try{r.stdin.write(Bi+s+gt.EOL),r.stdin.write("exit"+gt.EOL),r.stdin.end()}catch{r.kill(),e(t)}}else e(t)}catch{e(t)}})})}}function mc(s,t,e){let r="";return e=e||{},new Promise(i=>{process.nextTick(()=>{try{let n=Ln(s,t,e);n&&!n.pid&&n.on("error",function(){i(r)}),n&&n.pid?(n.stdout.on("data",function(o){r+=o.toString()}),n.on("close",function(){n.kill(),i(r)}),n.on("error",function(){n.kill(),i(r)})):i(r)}catch{i(r)}})})}function hc(){if(Tn){if(!ze)try{let e=Ps("chcp",Qs).toString().split(`\r
|
|
4
|
+
`)[0].split(":");ze=e.length>1?e[1].replace(".","").trim():""}catch{ze="437"}return ze}if(Pn||Gi||ji||zi||qi){if(!ze)try{let e=Ps("echo $LANG",En.execOptsLinux).toString().split(`\r
|
|
5
|
+
`)[0].split(".");ze=e.length>1?e[1].trim():"",ze||(ze="UTF-8")}catch{ze="UTF-8"}return ze}}function gc(){if(ht!==null)return ht;if(ht=!1,Tn)try{let s=Ps("WHERE smartctl 2>nul",Qs).toString().split(`\r
|
|
6
|
+
`);s&&s.length?ht=s[0].indexOf(":\\")>=0:ht=!1}catch{ht=!1}if(Pn||Gi||ji||zi||qi)try{ht=Ps("which smartctl 2>/dev/null",$i).toString().split(`\r
|
|
7
|
+
`).length>0}catch{En.noop()}return ht}function yc(){let s=["BCM2708","BCM2709","BCM2710","BCM2711","BCM2712","BCM2835","BCM2836","BCM2837","BCM2837B0"],t=[];if(yt!==null)t=yt;else try{t=Ke.readFileSync("/proc/cpuinfo",{encoding:"utf8"}).toString().split(`
|
|
8
|
+
`),yt=t}catch{return!1}let e=as(t,"hardware");return e&&s.indexOf(e)>-1}function _c(){let s=[];try{s=Ke.readFileSync("/etc/os-release",{encoding:"utf8"}).toString().split(`
|
|
9
|
+
`)}catch{return!1}let t=as(s,"id","=");return t&&t.indexOf("raspbian")>-1}function Sc(s,t,e){e||(e=t,t=Qs);let r="chcp 65001 > nul && cmd /C "+s+" && chcp "+ze+" > nul";Xl(r,t,function(i,n){e(i,n)})}function vc(){let s=Ke.existsSync("/Library/Developer/CommandLineTools/usr/bin/"),t=Ke.existsSync("/Applications/Xcode.app/Contents/Developer/Tools"),e=Ke.existsSync("/Library/Developer/Xcode/");return s||e||t}function xc(){let s=process.hrtime();return!Array.isArray(s)||s.length!==2?0:+s[0]*1e9+ +s[1]}function wc(s,t){t=t||"";let e=[];return s.forEach(r=>{r.startsWith(t)&&e.indexOf(r)===-1&&e.push(r)}),e.length}function Cc(s,t){t=t||"";let e=[];return s.forEach(r=>{r.startsWith(t)&&e.push(r)}),e.length}function Oc(s,t){typeof t>"u"&&(t=!1);let e=s||"",r="",i=Ki(e.length,2e3);for(let n=0;n<=i;n++)e[n]===void 0||e[n]===">"||e[n]==="<"||e[n]==="*"||e[n]==="?"||e[n]==="["||e[n]==="]"||e[n]==="|"||e[n]==="\u02DA"||e[n]==="$"||e[n]===";"||e[n]==="&"||e[n]==="]"||e[n]==="#"||e[n]==="\\"||e[n]===" "||e[n]===`
|
|
10
|
+
`||e[n]==="\r"||e[n]==="'"||e[n]==="`"||e[n]==='"'||e[n].length>1||t&&e[n]==="("||t&&e[n]===")"||t&&e[n]==="@"||t&&e[n]===" "||t&&e[n]=="{"||t&&e[n]==";"||t&&e[n]=="}"||(r=r+e[n]);return r}function Ic(){let s="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",t=!0,e="";e.__proto__.replace=On,e.__proto__.toLowerCase=In,e.__proto__.toString=Yi,e.__proto__.substr=Xi,t=t||s.length!==62;let r=Date.now();if(typeof r=="number"&&r>16e11){let i=r%100+15;for(let c=0;c<i;c++){let u=Math.random()*61.99999999+1,p=parseInt(Math.floor(u).toString(),10),f=parseInt(u.toString().split(".")[0],10),d=Math.random()*61.99999999+1,m=parseInt(Math.floor(d).toString(),10),g=parseInt(d.toString().split(".")[0],10);t=t&&u!==d,t=t&&p===f&&m===g,e+=s[p-1]}t=t&&e.length===i;let n=Math.random()*i*.9999999999,o=e.substr(0,n)+" "+e.substr(n,2e3);o.__proto__.replace=On;let a=o.replace(/ /g,"");t=t&&e===a,n=Math.random()*i*.9999999999,o=e.substr(0,n)+"{"+e.substr(n,2e3),a=o.replace(/{/g,""),t=t&&e===a,n=Math.random()*i*.9999999999,o=e.substr(0,n)+"*"+e.substr(n,2e3),a=o.replace(/\*/g,""),t=t&&e===a,n=Math.random()*i*.9999999999,o=e.substr(0,n)+"$"+e.substr(n,2e3),a=o.replace(/\$/g,""),t=t&&e===a;let l=e.toLowerCase();t=t&&l.length===i&&l[i-1]&&!l[i];for(let c=0;c<i;c++){let u=e[c];u.__proto__.toLowerCase=In;let p=l?l[c]:"",f=u.toLowerCase();t=t&&f[0]===p&&f[0]&&!f[1]}}return!t}function Lc(s){return("00000000"+parseInt(s,16).toString(2)).substr(-8)}function Ec(s){let t=Ke.lstatSync,e=Ke.readdirSync,r=Yl.join;function i(c){return t(c).isDirectory()}function n(c){return t(c).isFile()}function o(c){return e(c).map(function(u){return r(c,u)}).filter(i)}function a(c){return e(c).map(function(u){return r(c,u)}).filter(n)}function l(c){try{return o(c).map(function(f){return l(f)}).reduce(function(f,d){return f.concat(d)},[]).concat(a(c))}catch{return[]}}return Ke.existsSync(s)?l(s):[]}function Qi(s){yt===null&&(yt=s);let t={"0002":{type:"B",revision:"1.0",memory:256,manufacturer:"Egoman",processor:"BCM2835"},"0003":{type:"B",revision:"1.0",memory:256,manufacturer:"Egoman",processor:"BCM2835"},"0004":{type:"B",revision:"2.0",memory:256,manufacturer:"Sony UK",processor:"BCM2835"},"0005":{type:"B",revision:"2.0",memory:256,manufacturer:"Qisda",processor:"BCM2835"},"0006":{type:"B",revision:"2.0",memory:256,manufacturer:"Egoman",processor:"BCM2835"},"0007":{type:"A",revision:"2.0",memory:256,manufacturer:"Egoman",processor:"BCM2835"},"0008":{type:"A",revision:"2.0",memory:256,manufacturer:"Sony UK",processor:"BCM2835"},"0009":{type:"A",revision:"2.0",memory:256,manufacturer:"Qisda",processor:"BCM2835"},"000d":{type:"B",revision:"2.0",memory:512,manufacturer:"Egoman",processor:"BCM2835"},"000e":{type:"B",revision:"2.0",memory:512,manufacturer:"Sony UK",processor:"BCM2835"},"000f":{type:"B",revision:"2.0",memory:512,manufacturer:"Egoman",processor:"BCM2835"},"0010":{type:"B+",revision:"1.2",memory:512,manufacturer:"Sony UK",processor:"BCM2835"},"0011":{type:"CM1",revision:"1.0",memory:512,manufacturer:"Sony UK",processor:"BCM2835"},"0012":{type:"A+",revision:"1.1",memory:256,manufacturer:"Sony UK",processor:"BCM2835"},"0013":{type:"B+",revision:"1.2",memory:512,manufacturer:"Embest",processor:"BCM2835"},"0014":{type:"CM1",revision:"1.0",memory:512,manufacturer:"Embest",processor:"BCM2835"},"0015":{type:"A+",revision:"1.1",memory:256,manufacturer:"512MB Embest",processor:"BCM2835"}},e=["BCM2835","BCM2836","BCM2837","BCM2711","BCM2712"],r=["Sony UK","Egoman","Embest","Sony Japan","Embest","Stadium"],i={"00":"A","01":"B","02":"A+","03":"B+","04":"2B","05":"Alpha (early prototype)","06":"CM1","08":"3B","09":"Zero","0a":"CM3","0c":"Zero W","0d":"3B+","0e":"3A+","0f":"Internal use only",10:"CM3+",11:"4B",12:"Zero 2 W",13:"400",14:"CM4",15:"CM4S",17:"5"},n=as(s,"revision",":",!0),o=as(s,"model:",":",!0),a=as(s,"serial",":",!0),l={};if({}.hasOwnProperty.call(t,n))l={model:o,serial:a,revisionCode:n,memory:t[n].memory,manufacturer:t[n].manufacturer,processor:t[n].processor,type:t[n].type,revision:t[n].revision};else{let c=("00000000"+as(s,"revision",":",!0).toLowerCase()).substr(-8),u=parseInt(Lc(c.substr(2,1)).substr(5,3),2)||0,p=r[parseInt(c.substr(3,1),10)],f=e[parseInt(c.substr(4,1),10)],d=c.substr(5,2);l={model:o,serial:a,revisionCode:n,memory:256*Math.pow(2,u),manufacturer:p,processor:f,type:{}.hasOwnProperty.call(i,d)?i[d]:"",revision:"1."+c.substr(7,1)}}return l}function Pc(){let s=null;if(yt!==null)s=yt;else try{s=Ke.readFileSync("/proc/cpuinfo",{encoding:"utf8"}).toString().split(`
|
|
11
|
+
`),yt=s}catch{return!1}let t=Qi(s);return t.type==="4B"||t.type==="CM4"||t.type==="CM4S"||t.type==="400"?"VideoCore VI":t.type==="5"?"VideoCore VII":"VideoCore IV"}function Tc(s){let t=s.map(function(i){return new Promise(function(n){let o=new Array(2);i.then(function(a){o[0]=a}).catch(function(a){o[1]=a}).then(function(){n(o)})})}),e=[],r=[];return Promise.all(t).then(function(i){return i.forEach(function(n){n[1]?(e.push(n[1]),r.push(null)):(e.push(null),r.push(n[0]))}),{errors:e,results:r}})}function Vc(s){return function(){let t=Array.prototype.slice.call(arguments);return new Promise(function(e,r){t.push(function(i,n){i?r(i):e(n)}),s.apply(null,t)})}}function Nc(s){return function(){let t=Array.prototype.slice.call(arguments);return new Promise(function(e){t.push(function(r,i){e(i)}),s.apply(null,t)})}}function Dc(){let s="";if(Pn)try{s=Ps("uname -v",En.execOptsLinux).toString()}catch{s=""}return s}function Ac(s){let t=["array","dict","key","string","integer","date","real","data","boolean","arrayEmpty"],r=s.indexOf("<plist version"),i=s.length;for(;s[r]!==">"&&r<i;)r++;let n=0,o=!1,a=!1,l=!1,c=[{tagStart:"",tagEnd:"",tagContent:"",key:"",data:null}],u="",p=s[r];for(;r<i;)u=p,r+1<i&&(p=s[r+1]),u==="<"?(a=!1,p==="/"?l=!0:c[n].tagStart?(c[n].tagContent="",c[n].data||(c[n].data=c[n].tagStart==="array"?[]:{}),n++,c.push({tagStart:"",tagEnd:"",tagContent:"",key:null,data:null}),o=!0,a=!1):o||(o=!0)):u===">"?(c[n].tagStart==="true/"&&(o=!1,l=!0,c[n].tagStart="",c[n].tagEnd="/boolean",c[n].data=!0),c[n].tagStart==="false/"&&(o=!1,l=!0,c[n].tagStart="",c[n].tagEnd="/boolean",c[n].data=!1),c[n].tagStart==="array/"&&(o=!1,l=!0,c[n].tagStart="",c[n].tagEnd="/arrayEmpty",c[n].data=[]),a&&(a=!1),o&&(o=!1,a=!0,c[n].tagStart==="array"&&(c[n].data=[]),c[n].tagStart==="dict"&&(c[n].data={})),l&&(l=!1,c[n].tagEnd&&t.indexOf(c[n].tagEnd.substr(1))>=0&&(c[n].tagEnd==="/dict"||c[n].tagEnd==="/array"?(n>1&&c[n-2].tagStart==="array"&&c[n-2].data.push(c[n-1].data),n>1&&c[n-2].tagStart==="dict"&&(c[n-2].data[c[n-1].key]=c[n-1].data),n--,c.pop(),c[n].tagContent="",c[n].tagStart="",c[n].tagEnd=""):(c[n].tagEnd==="/key"&&c[n].tagContent?c[n].key=c[n].tagContent:(c[n].tagEnd==="/real"&&c[n].tagContent&&(c[n].data=parseFloat(c[n].tagContent)||0),c[n].tagEnd==="/integer"&&c[n].tagContent&&(c[n].data=parseInt(c[n].tagContent)||0),c[n].tagEnd==="/string"&&c[n].tagContent&&(c[n].data=c[n].tagContent||""),c[n].tagEnd==="/boolean"&&(c[n].data=c[n].tagContent||!1),c[n].tagEnd==="/arrayEmpty"&&(c[n].data=c[n].tagContent||[]),n>0&&c[n-1].tagStart==="array"&&c[n-1].data.push(c[n].data),n>0&&c[n-1].tagStart==="dict"&&(c[n-1].data[c[n].key]=c[n].data)),c[n].tagContent="",c[n].tagStart="",c[n].tagEnd="")),c[n].tagEnd="",o=!1,a=!1)):(o&&(c[n].tagStart+=u),l&&(c[n].tagEnd+=u),a&&(c[n].tagContent+=u)),r++;return c[0].data}function Ui(s){return typeof s=="string"&&!isNaN(s)&&!isNaN(parseFloat(s))}function bc(s){let t=s.split(`
|
|
12
|
+
`);for(let r=0;r<t.length;r++){if(t[r].indexOf(" = ")>=0){let i=t[r].split(" = ");if(i[0]=i[0].trim(),i[0].startsWith('"')||(i[0]='"'+i[0]+'"'),i[1]=i[1].trim(),i[1].indexOf('"')===-1&&i[1].endsWith(";")){let n=i[1].substring(0,i[1].length-1);Ui(n)||(i[1]=`"${n}";`)}if(i[1].indexOf('"')>=0&&i[1].endsWith(";")){let n=i[1].substring(0,i[1].length-1).replace(/"/g,"");Ui(n)&&(i[1]=`${n};`)}t[r]=i.join(" : ")}t[r]=t[r].replace(/\(/g,"[").replace(/\)/g,"]").replace(/;/g,",").trim(),t[r].startsWith("}")&&t[r-1]&&t[r-1].endsWith(",")&&(t[r-1]=t[r-1].substring(0,t[r-1].length-1))}s=t.join("");let e={};try{e=JSON.parse(s)}catch{}return e}function Mc(s,t){let e=0,r=s.split("."),i=t.split(".");return r[0]<i[0]?e=1:r[0]>i[0]?e=-1:r[0]===i[0]&&r.length>=2&&i.length>=2&&(r[1]<i[1]?e=1:r[1]>i[1]?e=-1:r[1]===i[1]&&(r.length>=3&&i.length>=3?r[2]<i[2]?e=1:r[2]>i[2]&&(e=-1):i.length>=3&&(e=1))),e}function Rc(){}U.toInt=Kl;U.splitByNumber=Zl;U.execOptsWin=Qs;U.execOptsLinux=$i;U.getCodepage=hc;U.execWin=Sc;U.isFunction=ec;U.unique=tc;U.sortByKey=sc;U.cores=rc;U.getValue=as;U.decodeEscapeSequence=nc;U.parseDateTime=ac;U.parseHead=lc;U.findObjectByKey=cc;U.getWmic=Zi;U.wmic=uc;U.darwinXcodeExists=vc;U.getVboxmanage=pc;U.powerShell=Ji;U.powerShellStart=fc;U.powerShellRelease=dc;U.execSafe=mc;U.nanoSeconds=xc;U.countUniqueLines=wc;U.countLines=Cc;U.noop=Rc;U.isRaspberry=yc;U.isRaspbian=_c;U.sanitizeShellString=Oc;U.isPrototypePolluted=Ic;U.decodePiCpuinfo=Qi;U.getRpiGpu=Pc;U.promiseAll=Tc;U.promisify=Vc;U.promisifySave=Nc;U.smartMonToolsInstalled=gc;U.linuxVersion=Dc;U.plistParser=Ac;U.plistReader=bc;U.stringReplace=On;U.stringToLower=In;U.stringToString=Yi;U.stringSubstr=Xi;U.stringTrim=Jl;U.stringStartWith=Ql;U.mathMin=Ki;U.WINDIR=Hi;U.getFilesInPath=Ec;U.semverCompare=Mc});var eo=le(rr=>{"use strict";var Mr=require("fs"),cs=require("os"),w=ce(),Vs=require("child_process").exec,Ts=require("child_process").execSync,br=w.promisify(require("child_process").exec),_t=process.platform,Rr=_t==="linux"||_t==="android",kr=_t==="darwin",Fr=_t==="win32",er=_t==="freebsd",tr=_t==="openbsd",sr=_t==="netbsd",Br=_t==="sunos";function kc(s){return new Promise(t=>{process.nextTick(()=>{let e={manufacturer:"",model:"Computer",version:"",serial:"-",uuid:"-",sku:"-",virtual:!1};if((Rr||er||tr||sr)&&Vs("export LC_ALL=C; dmidecode -t system 2>/dev/null; unset LC_ALL",function(r,i){let n=i.toString().split(`
|
|
13
|
+
`);e.manufacturer=w.getValue(n,"manufacturer"),e.model=w.getValue(n,"product name"),e.version=w.getValue(n,"version"),e.serial=w.getValue(n,"serial number"),e.uuid=w.getValue(n,"uuid").toLowerCase(),e.sku=w.getValue(n,"sku number");let o=`echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo;
|
|
14
|
+
echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo;
|
|
15
|
+
echo -n "product_uuid: "; cat /sys/devices/virtual/dmi/id/product_uuid 2>/dev/null; echo;
|
|
16
|
+
echo -n "product_version: "; cat /sys/devices/virtual/dmi/id/product_version 2>/dev/null; echo;
|
|
17
|
+
echo -n "sys_vendor: "; cat /sys/devices/virtual/dmi/id/sys_vendor 2>/dev/null; echo;`;try{n=Ts(o,w.execOptsLinux).toString().split(`
|
|
18
|
+
`),e.manufacturer=e.manufacturer===""?w.getValue(n,"sys_vendor"):e.manufacturer,e.model=e.model===""?w.getValue(n,"product_name"):e.model,e.version=e.version===""?w.getValue(n,"product_version"):e.version,e.serial=e.serial===""?w.getValue(n,"product_serial"):e.serial,e.uuid=e.uuid===""?w.getValue(n,"product_uuid").toLowerCase():e.uuid}catch{w.noop()}if((!e.serial||e.serial.toLowerCase().indexOf("o.e.m.")!==-1)&&(e.serial="-"),(!e.manufacturer||e.manufacturer.toLowerCase().indexOf("o.e.m.")!==-1)&&(e.manufacturer=""),(!e.model||e.model.toLowerCase().indexOf("o.e.m.")!==-1)&&(e.model="Computer"),(!e.version||e.version.toLowerCase().indexOf("o.e.m.")!==-1)&&(e.version=""),(!e.sku||e.sku.toLowerCase().indexOf("o.e.m.")!==-1)&&(e.sku="-"),e.model.toLowerCase()==="virtualbox"||e.model.toLowerCase()==="kvm"||e.model.toLowerCase()==="virtual machine"||e.model.toLowerCase()==="bochs"||e.model.toLowerCase().startsWith("vmware")||e.model.toLowerCase().startsWith("droplet"))switch(e.virtual=!0,e.model.toLowerCase()){case"virtualbox":e.virtualHost="VirtualBox";break;case"vmware":e.virtualHost="VMware";break;case"kvm":e.virtualHost="KVM";break;case"bochs":e.virtualHost="bochs";break}if(e.manufacturer.toLowerCase().startsWith("vmware")||e.manufacturer.toLowerCase()==="xen")switch(e.virtual=!0,e.manufacturer.toLowerCase()){case"vmware":e.virtualHost="VMware";break;case"xen":e.virtualHost="Xen";break}if(!e.virtual)try{let a=Ts("ls -1 /dev/disk/by-id/ 2>/dev/null",w.execOptsLinux).toString();a.indexOf("_QEMU_")>=0&&(e.virtual=!0,e.virtualHost="QEMU"),a.indexOf("_VBOX_")>=0&&(e.virtual=!0,e.virtualHost="VirtualBox")}catch{w.noop()}if(!e.virtual&&(cs.release().toLowerCase().indexOf("microsoft")>=0||cs.release().toLowerCase().endsWith("wsl2"))){let a=parseFloat(cs.release().toLowerCase());e.virtual=!0,e.manufacturer="Microsoft",e.model="WSL",e.version=a<4.19?"1":"2"}if((er||tr||sr)&&!e.virtualHost)try{let l=Ts("dmidecode -t 4",w.execOptsLinux).toString().split(`
|
|
19
|
+
`);switch(w.getValue(l,"manufacturer",":",!0).toLowerCase()){case"virtualbox":e.virtualHost="VirtualBox";break;case"vmware":e.virtualHost="VMware";break;case"kvm":e.virtualHost="KVM";break;case"bochs":e.virtualHost="bochs";break}}catch{w.noop()}(Mr.existsSync("/.dockerenv")||Mr.existsSync("/.dockerinit"))&&(e.model="Docker Container");try{let a=Ts('dmesg 2>/dev/null | grep -iE "virtual|hypervisor" | grep -iE "vmware|qemu|kvm|xen" | grep -viE "Nested Virtualization|/virtual/"');a.toString().split(`
|
|
20
|
+
`).length>0&&(e.model==="Computer"&&(e.model="Virtual machine"),e.virtual=!0,a.toString().toLowerCase().indexOf("vmware")>=0&&!e.virtualHost&&(e.virtualHost="VMware"),a.toString().toLowerCase().indexOf("qemu")>=0&&!e.virtualHost&&(e.virtualHost="QEMU"),a.toString().toLowerCase().indexOf("xen")>=0&&!e.virtualHost&&(e.virtualHost="Xen"),a.toString().toLowerCase().indexOf("kvm")>=0&&!e.virtualHost&&(e.virtualHost="KVM"))}catch{w.noop()}e.manufacturer===""&&e.model==="Computer"&&e.version===""?Mr.readFile("/proc/cpuinfo",function(a,l){if(!a){let c=l.toString().split(`
|
|
21
|
+
`);e.model=w.getValue(c,"hardware",":",!0).toUpperCase(),e.version=w.getValue(c,"revision",":",!0).toLowerCase(),e.serial=w.getValue(c,"serial",":",!0);let u=w.getValue(c,"model:",":",!0);if((e.model==="BCM2835"||e.model==="BCM2708"||e.model==="BCM2709"||e.model==="BCM2710"||e.model==="BCM2711"||e.model==="BCM2836"||e.model==="BCM2837")&&u.toLowerCase().indexOf("raspberry")>=0){let p=w.decodePiCpuinfo(c);e.model=p.model,e.version=p.revisionCode,e.manufacturer="Raspberry Pi Foundation",e.raspberry={manufacturer:p.manufacturer,processor:p.processor,type:p.type,revision:p.revision}}}s&&s(e),t(e)}):(s&&s(e),t(e))}),kr&&Vs("ioreg -c IOPlatformExpertDevice -d 2",function(r,i){if(!r){let n=i.toString().replace(/[<>"]/g,"").split(`
|
|
22
|
+
`),o=w.splitByNumber(w.getValue(n,"model","=",!0)),a=w.getValue(n,"version","=",!0);e.manufacturer=w.getValue(n,"manufacturer","=",!0),e.model=a?w.getValue(n,"model","=",!0):o[0],e.version=a||o[1],e.serial=w.getValue(n,"ioplatformserialnumber","=",!0),e.uuid=w.getValue(n,"ioplatformuuid","=",!0).toLowerCase(),e.sku=w.getValue(n,"board-id","=",!0)||w.getValue(n,"target-sub-type","=",!0)}s&&s(e),t(e)}),Br&&(s&&s(e),t(e)),Fr)try{w.powerShell("Get-CimInstance Win32_ComputerSystemProduct | select Name,Vendor,Version,IdentifyingNumber,UUID | fl").then((r,i)=>{if(i)s&&s(e),t(e);else{let n=r.split(`\r
|
|
23
|
+
`);e.manufacturer=w.getValue(n,"vendor",":"),e.model=w.getValue(n,"name",":"),e.version=w.getValue(n,"version",":"),e.serial=w.getValue(n,"identifyingnumber",":"),e.uuid=w.getValue(n,"uuid",":").toLowerCase();let o=e.model.toLowerCase();(o==="virtualbox"||o==="kvm"||o==="virtual machine"||o==="bochs"||o.startsWith("vmware")||o.startsWith("qemu")||o.startsWith("parallels"))&&(e.virtual=!0,o.startsWith("virtualbox")&&(e.virtualHost="VirtualBox"),o.startsWith("vmware")&&(e.virtualHost="VMware"),o.startsWith("kvm")&&(e.virtualHost="KVM"),o.startsWith("bochs")&&(e.virtualHost="bochs"),o.startsWith("qemu")&&(e.virtualHost="KVM"),o.startsWith("parallels")&&(e.virtualHost="Parallels"));let a=e.manufacturer.toLowerCase();(a.startsWith("vmware")||a.startsWith("qemu")||a==="xen"||a.startsWith("parallels"))&&(e.virtual=!0,a.startsWith("vmware")&&(e.virtualHost="VMware"),a.startsWith("xen")&&(e.virtualHost="Xen"),a.startsWith("qemu")&&(e.virtualHost="KVM"),a.startsWith("parallels")&&(e.virtualHost="Parallels")),w.powerShell('Get-CimInstance MS_Systeminformation -Namespace "root/wmi" | select systemsku | fl ').then((l,c)=>{if(!c){let u=l.split(`\r
|
|
24
|
+
`);e.sku=w.getValue(u,"systemsku",":")}e.virtual?(s&&s(e),t(e)):w.powerShell("Get-CimInstance Win32_bios | select Version, SerialNumber, SMBIOSBIOSVersion").then((u,p)=>{if(p)s&&s(e),t(e);else{let f=u.toString();(f.indexOf("VRTUAL")>=0||f.indexOf("A M I ")>=0||f.indexOf("VirtualBox")>=0||f.indexOf("VMWare")>=0||f.indexOf("Xen")>=0||f.indexOf("Parallels")>=0)&&(e.virtual=!0,f.indexOf("VirtualBox")>=0&&!e.virtualHost&&(e.virtualHost="VirtualBox"),f.indexOf("VMware")>=0&&!e.virtualHost&&(e.virtualHost="VMware"),f.indexOf("Xen")>=0&&!e.virtualHost&&(e.virtualHost="Xen"),f.indexOf("VRTUAL")>=0&&!e.virtualHost&&(e.virtualHost="Hyper-V"),f.indexOf("A M I")>=0&&!e.virtualHost&&(e.virtualHost="Virtual PC"),f.indexOf("Parallels")>=0&&!e.virtualHost&&(e.virtualHost="Parallels")),s&&s(e),t(e)}})})}})}catch{s&&s(e),t(e)}})})}rr.system=kc;function re(s){let t=s.toLowerCase();return t.indexOf("o.e.m.")===-1&&t.indexOf("default string")===-1&&t!=="default"&&s||""}function Fc(s){return new Promise(t=>{process.nextTick(()=>{let e={vendor:"",version:"",releaseDate:"",revision:""},r="";if((Rr||er||tr||sr)&&(process.arch==="arm"?r="cat /proc/cpuinfo | grep Serial":r="export LC_ALL=C; dmidecode -t bios 2>/dev/null; unset LC_ALL",Vs(r,function(i,n){let o=n.toString().split(`
|
|
25
|
+
`);e.vendor=w.getValue(o,"Vendor"),e.version=w.getValue(o,"Version");let a=w.getValue(o,"Release Date");e.releaseDate=w.parseDateTime(a).date,e.revision=w.getValue(o,"BIOS Revision"),e.serial=w.getValue(o,"SerialNumber");let l=w.getValue(o,"Currently Installed Language").split("|")[0];if(l&&(e.language=l),o.length&&n.toString().indexOf("Characteristics:")>=0){let u=[];o.forEach(p=>{if(p.indexOf(" is supported")>=0){let f=p.split(" is supported")[0].trim();u.push(f)}}),e.features=u}let c=`echo -n "bios_date: "; cat /sys/devices/virtual/dmi/id/bios_date 2>/dev/null; echo;
|
|
26
|
+
echo -n "bios_vendor: "; cat /sys/devices/virtual/dmi/id/bios_vendor 2>/dev/null; echo;
|
|
27
|
+
echo -n "bios_version: "; cat /sys/devices/virtual/dmi/id/bios_version 2>/dev/null; echo;`;try{o=Ts(c,w.execOptsLinux).toString().split(`
|
|
28
|
+
`),e.vendor=e.vendor?e.vendor:w.getValue(o,"bios_vendor"),e.version=e.version?e.version:w.getValue(o,"bios_version"),a=w.getValue(o,"bios_date"),e.releaseDate=e.releaseDate?e.releaseDate:w.parseDateTime(a).date}catch{w.noop()}s&&s(e),t(e)})),kr&&(e.vendor="Apple Inc.",Vs("system_profiler SPHardwareDataType -json",function(i,n){try{let o=JSON.parse(n.toString());if(o&&o.SPHardwareDataType&&o.SPHardwareDataType.length){let a=o.SPHardwareDataType[0].boot_rom_version;a=a?a.split("(")[0].trim():null,e.version=a}}catch{w.noop()}s&&s(e),t(e)})),Br&&(e.vendor="Sun Microsystems",s&&s(e),t(e)),Fr)try{w.powerShell('Get-CimInstance Win32_bios | select Description,Version,Manufacturer,@{n="ReleaseDate";e={$_.ReleaseDate.ToString("yyyy-MM-dd")}},BuildNumber,SerialNumber,SMBIOSBIOSVersion | fl').then((i,n)=>{if(!n){let o=i.toString().split(`\r
|
|
29
|
+
`),a=w.getValue(o,"description",":"),l=w.getValue(o,"SMBIOSBIOSVersion",":");a.indexOf(" Version ")!==-1?(e.vendor=a.split(" Version ")[0].trim(),e.version=a.split(" Version ")[1].trim()):a.indexOf(" Ver: ")!==-1?(e.vendor=w.getValue(o,"manufacturer",":"),e.version=a.split(" Ver: ")[1].trim()):(e.vendor=w.getValue(o,"manufacturer",":"),e.version=l||w.getValue(o,"version",":")),e.releaseDate=w.getValue(o,"releasedate",":"),e.revision=w.getValue(o,"buildnumber",":"),e.serial=re(w.getValue(o,"serialnumber",":"))}s&&s(e),t(e)})}catch{s&&s(e),t(e)}})})}rr.bios=Fc;function Bc(s){return new Promise(t=>{process.nextTick(()=>{let e={manufacturer:"",model:"",version:"",serial:"-",assetTag:"-",memMax:null,memSlots:null},r="";if(Rr||er||tr||sr){process.arch==="arm"?r="cat /proc/cpuinfo | grep Serial":r="export LC_ALL=C; dmidecode -t 2 2>/dev/null; unset LC_ALL";let i=[];i.push(br(r)),i.push(br("export LC_ALL=C; dmidecode -t memory 2>/dev/null")),w.promiseAll(i).then(n=>{let o=n.results[0]?n.results[0].toString().split(`
|
|
30
|
+
`):[""];e.manufacturer=re(w.getValue(o,"Manufacturer")),e.model=re(w.getValue(o,"Product Name")),e.version=re(w.getValue(o,"Version")),e.serial=re(w.getValue(o,"Serial Number")),e.assetTag=re(w.getValue(o,"Asset Tag"));let a=`echo -n "board_asset_tag: "; cat /sys/devices/virtual/dmi/id/board_asset_tag 2>/dev/null; echo;
|
|
31
|
+
echo -n "board_name: "; cat /sys/devices/virtual/dmi/id/board_name 2>/dev/null; echo;
|
|
32
|
+
echo -n "board_serial: "; cat /sys/devices/virtual/dmi/id/board_serial 2>/dev/null; echo;
|
|
33
|
+
echo -n "board_vendor: "; cat /sys/devices/virtual/dmi/id/board_vendor 2>/dev/null; echo;
|
|
34
|
+
echo -n "board_version: "; cat /sys/devices/virtual/dmi/id/board_version 2>/dev/null; echo;`;try{o=Ts(a,w.execOptsLinux).toString().split(`
|
|
35
|
+
`),e.manufacturer=re(e.manufacturer?e.manufacturer:w.getValue(o,"board_vendor")),e.model=re(e.model?e.model:w.getValue(o,"board_name")),e.version=re(e.version?e.version:w.getValue(o,"board_version")),e.serial=re(e.serial?e.serial:w.getValue(o,"board_serial")),e.assetTag=re(e.assetTag?e.assetTag:w.getValue(o,"board_asset_tag"))}catch{w.noop()}o=n.results[1]?n.results[1].toString().split(`
|
|
36
|
+
`):[""],e.memMax=w.toInt(w.getValue(o,"Maximum Capacity"))*1024*1024*1024||null,e.memSlots=w.toInt(w.getValue(o,"Number Of Devices"))||null;let l="";try{l=Mr.readFileSync("/proc/cpuinfo").toString().split(`
|
|
37
|
+
`)}catch{w.noop()}if(l&&w.getValue(l,"hardware").startsWith("BCM")){let u=w.decodePiCpuinfo(l);e.manufacturer=u.manufacturer,e.model="Raspberry Pi",e.serial=u.serial,e.version=u.type+" - "+u.revision,e.memMax=cs.totalmem(),e.memSlots=0}s&&s(e),t(e)})}if(kr){let i=[];i.push(br("ioreg -c IOPlatformExpertDevice -d 2")),i.push(br("system_profiler SPMemoryDataType")),w.promiseAll(i).then(n=>{let o=n.results[0]?n.results[0].toString().replace(/[<>"]/g,"").split(`
|
|
38
|
+
`):[""];e.manufacturer=w.getValue(o,"manufacturer","=",!0),e.model=w.getValue(o,"model","=",!0),e.version=w.getValue(o,"version","=",!0),e.serial=w.getValue(o,"ioplatformserialnumber","=",!0),e.assetTag=w.getValue(o,"board-id","=",!0);let a=n.results[1]?n.results[1].toString().split(" BANK "):[""];a.length===1&&(a=n.results[1]?n.results[1].toString().split(" DIMM"):[""]),a.shift(),e.memSlots=a.length,cs.arch()==="arm64"&&(e.memSlots=0,e.memMax=cs.totalmem()),s&&s(e),t(e)})}if(Br&&(s&&s(e),t(e)),Fr)try{let i=[],n=parseInt(cs.release())>=10,o=n?"MaxCapacityEx":"MaxCapacity";i.push(w.powerShell("Get-CimInstance Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl")),i.push(w.powerShell(`Get-CimInstance Win32_physicalmemoryarray | select ${o}, MemoryDevices | fl`)),w.promiseAll(i).then(a=>{let l=a.results[0]?a.results[0].toString().split(`\r
|
|
39
|
+
`):[""];e.manufacturer=re(w.getValue(l,"manufacturer",":")),e.model=re(w.getValue(l,"model",":")),e.model||(e.model=re(w.getValue(l,"product",":"))),e.version=re(w.getValue(l,"version",":")),e.serial=re(w.getValue(l,"serialnumber",":")),e.assetTag=re(w.getValue(l,"partnumber",":")),e.assetTag||(e.assetTag=re(w.getValue(l,"sku",":"))),l=a.results[1]?a.results[1].toString().split(`\r
|
|
40
|
+
`):[""],e.memMax=w.toInt(w.getValue(l,o,":"))*(n?1024:1)||null,e.memSlots=w.toInt(w.getValue(l,"MemoryDevices",":"))||null,s&&s(e),t(e)})}catch{s&&s(e),t(e)}})})}rr.baseboard=Bc;function Wc(s){return s=s.toLowerCase(),s.startsWith("macbookair")?"Notebook":s.startsWith("macbookpro")?"Laptop":s.startsWith("macbook")?"Notebook":s.startsWith("macmini")||s.startsWith("imac")||s.startsWith("macstudio")?"Desktop":s.startsWith("macpro")?"Tower":"Other"}function Uc(s){let t=["Other","Unknown","Desktop","Low Profile Desktop","Pizza Box","Mini Tower","Tower","Portable","Laptop","Notebook","Hand Held","Docking Station","All in One","Sub Notebook","Space-Saving","Lunch Box","Main System Chassis","Expansion Chassis","SubChassis","Bus Expansion Chassis","Peripheral Chassis","Storage Chassis","Rack Mount Chassis","Sealed-Case PC","Multi-System Chassis","Compact PCI","Advanced TCA","Blade","Blade Enclosure","Tablet","Convertible","Detachable","IoT Gateway ","Embedded PC","Mini PC","Stick PC"];return new Promise(e=>{process.nextTick(()=>{let r={manufacturer:"",model:"",type:"",version:"",serial:"-",assetTag:"-",sku:""};if((Rr||er||tr||sr)&&Vs(`echo -n "chassis_asset_tag: "; cat /sys/devices/virtual/dmi/id/chassis_asset_tag 2>/dev/null; echo;
|
|
41
|
+
echo -n "chassis_serial: "; cat /sys/devices/virtual/dmi/id/chassis_serial 2>/dev/null; echo;
|
|
42
|
+
echo -n "chassis_type: "; cat /sys/devices/virtual/dmi/id/chassis_type 2>/dev/null; echo;
|
|
43
|
+
echo -n "chassis_vendor: "; cat /sys/devices/virtual/dmi/id/chassis_vendor 2>/dev/null; echo;
|
|
44
|
+
echo -n "chassis_version: "; cat /sys/devices/virtual/dmi/id/chassis_version 2>/dev/null; echo;`,function(n,o){let a=o.toString().split(`
|
|
45
|
+
`);r.manufacturer=re(w.getValue(a,"chassis_vendor"));let l=parseInt(w.getValue(a,"chassis_type").replace(/\D/g,""));r.type=re(l&&!isNaN(l)&&l<t.length?t[l-1]:""),r.version=re(w.getValue(a,"chassis_version")),r.serial=re(w.getValue(a,"chassis_serial")),r.assetTag=re(w.getValue(a,"chassis_asset_tag")),s&&s(r),e(r)}),kr&&Vs("ioreg -c IOPlatformExpertDevice -d 2",function(i,n){if(!i){let o=n.toString().replace(/[<>"]/g,"").split(`
|
|
46
|
+
`),a=w.getValue(o,"model","=",!0),l=w.splitByNumber(a),c=w.getValue(o,"version","=",!0);r.manufacturer=w.getValue(o,"manufacturer","=",!0),r.model=c?w.getValue(o,"model","=",!0):l[0],r.type=Wc(r.model),r.version=c||a,r.serial=w.getValue(o,"ioplatformserialnumber","=",!0),r.assetTag=w.getValue(o,"board-id","=",!0)||w.getValue(o,"target-type","=",!0),r.sku=w.getValue(o,"target-sub-type","=",!0)}s&&s(r),e(r)}),Br&&(s&&s(r),e(r)),Fr)try{w.powerShell("Get-CimInstance Win32_SystemEnclosure | select Model,Manufacturer,ChassisTypes,Version,SerialNumber,PartNumber,SKU,SMBIOSAssetTag | fl").then((i,n)=>{if(!n){let o=i.toString().split(`\r
|
|
47
|
+
`);r.manufacturer=re(w.getValue(o,"manufacturer",":")),r.model=re(w.getValue(o,"model",":"));let a=parseInt(w.getValue(o,"ChassisTypes",":").replace(/\D/g,""));r.type=a&&!isNaN(a)&&a<t.length?t[a-1]:"",r.version=re(w.getValue(o,"version",":")),r.serial=re(w.getValue(o,"serialnumber",":")),r.assetTag=re(w.getValue(o,"partnumber",":")),r.assetTag||(r.assetTag=re(w.getValue(o,"SMBIOSAssetTag",":"))),r.sku=re(w.getValue(o,"sku",":"))}s&&s(r),e(r)})}catch{s&&s(r),e(r)}})})}rr.chassis=Uc});var so=le(Ns=>{"use strict";var Ze=require("os"),Me=require("fs"),F=ce(),G=require("child_process").exec,ir=require("child_process").execSync,He=process.platform,or=He==="linux"||He==="android",qe=He==="darwin",Re=He==="win32",Nn=He==="freebsd",Dn=He==="openbsd",An=He==="netbsd",Gc=He==="sunos";function jc(){let s=new Date().toString().split(" ");return{current:Date.now(),uptime:Ze.uptime(),timezone:s.length>=7?s[5]:"",timezoneName:Intl?Intl.DateTimeFormat().resolvedOptions().timeZone:s.length>=7?s.slice(6).join(" ").replace(/\(/g,"").replace(/\)/g,""):""}}Ns.time=jc;function nr(s){s=s||"",s=s.toLowerCase();let t=He;return Re?t="windows":s.indexOf("mac os")!==-1?t="apple":s.indexOf("arch")!==-1?t="arch":s.indexOf("centos")!==-1?t="centos":s.indexOf("coreos")!==-1?t="coreos":s.indexOf("debian")!==-1?t="debian":s.indexOf("deepin")!==-1?t="deepin":s.indexOf("elementary")!==-1?t="elementary":s.indexOf("fedora")!==-1?t="fedora":s.indexOf("gentoo")!==-1?t="gentoo":s.indexOf("mageia")!==-1?t="mageia":s.indexOf("mandriva")!==-1?t="mandriva":s.indexOf("manjaro")!==-1?t="manjaro":s.indexOf("mint")!==-1?t="mint":s.indexOf("mx")!==-1?t="mx":s.indexOf("openbsd")!==-1?t="openbsd":s.indexOf("freebsd")!==-1?t="freebsd":s.indexOf("opensuse")!==-1?t="opensuse":s.indexOf("pclinuxos")!==-1?t="pclinuxos":s.indexOf("puppy")!==-1?t="puppy":s.indexOf("raspbian")!==-1?t="raspbian":s.indexOf("reactos")!==-1?t="reactos":s.indexOf("redhat")!==-1?t="redhat":s.indexOf("slackware")!==-1?t="slackware":s.indexOf("sugar")!==-1?t="sugar":s.indexOf("steam")!==-1?t="steam":s.indexOf("suse")!==-1?t="suse":s.indexOf("mate")!==-1?t="ubuntu-mate":s.indexOf("lubuntu")!==-1?t="lubuntu":s.indexOf("xubuntu")!==-1?t="xubuntu":s.indexOf("ubuntu")!==-1?t="ubuntu":s.indexOf("solaris")!==-1?t="solaris":s.indexOf("tails")!==-1?t="tails":s.indexOf("feren")!==-1?t="ferenos":s.indexOf("robolinux")!==-1?t="robolinux":or&&s&&(t=s.toLowerCase().trim().replace(/\s+/g,"-")),t}function zc(){let s=Ze.hostname;if(or||qe)try{let t=ir("hostnamectl --json short 2>/dev/null",F.execOptsLinux);s=JSON.parse(t.toString()).StaticHostname}catch{try{s=ir("hostname -f 2>/dev/null",F.execOptsLinux).toString().split(Ze.EOL)[0]}catch{F.noop()}}if(Nn||Dn||An)try{s=ir("hostname 2>/dev/null").toString().split(Ze.EOL)[0]}catch{F.noop()}if(Re)try{s=ir("echo %COMPUTERNAME%.%USERDNSDOMAIN%",F.execOptsWin).toString().replace(".%USERDNSDOMAIN%","").split(Ze.EOL)[0]}catch{F.noop()}return s}function qc(s){return new Promise(t=>{process.nextTick(()=>{let e={platform:He==="win32"?"Windows":He,distro:"unknown",release:"unknown",codename:"",kernel:Ze.release(),arch:Ze.arch(),hostname:Ze.hostname(),fqdn:zc(),codepage:"",logofile:"",serial:"",build:"",servicepack:"",uefi:!1};if(or&&G("cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release",function(r,i){let n={};i.toString().split(`
|
|
48
|
+
`).forEach(function(u){u.indexOf("=")!==-1&&(n[u.split("=")[0].trim().toUpperCase()]=u.split("=")[1].trim())}),e.distro=(n.DISTRIB_ID||n.NAME||"unknown").replace(/"/g,""),e.logofile=nr(e.distro);let a=(n.VERSION||"").replace(/"/g,""),l=(n.DISTRIB_CODENAME||n.VERSION_CODENAME||"").replace(/"/g,""),c=(n.PRETTY_NAME||"").replace(/"/g,"");c.indexOf(e.distro+" ")===0&&(a=c.replace(e.distro+" ","").trim()),a.indexOf("(")>=0&&(l=a.split("(")[1].replace(/[()]/g,"").trim(),a=a.split("(")[0].trim()),e.release=(a||n.DISTRIB_RELEASE||n.VERSION_ID||"unknown").replace(/"/g,""),e.codename=l,e.codepage=F.getCodepage(),e.build=(n.BUILD_ID||"").replace(/"/g,"").trim(),Hc().then(u=>{e.uefi=u,to().then(p=>{e.serial=p.os,s&&s(e),t(e)})})}),(Nn||Dn||An)&&G("sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml",function(r,i){let n=i.toString().split(`
|
|
49
|
+
`),o=F.getValue(n,"kern.ostype"),a=nr(o),l=F.getValue(n,"kern.osrelease").split("-")[0],c=F.getValue(n,"kern.uuid"),u=F.getValue(n,"machdep.bootmethod"),p=i.toString().indexOf("<type>efi</type>")>=0,f=u?u.toLowerCase().indexOf("uefi")>=0:p||null;e.distro=o||e.distro,e.logofile=a||e.logofile,e.release=l||e.release,e.serial=c||e.serial,e.codename="",e.codepage=F.getCodepage(),e.uefi=f||null,s&&s(e),t(e)}),qe&&G("sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid",function(r,i){let n=i.toString().split(`
|
|
50
|
+
`);e.serial=F.getValue(n,"kern.uuid"),e.distro=F.getValue(n,"ProductName"),e.release=(F.getValue(n,"ProductVersion",":",!0,!0)+" "+F.getValue(n,"ProductVersionExtra",":",!0,!0)).trim(),e.build=F.getValue(n,"BuildVersion"),e.logofile=nr(e.distro),e.codename="macOS",e.codename=e.release.indexOf("10.4")>-1?"Mac OS X Tiger":e.codename,e.codename=e.release.indexOf("10.5")>-1?"Mac OS X Leopard":e.codename,e.codename=e.release.indexOf("10.6")>-1?"Mac OS X Snow Leopard":e.codename,e.codename=e.release.indexOf("10.7")>-1?"Mac OS X Lion":e.codename,e.codename=e.release.indexOf("10.8")>-1?"OS X Mountain Lion":e.codename,e.codename=e.release.indexOf("10.9")>-1?"OS X Mavericks":e.codename,e.codename=e.release.indexOf("10.10")>-1?"OS X Yosemite":e.codename,e.codename=e.release.indexOf("10.11")>-1?"OS X El Capitan":e.codename,e.codename=e.release.indexOf("10.12")>-1?"macOS Sierra":e.codename,e.codename=e.release.indexOf("10.13")>-1?"macOS High Sierra":e.codename,e.codename=e.release.indexOf("10.14")>-1?"macOS Mojave":e.codename,e.codename=e.release.indexOf("10.15")>-1?"macOS Catalina":e.codename,e.codename=e.release.startsWith("11.")?"macOS Big Sur":e.codename,e.codename=e.release.startsWith("12.")?"macOS Monterey":e.codename,e.codename=e.release.startsWith("13.")?"macOS Ventura":e.codename,e.codename=e.release.startsWith("14.")?"macOS Sonoma":e.codename,e.codename=e.release.startsWith("15.")?"macOS Sequoia":e.codename,e.uefi=!0,e.codepage=F.getCodepage(),s&&s(e),t(e)}),Gc&&(e.release=e.kernel,G("uname -o",function(r,i){let n=i.toString().split(`
|
|
51
|
+
`);e.distro=n[0],e.logofile=nr(e.distro),s&&s(e),t(e)})),Re){e.logofile=nr(),e.release=e.kernel;try{let r=[];r.push(F.powerShell("Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl")),r.push(F.powerShell("(Get-CimInstance Win32_ComputerSystem).HypervisorPresent")),r.push(F.powerShell("Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession")),F.promiseAll(r).then(i=>{let n=i.results[0]?i.results[0].toString().split(`\r
|
|
52
|
+
`):[""];e.distro=F.getValue(n,"Caption",":").trim(),e.serial=F.getValue(n,"SerialNumber",":").trim(),e.build=F.getValue(n,"BuildNumber",":").trim(),e.servicepack=F.getValue(n,"ServicePackMajorVersion",":").trim()+"."+F.getValue(n,"ServicePackMinorVersion",":").trim(),e.codepage=F.getCodepage();let o=i.results[1]?i.results[1].toString().toLowerCase():"";e.hypervisor=o.indexOf("true")!==-1;let a=i.results[2]?i.results[2].toString():"";e.remoteSession=a.toString().toLowerCase().indexOf("true")>=0,$c().then(l=>{e.uefi=l,s&&s(e),t(e)})})}catch{s&&s(e),t(e)}}})})}Ns.osInfo=qc;function Hc(){return new Promise(s=>{process.nextTick(()=>{Me.stat("/sys/firmware/efi",function(t){if(t)G('dmesg | grep -E "EFI v"',function(e,r){if(!e){let i=r.toString().split(`
|
|
53
|
+
`);return s(i.length>0)}return s(!1)});else return s(!0)})})})}function $c(){return new Promise(s=>{process.nextTick(()=>{try{G('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"',F.execOptsWin,function(t,e){if(t)G("echo %firmware_type%",F.execOptsWin,function(r,i){if(r)return s(!1);{let n=i.toString()||"";return s(n.toLowerCase().indexOf("efi")>=0)}});else{let r=e.toString().split(`
|
|
54
|
+
\r`)[0];return s(r.toLowerCase().indexOf("efi")>=0)}})}catch{return s(!1)}})})}function Yc(s,t){let e={kernel:Ze.release(),openssl:"",systemOpenssl:"",systemOpensslLib:"",node:process.versions.node,v8:process.versions.v8,npm:"",yarn:"",pm2:"",gulp:"",grunt:"",git:"",tsc:"",mysql:"",redis:"",mongodb:"",apache:"",nginx:"",php:"",docker:"",postfix:"",postgresql:"",perl:"",python:"",python3:"",pip:"",pip3:"",java:"",gcc:"",virtualbox:"",bash:"",zsh:"",fish:"",powershell:"",dotnet:""};function r(i){if(i==="*")return{versions:e,counter:30};if(!Array.isArray(i)){i=i.trim().toLowerCase().replace(/,+/g,"|").replace(/ /g,"|"),i=i.split("|");let n={versions:{},counter:0};return i.forEach(o=>{if(o)for(let a in e)({}).hasOwnProperty.call(e,a)&&a.toLowerCase()===o.toLowerCase()&&!{}.hasOwnProperty.call(n.versions,a)&&(n.versions[a]=e[a],a==="openssl"&&(n.versions.systemOpenssl="",n.versions.systemOpensslLib=""),n.versions[a]||n.counter++)}),n}}return new Promise(i=>{process.nextTick(()=>{if(F.isFunction(s)&&!t)t=s,s="*";else if(s=s||"*",typeof s!="string")return t&&t({}),i({});let n=r(s),o=n.counter,a=function(){return function(){--o===0&&(t&&t(n.versions),i(n.versions))}}(),l="";try{if({}.hasOwnProperty.call(n.versions,"openssl")&&(n.versions.openssl=process.versions.openssl,G("openssl version",function(c,u){if(!c){let f=u.toString().split(`
|
|
55
|
+
`)[0].trim().split(" ");n.versions.systemOpenssl=f.length>0?f[1]:f[0],n.versions.systemOpensslLib=f.length>0?f[0]:"openssl"}a()})),{}.hasOwnProperty.call(n.versions,"npm")&&G("npm -v",function(c,u){c||(n.versions.npm=u.toString().split(`
|
|
56
|
+
`)[0]),a()}),{}.hasOwnProperty.call(n.versions,"pm2")&&(l="pm2",Re&&(l+=".cmd"),G(`${l} -v`,function(c,u){if(!c){let p=u.toString().split(`
|
|
57
|
+
`)[0].trim();p.startsWith("[PM2]")||(n.versions.pm2=p)}a()})),{}.hasOwnProperty.call(n.versions,"yarn")&&G("yarn --version",function(c,u){c||(n.versions.yarn=u.toString().split(`
|
|
58
|
+
`)[0]),a()}),{}.hasOwnProperty.call(n.versions,"gulp")&&(l="gulp",Re&&(l+=".cmd"),G(`${l} --version`,function(c,u){if(!c){let p=u.toString().split(`
|
|
59
|
+
`)[0]||"";n.versions.gulp=(p.toLowerCase().split("version")[1]||"").trim()}a()})),{}.hasOwnProperty.call(n.versions,"tsc")&&(l="tsc",Re&&(l+=".cmd"),G(`${l} --version`,function(c,u){if(!c){let p=u.toString().split(`
|
|
60
|
+
`)[0]||"";n.versions.tsc=(p.toLowerCase().split("version")[1]||"").trim()}a()})),{}.hasOwnProperty.call(n.versions,"grunt")&&(l="grunt",Re&&(l+=".cmd"),G(`${l} --version`,function(c,u){if(!c){let p=u.toString().split(`
|
|
61
|
+
`)[0]||"";n.versions.grunt=(p.toLowerCase().split("cli v")[1]||"").trim()}a()})),{}.hasOwnProperty.call(n.versions,"git"))if(qe){let c=Me.existsSync("/usr/local/Cellar/git")||Me.existsSync("/opt/homebrew/bin/git");F.darwinXcodeExists()||c?G("git --version",function(u,p){if(!u){let f=p.toString().split(`
|
|
62
|
+
`)[0]||"";f=(f.toLowerCase().split("version")[1]||"").trim(),n.versions.git=(f.split(" ")[0]||"").trim()}a()}):a()}else G("git --version",function(c,u){if(!c){let p=u.toString().split(`
|
|
63
|
+
`)[0]||"";p=(p.toLowerCase().split("version")[1]||"").trim(),n.versions.git=(p.split(" ")[0]||"").trim()}a()});if({}.hasOwnProperty.call(n.versions,"apache")&&G("apachectl -v 2>&1",function(c,u){if(!c){let p=(u.toString().split(`
|
|
64
|
+
`)[0]||"").split(":");n.versions.apache=p.length>1?p[1].replace("Apache","").replace("/","").split("(")[0].trim():""}a()}),{}.hasOwnProperty.call(n.versions,"nginx")&&G("nginx -v 2>&1",function(c,u){if(!c){let p=u.toString().split(`
|
|
65
|
+
`)[0]||"";n.versions.nginx=(p.toLowerCase().split("/")[1]||"").trim()}a()}),{}.hasOwnProperty.call(n.versions,"mysql")&&G("mysql -V",function(c,u){if(!c){let p=u.toString().split(`
|
|
66
|
+
`)[0]||"";if(p=p.toLowerCase(),p.indexOf(",")>-1){p=(p.split(",")[0]||"").trim();let f=p.split(" ");n.versions.mysql=(f[f.length-1]||"").trim()}else p.indexOf(" ver ")>-1&&(p=p.split(" ver ")[1],n.versions.mysql=p.split(" ")[0])}a()}),{}.hasOwnProperty.call(n.versions,"php")&&G("php -v",function(c,u){if(!c){let f=(u.toString().split(`
|
|
67
|
+
`)[0]||"").split("(");f[0].indexOf("-")&&(f=f[0].split("-")),n.versions.php=f[0].replace(/[^0-9.]/g,"")}a()}),{}.hasOwnProperty.call(n.versions,"redis")&&G("redis-server --version",function(c,u){if(!c){let f=(u.toString().split(`
|
|
68
|
+
`)[0]||"").split(" ");n.versions.redis=F.getValue(f,"v","=",!0)}a()}),{}.hasOwnProperty.call(n.versions,"docker")&&G("docker --version",function(c,u){if(!c){let f=(u.toString().split(`
|
|
69
|
+
`)[0]||"").split(" ");n.versions.docker=f.length>2&&f[2].endsWith(",")?f[2].slice(0,-1):""}a()}),{}.hasOwnProperty.call(n.versions,"postfix")&&G("postconf -d | grep mail_version",function(c,u){if(!c){let p=u.toString().split(`
|
|
70
|
+
`)||[];n.versions.postfix=F.getValue(p,"mail_version","=",!0)}a()}),{}.hasOwnProperty.call(n.versions,"mongodb")&&G("mongod --version",function(c,u){if(!c){let p=u.toString().split(`
|
|
71
|
+
`)[0]||"";n.versions.mongodb=(p.toLowerCase().split(",")[0]||"").replace(/[^0-9.]/g,"")}a()}),{}.hasOwnProperty.call(n.versions,"postgresql")&&(or?G("locate bin/postgres",function(c,u){if(c)G("psql -V",function(p,f){if(!p){let d=f.toString().split(`
|
|
72
|
+
`)[0].split(" ")||[];n.versions.postgresql=d.length?d[d.length-1]:"",n.versions.postgresql=n.versions.postgresql.split("-")[0]}a()});else{let p=u.toString().split(`
|
|
73
|
+
`).sort();p.length?G(p[p.length-1]+" -V",function(f,d){if(!f){let m=d.toString().split(`
|
|
74
|
+
`)[0].split(" ")||[];n.versions.postgresql=m.length?m[m.length-1]:""}a()}):a()}}):Re?F.powerShell("Get-CimInstance Win32_Service | select caption | fl").then(c=>{c.split(/\n\s*\n/).forEach(p=>{if(p.trim()!==""){let f=p.trim().split(`\r
|
|
75
|
+
`),d=F.getValue(f,"caption",":",!0).toLowerCase();if(d.indexOf("postgresql")>-1){let m=d.split(" server ");m.length>1&&(n.versions.postgresql=m[1])}}}),a()}):G("postgres -V",function(c,u){if(!c){let p=u.toString().split(`
|
|
76
|
+
`)[0].split(" ")||[];n.versions.postgresql=p.length?p[p.length-1]:""}a()})),{}.hasOwnProperty.call(n.versions,"perl")&&G("perl -v",function(c,u){if(!c){let p=u.toString().split(`
|
|
77
|
+
`)||"";for(;p.length>0&&p[0].trim()==="";)p.shift();p.length>0&&(n.versions.perl=p[0].split("(").pop().split(")")[0].replace("v",""))}a()}),{}.hasOwnProperty.call(n.versions,"python"))if(qe)try{let u=ir("sw_vers").toString().split(`
|
|
78
|
+
`),p=F.getValue(u,"ProductVersion",":"),f=Me.existsSync("/usr/local/Cellar/python"),d=Me.existsSync("/opt/homebrew/bin/python");F.darwinXcodeExists()&&F.semverCompare("12.0.1",p)<0||f||d?G(f?"/usr/local/Cellar/python -V 2>&1":d?"/opt/homebrew/bin/python -V 2>&1":"python -V 2>&1",function(g,_){if(!g){let h=_.toString().split(`
|
|
79
|
+
`)[0]||"";n.versions.python=h.toLowerCase().replace("python","").trim()}a()}):a()}catch{a()}else G("python -V 2>&1",function(c,u){if(!c){let p=u.toString().split(`
|
|
80
|
+
`)[0]||"";n.versions.python=p.toLowerCase().replace("python","").trim()}a()});if({}.hasOwnProperty.call(n.versions,"python3"))if(qe){let c=Me.existsSync("/usr/local/Cellar/python3")||Me.existsSync("/opt/homebrew/bin/python3");F.darwinXcodeExists()||c?G("python3 -V 2>&1",function(u,p){if(!u){let f=p.toString().split(`
|
|
81
|
+
`)[0]||"";n.versions.python3=f.toLowerCase().replace("python","").trim()}a()}):a()}else G("python3 -V 2>&1",function(c,u){if(!c){let p=u.toString().split(`
|
|
82
|
+
`)[0]||"";n.versions.python3=p.toLowerCase().replace("python","").trim()}a()});if({}.hasOwnProperty.call(n.versions,"pip"))if(qe){let c=Me.existsSync("/usr/local/Cellar/pip")||Me.existsSync("/opt/homebrew/bin/pip");F.darwinXcodeExists()||c?G("pip -V 2>&1",function(u,p){if(!u){let d=(p.toString().split(`
|
|
83
|
+
`)[0]||"").split(" ");n.versions.pip=d.length>=2?d[1]:""}a()}):a()}else G("pip -V 2>&1",function(c,u){if(!c){let f=(u.toString().split(`
|
|
84
|
+
`)[0]||"").split(" ");n.versions.pip=f.length>=2?f[1]:""}a()});if({}.hasOwnProperty.call(n.versions,"pip3"))if(qe){let c=Me.existsSync("/usr/local/Cellar/pip3")||Me.existsSync("/opt/homebrew/bin/pip3");F.darwinXcodeExists()||c?G("pip3 -V 2>&1",function(u,p){if(!u){let d=(p.toString().split(`
|
|
85
|
+
`)[0]||"").split(" ");n.versions.pip3=d.length>=2?d[1]:""}a()}):a()}else G("pip3 -V 2>&1",function(c,u){if(!c){let f=(u.toString().split(`
|
|
86
|
+
`)[0]||"").split(" ");n.versions.pip3=f.length>=2?f[1]:""}a()});({}).hasOwnProperty.call(n.versions,"java")&&(qe?G("/usr/libexec/java_home -V 2>&1",function(c,u){!c&&u.toString().toLowerCase().indexOf("no java runtime")===-1?G("java -version 2>&1",function(p,f){if(!p){let m=(f.toString().split(`
|
|
87
|
+
`)[0]||"").split('"');n.versions.java=m.length===3?m[1].trim():""}a()}):a()}):G("java -version 2>&1",function(c,u){if(!c){let f=(u.toString().split(`
|
|
88
|
+
`)[0]||"").split('"');n.versions.java=f.length===3?f[1].trim():""}a()})),{}.hasOwnProperty.call(n.versions,"gcc")&&(qe&&F.darwinXcodeExists()||!qe?G("gcc -dumpversion",function(c,u){c||(n.versions.gcc=u.toString().split(`
|
|
89
|
+
`)[0].trim()||""),n.versions.gcc.indexOf(".")>-1?a():G("gcc --version",function(p,f){if(!p){let d=f.toString().split(`
|
|
90
|
+
`)[0].trim();if(d.indexOf("gcc")>-1&&d.indexOf(")")>-1){let m=d.split(")");n.versions.gcc=m[1].trim()||n.versions.gcc}}a()})}):a()),{}.hasOwnProperty.call(n.versions,"virtualbox")&&G(F.getVboxmanage()+" -v 2>&1",function(c,u){if(!c){let f=(u.toString().split(`
|
|
91
|
+
`)[0]||"").split("r");n.versions.virtualbox=f[0]}a()}),{}.hasOwnProperty.call(n.versions,"bash")&&G("bash --version",function(c,u){if(!c){let f=u.toString().split(`
|
|
92
|
+
`)[0].split(" version ");f.length>1&&(n.versions.bash=f[1].split(" ")[0].split("(")[0])}a()}),{}.hasOwnProperty.call(n.versions,"zsh")&&G("zsh --version",function(c,u){if(!c){let f=u.toString().split(`
|
|
93
|
+
`)[0].split("zsh ");f.length>1&&(n.versions.zsh=f[1].split(" ")[0])}a()}),{}.hasOwnProperty.call(n.versions,"fish")&&G("fish --version",function(c,u){if(!c){let f=u.toString().split(`
|
|
94
|
+
`)[0].split(" version ");f.length>1&&(n.versions.fish=f[1].split(" ")[0])}a()}),{}.hasOwnProperty.call(n.versions,"powershell")&&(Re?F.powerShell("$PSVersionTable").then(c=>{let u=c.toString().split(`
|
|
95
|
+
`).map(p=>p.replace(/ +/g," ").replace(/ +/g,":"));n.versions.powershell=F.getValue(u,"psversion"),a()}):a()),{}.hasOwnProperty.call(n.versions,"dotnet")&&(Re?F.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then(c=>{let u=c.toString().split(`\r
|
|
96
|
+
`),p="";u.forEach(f=>{f=f.replace(/ +/g," ");let d=f.split(" ");p=p||(d[0].toLowerCase().startsWith("client")&&d.length>2||d[0].toLowerCase().startsWith("full")&&d.length>2?d[1].trim():"")}),n.versions.dotnet=p.trim(),a()}):a())}catch{t&&t(n.versions),i(n.versions)}})})}Ns.versions=Yc;function Xc(s){return new Promise(t=>{process.nextTick(()=>{if(Re)t("cmd");else{let e="";G("echo $SHELL",function(r,i){r||(e=i.toString().split(`
|
|
97
|
+
`)[0]),s&&s(e),t(e)})}})})}Ns.shell=Xc;function Kc(){let s=[];try{let t=Ze.networkInterfaces();for(let e in t)({}).hasOwnProperty.call(t,e)&&t[e].forEach(function(r){if(r&&r.mac&&r.mac!=="00:00:00:00:00:00"){let i=r.mac.toLowerCase();s.indexOf(i)===-1&&s.push(i)}});s=s.sort(function(e,r){return e<r?-1:e>r?1:0})}catch{s.push("00:00:00:00:00:00")}return s}function to(s){return new Promise(t=>{process.nextTick(()=>{let e={os:"",hardware:"",macs:Kc()},r;if(qe&&G("system_profiler SPHardwareDataType -json",function(i,n){if(!i)try{let o=JSON.parse(n.toString());if(o.SPHardwareDataType&&o.SPHardwareDataType.length>0){let a=o.SPHardwareDataType[0];e.os=a.platform_UUID.toLowerCase(),e.hardware=a.serial_number}}catch{F.noop()}s&&s(e),t(e)}),or&&G(`echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null ||
|
|
98
|
+
cat /etc/machine-id 2> /dev/null; echo;
|
|
99
|
+
echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`,function(n,o){let a=o.toString().split(`
|
|
100
|
+
`);if(e.os=F.getValue(a,"os").toLowerCase(),e.hardware=F.getValue(a,"hardware").toLowerCase(),!e.hardware){let l=Me.readFileSync("/proc/cpuinfo",{encoding:"utf8"}).toString().split(`
|
|
101
|
+
`),c=F.getValue(l,"serial");e.hardware=c||""}s&&s(e),t(e)}),(Nn||Dn||An)&&G("sysctl -i kern.hostid kern.hostuuid",function(i,n){let o=n.toString().split(`
|
|
102
|
+
`);e.os=F.getValue(o,"kern.hostid",":").toLowerCase(),e.hardware=F.getValue(o,"kern.hostuuid",":").toLowerCase(),e.os.indexOf("unknown")>=0&&(e.os=""),e.hardware.indexOf("unknown")>=0&&(e.hardware=""),s&&s(e),t(e)}),Re){let i="%windir%\\System32";process.arch==="ia32"&&Object.prototype.hasOwnProperty.call(process.env,"PROCESSOR_ARCHITEW6432")&&(i="%windir%\\sysnative\\cmd.exe /c %windir%\\System32"),F.powerShell("Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl").then(n=>{let o=n.split(`\r
|
|
103
|
+
`);e.hardware=F.getValue(o,"uuid",":").toLowerCase(),G(`${i}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`,F.execOptsWin,function(a,l){r=l.toString().split(`
|
|
104
|
+
\r`)[0].split("REG_SZ"),e.os=r.length>1?r[1].replace(/\r+|\n+|\s+/ig,"").toLowerCase():"",s&&s(e),t(e)})})}})})}Ns.uuid=to});var lo=le(vt=>{"use strict";var $e=require("os"),Oe=require("child_process").exec,Bn=require("child_process").execSync,Ur=require("fs"),P=ce(),St=process.platform,ar=St==="linux"||St==="android",Gr=St==="darwin",jr=St==="win32",zr=St==="freebsd",qr=St==="openbsd",Hr=St==="netbsd",$r=St==="sunos",Ds=0,K={user:0,nice:0,system:0,idle:0,irq:0,steal:0,guest:0,load:0,tick:0,ms:0,currentLoad:0,currentLoadUser:0,currentLoadSystem:0,currentLoadNice:0,currentLoadIdle:0,currentLoadIrq:0,currentLoadSteal:0,currentLoadGuest:0,rawCurrentLoad:0,rawCurrentLoadUser:0,rawCurrentLoadSystem:0,rawCurrentLoadNice:0,rawCurrentLoadIdle:0,rawCurrentLoadIrq:0,rawCurrentLoadSteal:0,rawCurrentLoadGuest:0},C=[],bn=0,Mn={8346:"1.8",8347:"1.9",8350:"2.0",8354:"2.2","8356|SE":"2.4",8356:"2.3",8360:"2.5",2372:"2.1",2373:"2.1",2374:"2.2",2376:"2.3",2377:"2.3",2378:"2.4",2379:"2.4",2380:"2.5",2381:"2.5",2382:"2.6",2384:"2.7",2386:"2.8",2387:"2.8",2389:"2.9",2393:"3.1",8374:"2.2",8376:"2.3",8378:"2.4",8379:"2.4",8380:"2.5",8381:"2.5",8382:"2.6",8384:"2.7",8386:"2.8",8387:"2.8",8389:"2.9",8393:"3.1","2419EE":"1.8","2423HE":"2.0","2425HE":"2.1",2427:"2.2",2431:"2.4",2435:"2.6","2439SE":"2.8","8425HE":"2.1",8431:"2.4",8435:"2.6","8439SE":"2.8",4122:"2.2",4130:"2.6","4162EE":"1.7","4164EE":"1.8","4170HE":"2.1","4174HE":"2.3","4176HE":"2.4",4180:"2.6",4184:"2.8","6124HE":"1.8","6128HE":"2.0","6132HE":"2.2",6128:"2.0",6134:"2.3",6136:"2.4",6140:"2.6","6164HE":"1.7","6166HE":"1.8",6168:"1.9",6172:"2.1",6174:"2.2",6176:"2.3","6176SE":"2.3","6180SE":"2.5",3250:"2.5",3260:"2.7",3280:"2.4",4226:"2.7",4228:"2.8",4230:"2.9",4234:"3.1",4238:"3.3",4240:"3.4",4256:"1.6",4274:"2.5",4276:"2.6",4280:"2.8",4284:"3.0",6204:"3.3",6212:"2.6",6220:"3.0",6234:"2.4",6238:"2.6","6262HE":"1.6",6272:"2.1",6274:"2.2",6276:"2.3",6278:"2.4","6282SE":"2.6","6284SE":"2.7",6308:"3.5",6320:"2.8",6328:"3.2","6338P":"2.3",6344:"2.6",6348:"2.8",6366:"1.8","6370P":"2.0",6376:"2.3",6378:"2.4",6380:"2.5",6386:"2.8","FX|4100":"3.6","FX|4120":"3.9","FX|4130":"3.8","FX|4150":"3.8","FX|4170":"4.2","FX|6100":"3.3","FX|6120":"3.6","FX|6130":"3.6","FX|6200":"3.8","FX|8100":"2.8","FX|8120":"3.1","FX|8140":"3.2","FX|8150":"3.6","FX|8170":"3.9","FX|4300":"3.8","FX|4320":"4.0","FX|4350":"4.2","FX|6300":"3.5","FX|6350":"3.9","FX|8300":"3.3","FX|8310":"3.4","FX|8320":"3.5","FX|8350":"4.0","FX|8370":"4.0","FX|9370":"4.4","FX|9590":"4.7","FX|8320E":"3.2","FX|8370E":"3.3",1200:"3.1","Pro 1200":"3.1","1300X":"3.5","Pro 1300":"3.5",1400:"3.2","1500X":"3.5","Pro 1500":"3.5",1600:"3.2","1600X":"3.6","Pro 1600":"3.2",1700:"3.0","Pro 1700":"3.0","1700X":"3.4","Pro 1700X":"3.4","1800X":"3.6","1900X":"3.8",1920:"3.2","1920X":"3.5","1950X":"3.4","200GE":"3.2","Pro 200GE":"3.2","220GE":"3.4","240GE":"3.5","3000G":"3.5","300GE":"3.4","3050GE":"3.4","2200G":"3.5","Pro 2200G":"3.5","2200GE":"3.2","Pro 2200GE":"3.2","2400G":"3.6","Pro 2400G":"3.6","2400GE":"3.2","Pro 2400GE":"3.2","Pro 200U":"2.3","300U":"2.4","2200U":"2.5","3200U":"2.6","2300U":"2.0","Pro 2300U":"2.0","2500U":"2.0","Pro 2500U":"2.2","2600H":"3.2","2700U":"2.0","Pro 2700U":"2.2","2800H":"3.3",7351:"2.4","7351P":"2.4",7401:"2.0","7401P":"2.0","7551P":"2.0",7551:"2.0",7251:"2.1",7261:"2.5",7281:"2.1",7301:"2.2",7371:"3.1",7451:"2.3",7501:"2.0",7571:"2.2",7601:"2.2",V1500B:"2.2",V1780B:"3.35",V1202B:"2.3",V1404I:"2.0",V1605B:"2.0",V1756B:"3.25",V1807B:"3.35",3101:"2.1",3151:"2.7",3201:"1.5",3251:"2.5",3255:"2.5",3301:"2.0",3351:"1.9",3401:"1.85",3451:"2.15","1200|AF":"3.1","2300X":"3.5","2500X":"3.6",2600:"3.4","2600E":"3.1","1600|AF":"3.2","2600X":"3.6",2700:"3.2","2700E":"2.8","Pro 2700":"3.2","2700X":"3.7","Pro 2700X":"3.6","2920X":"3.5","2950X":"3.5","2970WX":"3.0","2990WX":"3.0","Pro 300GE":"3.4","Pro 3125GE":"3.4","3150G":"3.5","Pro 3150G":"3.5","3150GE":"3.3","Pro 3150GE":"3.3","3200G":"3.6","Pro 3200G":"3.6","3200GE":"3.3","Pro 3200GE":"3.3","3350G":"3.6","Pro 3350G":"3.6","3350GE":"3.3","Pro 3350GE":"3.3","3400G":"3.7","Pro 3400G":"3.7","3400GE":"3.3","Pro 3400GE":"3.3","3300U":"2.1","PRO 3300U":"2.1","3450U":"2.1","3500U":"2.1","PRO 3500U":"2.1","3500C":"2.1","3550H":"2.1","3580U":"2.1","3700U":"2.3","PRO 3700U":"2.3","3700C":"2.3","3750H":"2.3","3780U":"2.3",3100:"3.6","3300X":"3.8",3500:"3.6","3500X":"3.6",3600:"3.6","Pro 3600":"3.6","3600X":"3.8","3600XT":"3.8","Pro 3700":"3.6","3700X":"3.6","3800X":"3.9","3800XT":"3.9",3900:"3.1","Pro 3900":"3.1","3900X":"3.8","3900XT":"3.8","3950X":"3.5","3960X":"3.8","3970X":"3.7","3990X":"2.9","3945WX":"4.0","3955WX":"3.9","3975WX":"3.5","3995WX":"2.7","4300GE":"3.5","Pro 4300GE":"3.5","4300G":"3.8","Pro 4300G":"3.8","4600GE":"3.3","Pro 4650GE":"3.3","4600G":"3.7","Pro 4650G":"3.7","4700GE":"3.1","Pro 4750GE":"3.1","4700G":"3.6","Pro 4750G":"3.6","4300U":"2.7","4450U":"2.5","Pro 4450U":"2.5","4500U":"2.3","4600U":"2.1","PRO 4650U":"2.1","4680U":"2.1","4600HS":"3.0","4600H":"3.0","4700U":"2.0","PRO 4750U":"1.7","4800U":"1.8","4800HS":"2.9","4800H":"2.9","4900HS":"3.0","4900H":"3.3","5300U":"2.6","5500U":"2.1","5700U":"1.8","7232P":"3.1","7302P":"3.0","7402P":"2.8","7502P":"2.5","7702P":"2.0",7252:"3.1",7262:"3.2",7272:"2.9",7282:"2.8",7302:"3.0",7352:"2.3",7402:"2.8",7452:"2.35",7502:"2.5",7532:"2.4",7542:"2.9",7552:"2.2",7642:"2.3",7662:"2.0",7702:"2.0",7742:"2.25","7H12":"2.6","7F32":"3.7","7F52":"3.5","7F72":"3.2","7773X":"2.2",7763:"2.45",7713:"2.0","7713P":"2.0",7663:"2.0",7643:"2.3","7573X":"2.8","75F3":"2.95",7543:"2.8","7543P":"2.8",7513:"2.6","7473X":"2.8",7453:"2.75","74F3":"3.2",7443:"2.85","7443P":"2.85",7413:"2.65","7373X":"3.05","73F3":"3.5",7343:"3.2",7313:"3.0","7313P":"3.0","72F3":"3.7","5600X":"3.7","5800X":"3.8","5900X":"3.7","5950X":"3.4","5945WX":"4.1","5955WX":"4.0","5965WX":"3.8","5975WX":"3.6","5995WX":"2.7","7960X":"4.2","7970X":"4.0","7980X":"3.2","7965WX":"4.2","7975WX":"4.0","7985WX":"3.2","7995WX":"2.5",9754:"2.25","9754S":"2.25",9734:"2.2","9684X":"2.55","9384X":"3.1","9184X":"3.55","9654P":"2.4",9654:"2.4",9634:"2.25","9554P":"3.1",9554:"3.1",9534:"2.45","9474F":"3.6","9454P":"2.75",9454:"2.75","9374F":"3.85","9354P":"3.25",9354:"3.25",9334:"2.7","9274F":"4.05",9254:"2.9",9224:"2.5","9174F":"4.1",9124:"3.0"},ro={1:"Other",2:"Unknown",3:"Daughter Board",4:"ZIF Socket",5:"Replacement/Piggy Back",6:"None",7:"LIF Socket",8:"Slot 1",9:"Slot 2",10:"370 Pin Socket",11:"Slot A",12:"Slot M",13:"423",14:"A (Socket 462)",15:"478",16:"754",17:"940",18:"939",19:"mPGA604",20:"LGA771",21:"LGA775",22:"S1",23:"AM2",24:"F (1207)",25:"LGA1366",26:"G34",27:"AM3",28:"C32",29:"LGA1156",30:"LGA1567",31:"PGA988A",32:"BGA1288",33:"rPGA988B",34:"BGA1023",35:"BGA1224",36:"LGA1155",37:"LGA1356",38:"LGA2011",39:"FS1",40:"FS2",41:"FM1",42:"FM2",43:"LGA2011-3",44:"LGA1356-3",45:"LGA1150",46:"BGA1168",47:"BGA1234",48:"BGA1364",49:"AM4",50:"LGA1151",51:"BGA1356",52:"BGA1440",53:"BGA1515",54:"LGA3647-1",55:"SP3",56:"SP3r2",57:"LGA2066",58:"BGA1392",59:"BGA1510",60:"BGA1528",61:"LGA4189",62:"LGA1200",63:"LGA4677",64:"LGA1700",65:"BGA1744",66:"BGA1781",67:"BGA1211",68:"BGA2422",69:"LGA1211",70:"LGA2422",71:"LGA5773",72:"BGA5773"},no={LGA1150:"i7-5775C i3-4340 i3-4170 G3250 i3-4160T i3-4160 E3-1231 G3258 G3240 i7-4790S i7-4790K i7-4790 i5-4690K i5-4690 i5-4590T i5-4590S i5-4590 i5-4460 i3-4360 i3-4150 G1820 G3420 G3220 i7-4771 i5-4440 i3-4330 i3-4130T i3-4130 E3-1230 i7-4770S i7-4770K i7-4770 i5-4670K i5-4670 i5-4570T i5-4570S i5-4570 i5-4430",LGA1151:"i9-9900KS E-2288G E-2224 G5420 i9-9900T i9-9900 i7-9700T i7-9700F i7-9700E i7-9700 i5-9600 i5-9500T i5-9500F i5-9500 i5-9400T i3-9350K i3-9300 i3-9100T i3-9100F i3-9100 G4930 i9-9900KF i7-9700KF i5-9600KF i5-9400F i5-9400 i3-9350KF i9-9900K i7-9700K i5-9600K G5500 G5400 i7-8700T i7-8086K i5-8600 i5-8500T i5-8500 i5-8400T i3-8300 i3-8100T G4900 i7-8700K i7-8700 i5-8600K i5-8400 i3-8350K i3-8100 E3-1270 G4600 G4560 i7-7700T i7-7700K i7-7700 i5-7600K i5-7600 i5-7500T i5-7500 i5-7400 i3-7350K i3-7300 i3-7100T i3-7100 G3930 G3900 G4400 i7-6700T i7-6700K i7-6700 i5-6600K i5-6600 i5-6500T i5-6500 i5-6400T i5-6400 i3-6300 i3-6100T i3-6100 E3-1270 E3-1270 T4500 T4400",1155:"G440 G460 G465 G470 G530T G540T G550T G1610T G1620T G530 G540 G1610 G550 G1620 G555 G1630 i3-2100T i3-2120T i3-3220T i3-3240T i3-3250T i3-2100 i3-2105 i3-2102 i3-3210 i3-3220 i3-2125 i3-2120 i3-3225 i3-2130 i3-3245 i3-3240 i3-3250 i5-3570T i5-2500T i5-2400S i5-2405S i5-2390T i5-3330S i5-2500S i5-3335S i5-2300 i5-3450S i5-3340S i5-3470S i5-3475S i5-3470T i5-2310 i5-3550S i5-2320 i5-3330 i5-3350P i5-3450 i5-2400 i5-3340 i5-3570S i5-2380P i5-2450P i5-3470 i5-2500K i5-3550 i5-2500 i5-3570 i5-3570K i5-2550K i7-3770T i7-2600S i7-3770S i7-2600K i7-2600 i7-3770 i7-3770K i7-2700K G620T G630T G640T G2020T G645T G2100T G2030T G622 G860T G620 G632 G2120T G630 G640 G2010 G840 G2020 G850 G645 G2030 G860 G2120 G870 G2130 G2140 E3-1220L E3-1220L E3-1260L E3-1265L E3-1220 E3-1225 E3-1220 E3-1235 E3-1225 E3-1230 E3-1230 E3-1240 E3-1245 E3-1270 E3-1275 E3-1240 E3-1245 E3-1270 E3-1280 E3-1275 E3-1290 E3-1280 E3-1290"};function Zc(s){let t="";for(let e in no)no[e].split(" ").forEach(i=>{s.indexOf(i)>=0&&(t=e)});return t}function kn(s){let t=s;return s=s.toLowerCase(),s.indexOf("intel")>=0&&(t="Intel"),s.indexOf("amd")>=0&&(t="AMD"),s.indexOf("qemu")>=0&&(t="QEMU"),s.indexOf("hygon")>=0&&(t="Hygon"),s.indexOf("centaur")>=0&&(t="WinChip/Via"),s.indexOf("vmware")>=0&&(t="VMware"),s.indexOf("Xen")>=0&&(t="Xen Hypervisor"),s.indexOf("tcg")>=0&&(t="QEMU"),s.indexOf("apple")>=0&&(t="Apple"),t}function Wr(s){s.brand=s.brand.replace(/\(R\)+/g,"\xAE").replace(/\s+/g," ").trim(),s.brand=s.brand.replace(/\(TM\)+/g,"\u2122").replace(/\s+/g," ").trim(),s.brand=s.brand.replace(/\(C\)+/g,"\xA9").replace(/\s+/g," ").trim(),s.brand=s.brand.replace(/CPU+/g,"").replace(/\s+/g," ").trim(),s.manufacturer=kn(s.brand);let t=s.brand.split(" ");return t.shift(),s.brand=t.join(" "),s}function Rn(s){let t="0";for(let e in Mn)if({}.hasOwnProperty.call(Mn,e)){let r=e.split("|"),i=0;r.forEach(n=>{s.indexOf(n)>-1&&i++}),i===r.length&&(t=Mn[e])}return parseFloat(t)}function Jc(){return new Promise(s=>{process.nextTick(()=>{let t="unknown",e={manufacturer:t,brand:t,vendor:"",family:"",model:"",stepping:"",revision:"",voltage:"",speed:0,speedMin:0,speedMax:0,governor:"",cores:P.cores(),physicalCores:P.cores(),performanceCores:P.cores(),efficiencyCores:0,processors:1,socket:"",flags:"",virtualization:!1,cache:{}};io().then(r=>{if(e.flags=r,e.virtualization=r.indexOf("vmx")>-1||r.indexOf("svm")>-1,Gr&&Oe("sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily",function(i,n){let o=n.toString().split(`
|
|
105
|
+
`),l=P.getValue(o,"machdep.cpu.brand_string").split("@");e.brand=l[0].trim();let c=l[1]?l[1].trim():"0";e.speed=parseFloat(c.replace(/GHz+/g,""));let u=P.getValue(o,"hw.tbfrequency")/1e9;u=u<.1?u*100:u,e.speed=e.speed===0?u:e.speed,Ds=e.speed,e=Wr(e),e.speedMin=P.getValue(o,"hw.cpufrequency_min")?P.getValue(o,"hw.cpufrequency_min")/1e9:e.speed,e.speedMax=P.getValue(o,"hw.cpufrequency_max")?P.getValue(o,"hw.cpufrequency_max")/1e9:e.speed,e.vendor=P.getValue(o,"machdep.cpu.vendor")||"Apple",e.family=P.getValue(o,"machdep.cpu.family")||P.getValue(o,"hw.cpufamily"),e.model=P.getValue(o,"machdep.cpu.model"),e.stepping=P.getValue(o,"machdep.cpu.stepping")||P.getValue(o,"hw.cpusubfamily"),e.virtualization=!0;let p=P.getValue(o,"hw.packages"),f=P.getValue(o,"hw.physicalcpu_max"),d=P.getValue(o,"hw.ncpu");if($e.arch()==="arm64"){e.socket="SOC";try{let m=Bn("ioreg -c IOPlatformDevice -d 3 -r | grep cluster-type").toString().split(`
|
|
106
|
+
`),g=m.filter(h=>h.indexOf('"E"')>=0).length,_=m.filter(h=>h.indexOf('"P"')>=0).length;e.efficiencyCores=g,e.performanceCores=_}catch{P.noop()}}p&&(e.processors=parseInt(p)||1),f&&d&&(e.cores=parseInt(d)||P.cores(),e.physicalCores=parseInt(f)||P.cores()),oo().then(m=>{e.cache=m,s(e)})}),ar){let i="",n=[];$e.cpus()[0]&&$e.cpus()[0].model&&(i=$e.cpus()[0].model),Oe('export LC_ALL=C; lscpu; echo -n "Governor: "; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null; echo; unset LC_ALL',function(o,a){o||(n=a.toString().split(`
|
|
107
|
+
`)),i=P.getValue(n,"model name")||i,i=P.getValue(n,"bios model name")||i;let l=i.split("@");if(e.brand=l[0].trim(),e.speed=l[1]?parseFloat(l[1].trim()):0,e.speed===0&&(e.brand.indexOf("AMD")>-1||e.brand.toLowerCase().indexOf("ryzen")>-1)&&(e.speed=Rn(e.brand)),e.speed===0){let g=Fn();g.avg!==0&&(e.speed=g.avg)}Ds=e.speed,e.speedMin=Math.round(parseFloat(P.getValue(n,"cpu min mhz").replace(/,/g,"."))/10)/100,e.speedMax=Math.round(parseFloat(P.getValue(n,"cpu max mhz").replace(/,/g,"."))/10)/100,e=Wr(e),e.vendor=kn(P.getValue(n,"vendor id")),e.family=P.getValue(n,"cpu family"),e.model=P.getValue(n,"model:"),e.stepping=P.getValue(n,"stepping"),e.revision=P.getValue(n,"cpu revision"),e.cache.l1d=P.getValue(n,"l1d cache"),e.cache.l1d&&(e.cache.l1d=parseInt(e.cache.l1d)*(e.cache.l1d.indexOf("M")!==-1?1024*1024:e.cache.l1d.indexOf("K")!==-1?1024:1)),e.cache.l1i=P.getValue(n,"l1i cache"),e.cache.l1i&&(e.cache.l1i=parseInt(e.cache.l1i)*(e.cache.l1i.indexOf("M")!==-1?1024*1024:e.cache.l1i.indexOf("K")!==-1?1024:1)),e.cache.l2=P.getValue(n,"l2 cache"),e.cache.l2&&(e.cache.l2=parseInt(e.cache.l2)*(e.cache.l2.indexOf("M")!==-1?1024*1024:e.cache.l2.indexOf("K")!==-1?1024:1)),e.cache.l3=P.getValue(n,"l3 cache"),e.cache.l3&&(e.cache.l3=parseInt(e.cache.l3)*(e.cache.l3.indexOf("M")!==-1?1024*1024:e.cache.l3.indexOf("K")!==-1?1024:1));let c=P.getValue(n,"thread(s) per core")||"1",u=P.getValue(n,"socket(s)")||"1",p=parseInt(c,10),f=parseInt(u,10)||1,d=parseInt(P.getValue(n,"core(s) per socket"),10);if(e.physicalCores=d?d*f:e.cores/p,e.performanceCores=p>1?e.cores-e.physicalCores:e.cores,e.efficiencyCores=p>1?e.cores-p*e.performanceCores:0,e.processors=f,e.governor=P.getValue(n,"governor")||"",e.vendor==="ARM"){let g=Ur.readFileSync("/proc/cpuinfo").toString().split(`
|
|
108
|
+
`),_=P.decodePiCpuinfo(g);_.model.toLowerCase().indexOf("raspberry")>=0&&(e.family=e.manufacturer,e.manufacturer=_.manufacturer,e.brand=_.processor,e.revision=_.revisionCode,e.socket="SOC")}let m=[];Oe('export LC_ALL=C; dmidecode \u2013t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL',function(g,_){m=_.toString().split(`
|
|
109
|
+
`),m&&m.length&&(e.socket=P.getValue(m,"Upgrade").replace("Socket","").trim()||e.socket),s(e)})})}if(zr||qr||Hr){let i="",n=[];$e.cpus()[0]&&$e.cpus()[0].model&&(i=$e.cpus()[0].model),Oe("export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL",function(o,a){let l=[];if(!o){let d=a.toString().split("# dmidecode"),m=d.length>1?d[1]:"";l=d.length>2?d[2].split("Cache Information"):[],n=m.split(`
|
|
110
|
+
`)}if(e.brand=i.split("@")[0].trim(),e.speed=i.split("@")[1]?parseFloat(i.split("@")[1].trim()):0,e.speed===0&&(e.brand.indexOf("AMD")>-1||e.brand.toLowerCase().indexOf("ryzen")>-1)&&(e.speed=Rn(e.brand)),e.speed===0){let d=Fn();d.avg!==0&&(e.speed=d.avg)}Ds=e.speed,e.speedMin=e.speed,e.speedMax=Math.round(parseFloat(P.getValue(n,"max speed").replace(/Mhz/g,""))/10)/100,e=Wr(e),e.vendor=kn(P.getValue(n,"manufacturer"));let c=P.getValue(n,"signature");c=c.split(",");for(let d=0;d<c.length;d++)c[d]=c[d].trim();e.family=P.getValue(c,"Family"," ",!0),e.model=P.getValue(c,"Model"," ",!0),e.stepping=P.getValue(c,"Stepping"," ",!0),e.revision="";let u=parseFloat(P.getValue(n,"voltage"));e.voltage=isNaN(u)?"":u.toFixed(2);for(let d=0;d<l.length;d++){n=l[d].split(`
|
|
111
|
+
`);let m=P.getValue(n,"Socket Designation").toLowerCase().replace(" ","-").split("-");m=m.length?m[0]:"";let g=P.getValue(n,"Installed Size").split(" "),_=parseInt(g[0],10),h=g.length>1?g[1]:"kb";_=_*(h==="kb"?1024:h==="mb"?1024*1024:h==="gb"?1024*1024*1024:1),m&&(m==="l1"?(e.cache[m+"d"]=_/2,e.cache[m+"i"]=_/2):e.cache[m]=_)}e.socket=P.getValue(n,"Upgrade").replace("Socket","").trim();let p=P.getValue(n,"thread count").trim(),f=P.getValue(n,"core count").trim();f&&p&&(e.cores=parseInt(p,10),e.physicalCores=parseInt(f,10)),s(e)})}if($r&&s(e),jr)try{let i=[];i.push(P.powerShell("Get-CimInstance Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl")),i.push(P.powerShell("Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl")),i.push(P.powerShell("(Get-CimInstance Win32_ComputerSystem).HypervisorPresent")),Promise.all(i).then(n=>{let o=n[0].split(`\r
|
|
112
|
+
`),a=P.getValue(o,"name",":")||"";a.indexOf("@")>=0?(e.brand=a.split("@")[0].trim(),e.speed=a.split("@")[1]?parseFloat(a.split("@")[1].trim()):0,Ds=e.speed):(e.brand=a.trim(),e.speed=0),e=Wr(e),e.revision=P.getValue(o,"revision",":"),e.vendor=P.getValue(o,"manufacturer",":"),e.speedMax=Math.round(parseFloat(P.getValue(o,"maxclockspeed",":").replace(/,/g,"."))/10)/100,e.speed===0&&(e.brand.indexOf("AMD")>-1||e.brand.toLowerCase().indexOf("ryzen")>-1)&&(e.speed=Rn(e.brand)),e.speed===0&&(e.speed=e.speedMax),e.speedMin=e.speed;let l=P.getValue(o,"description",":").split(" ");for(let g=0;g<l.length;g++)l[g].toLowerCase().startsWith("family")&&g+1<l.length&&l[g+1]&&(e.family=l[g+1]),l[g].toLowerCase().startsWith("model")&&g+1<l.length&&l[g+1]&&(e.model=l[g+1]),l[g].toLowerCase().startsWith("stepping")&&g+1<l.length&&l[g+1]&&(e.stepping=l[g+1]);let c=P.getValue(o,"UpgradeMethod",":");ro[c]&&(e.socket=ro[c]);let u=Zc(a);u&&(e.socket=u);let p=P.countLines(o,"Caption"),f=P.getValue(o,"NumberOfLogicalProcessors",":"),d=P.getValue(o,"NumberOfCores",":");p&&(e.processors=parseInt(p)||1),d&&f&&(e.cores=parseInt(f)||P.cores(),e.physicalCores=parseInt(d)||P.cores()),p>1&&(e.cores=e.cores*p,e.physicalCores=e.physicalCores*p),e.cache=ao(n[0],n[1]);let m=n[2]?n[2].toString().toLowerCase():"";e.virtualization=m.indexOf("true")!==-1,s(e)})}catch{s(e)}})})})}function Qc(s){return new Promise(t=>{process.nextTick(()=>{Jc().then(e=>{s&&s(e),t(e)})})})}vt.cpu=Qc;function Fn(){let s=$e.cpus(),t=999999999,e=0,r=0,i=[];if(s&&s.length){for(let n in s)if({}.hasOwnProperty.call(s,n)){let o=s[n].speed>100?(s[n].speed+1)/1e3:s[n].speed/10;r=r+o,o>e&&(e=o),o<t&&(t=o),i.push(parseFloat(o.toFixed(2)))}return r=r/s.length,{min:parseFloat(t.toFixed(2)),max:parseFloat(e.toFixed(2)),avg:parseFloat(r.toFixed(2)),cores:i}}else return{min:0,max:0,avg:0,cores:i}}function eu(s){return new Promise(t=>{process.nextTick(()=>{let e=Fn();if(e.avg===0&&Ds!==0){let r=parseFloat(Ds);e={min:r,max:r,avg:r,cores:[]}}s&&s(e),t(e)})})}vt.cpuCurrentSpeed=eu;function tu(s){return new Promise(t=>{process.nextTick(()=>{let e={main:null,cores:[],max:null,socket:[],chipset:null};if(ar){try{let n=Bn('cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;',P.execOptsLinux).toString().split(`-----
|
|
113
|
+
`);if(n.length===2){let o=n[0].split(`
|
|
114
|
+
`),a=n[1].split(`
|
|
115
|
+
`);for(let l=0;l<o.length;l++){let c=o[l].trim();c.startsWith("acpi")&&a[l]&&e.socket.push(Math.round(parseInt(a[l],10)/100)/10),c.startsWith("pch")&&a[l]&&(e.chipset=Math.round(parseInt(a[l],10)/100)/10)}}}catch{P.noop()}let r='for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=${label%_*}_input; echo $(cat "$label")___$(cat "$value"); fi; done; done;';try{Oe(r,function(i,n){n=n.toString();let o=n.toLowerCase().indexOf("tdie");o!==-1&&(n=n.substring(o));let a=n.split(`
|
|
116
|
+
`),l=0;if(a.forEach(c=>{let u=c.split("___"),p=u[0],f=u.length>1&&u[1]?u[1]:"0";f&&p&&p.toLowerCase()==="tctl"&&(l=e.main=Math.round(parseInt(f,10)/100)/10),f&&(p===void 0||p&&p.toLowerCase().startsWith("core"))?e.cores.push(Math.round(parseInt(f,10)/100)/10):f&&p&&e.main===null&&(p.toLowerCase().indexOf("package")>=0||p.toLowerCase().indexOf("physical")>=0||p.toLowerCase()==="tccd1")&&(e.main=Math.round(parseInt(f,10)/100)/10)}),l&&e.main===null&&(e.main=l),e.cores.length>0){e.main===null&&(e.main=Math.round(e.cores.reduce((u,p)=>u+p,0)/e.cores.length));let c=Math.max.apply(Math,e.cores);e.max=c>e.main?c:e.main}if(e.main!==null){e.max===null&&(e.max=e.main),s&&s(e),t(e);return}Oe("sensors",function(c,u){if(!c){let p=u.toString().split(`
|
|
117
|
+
`),f=null,d=!0,m="";if(p.forEach(function(g){g.trim()===""?d=!0:d&&(g.trim().toLowerCase().startsWith("acpi")&&(m="acpi"),g.trim().toLowerCase().startsWith("pch")&&(m="pch"),g.trim().toLowerCase().startsWith("core")&&(m="core"),d=!1);let _=/[+-]([^°]*)/g,h=g.match(_),y=g.split(":")[0].toUpperCase();m==="acpi"?y.indexOf("TEMP")!==-1&&e.socket.push(parseFloat(h)):m==="pch"&&y.indexOf("TEMP")!==-1&&!e.chipset&&(e.chipset=parseFloat(h)),(y.indexOf("PHYSICAL")!==-1||y.indexOf("PACKAGE")!==-1)&&(e.main=parseFloat(h)),y.indexOf("CORE ")!==-1&&e.cores.push(parseFloat(h)),y.indexOf("TDIE")!==-1&&f===null&&(f=parseFloat(h))}),e.cores.length>0){e.main=Math.round(e.cores.reduce((_,h)=>_+h,0)/e.cores.length);let g=Math.max.apply(Math,e.cores);e.max=g>e.main?g:e.main}else e.main===null&&f!==null&&(e.main=f,e.max=f);if(e.main!==null||e.max!==null){s&&s(e),t(e);return}}Ur.stat("/sys/class/thermal/thermal_zone0/temp",function(p){p===null?Ur.readFile("/sys/class/thermal/thermal_zone0/temp",function(f,d){if(!f){let m=d.toString().split(`
|
|
118
|
+
`);m.length>0&&(e.main=parseFloat(m[0])/1e3,e.max=e.main)}s&&s(e),t(e)}):Oe("/opt/vc/bin/vcgencmd measure_temp",function(f,d){if(!f){let m=d.toString().split(`
|
|
119
|
+
`);m.length>0&&m[0].indexOf("=")&&(e.main=parseFloat(m[0].split("=")[1]),e.max=e.main)}s&&s(e),t(e)})})})})}catch{s&&s(e),t(e)}}if((zr||qr||Hr)&&Oe("sysctl dev.cpu | grep temp",function(r,i){if(!r){let n=i.toString().split(`
|
|
120
|
+
`),o=0;n.forEach(function(a){let l=a.split(":");if(l.length>1){let c=parseFloat(l[1].replace(",","."));c>e.max&&(e.max=c),o=o+c,e.cores.push(c)}}),e.cores.length&&(e.main=Math.round(o/e.cores.length*100)/100)}s&&s(e),t(e)}),Gr){let r=null;try{r=require("osx-temperature-sensor")}catch{r=null}if(r&&(e=r.cpuTemperature(),e.main&&(e.main=Math.round(e.main*100)/100),e.max&&(e.max=Math.round(e.max*100)/100),e.cores&&e.cores.length))for(let i=0;i<e.cores.length;i++)e.cores[i]=Math.round(e.cores[i]*100)/100;s&&s(e),t(e)}if($r&&(s&&s(e),t(e)),jr)try{P.powerShell('Get-CimInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | Select CurrentTemperature').then((r,i)=>{if(!i){let n=0;r.split(`\r
|
|
121
|
+
`).filter(a=>a.trim()!=="").filter((a,l)=>l>0).forEach(function(a){let l=(parseInt(a,10)-2732)/10;isNaN(l)||(n=n+l,l>e.max&&(e.max=l),e.cores.push(l))}),e.cores.length&&(e.main=n/e.cores.length)}s&&s(e),t(e)})}catch{s&&s(e),t(e)}})})}vt.cpuTemperature=tu;function io(s){return new Promise(t=>{process.nextTick(()=>{let e="";if(jr)try{Oe('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet',P.execOptsWin,function(r,i){if(!r){let n=i.split("0x").pop().trim(),o=parseInt(n,16).toString(2),a="0".repeat(32-o.length)+o,l=["fpu","vme","de","pse","tsc","msr","pae","mce","cx8","apic","","sep","mtrr","pge","mca","cmov","pat","pse-36","psn","clfsh","","ds","acpi","mmx","fxsr","sse","sse2","ss","htt","tm","ia64","pbe"];for(let c=0;c<l.length;c++)a[c]==="1"&&l[c]!==""&&(e+=" "+l[c]);e=e.trim().toLowerCase()}s&&s(e),t(e)})}catch{s&&s(e),t(e)}if(ar)try{Oe("export LC_ALL=C; lscpu; unset LC_ALL",function(r,i){r||i.toString().split(`
|
|
122
|
+
`).forEach(function(o){o.split(":")[0].toUpperCase().indexOf("FLAGS")!==-1&&(e=o.split(":")[1].trim().toLowerCase())}),e?(s&&s(e),t(e)):Ur.readFile("/proc/cpuinfo",function(n,o){if(!n){let a=o.toString().split(`
|
|
123
|
+
`);e=P.getValue(a,"features",":",!0).toLowerCase()}s&&s(e),t(e)})})}catch{s&&s(e),t(e)}(zr||qr||Hr)&&Oe("export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL",function(r,i){let n=[];if(!r){let o=i.toString().split(" Flags:");(o.length>1?o[1].split(" Version:")[0].split(`
|
|
124
|
+
`):[]).forEach(function(l){let c=(l.indexOf("(")?l.split("(")[0].toLowerCase():"").trim().replace(/\t/g,"");c&&n.push(c)})}e=n.join(" ").trim().toLowerCase(),s&&s(e),t(e)}),Gr&&Oe("sysctl machdep.cpu.features",function(r,i){if(!r){let n=i.toString().split(`
|
|
125
|
+
`);n.length>0&&n[0].indexOf("machdep.cpu.features:")!==-1&&(e=n[0].split(":")[1].trim().toLowerCase())}s&&s(e),t(e)}),$r&&(s&&s(e),t(e))})})}vt.cpuFlags=io;function oo(s){return new Promise(t=>{process.nextTick(()=>{let e={l1d:null,l1i:null,l2:null,l3:null};if(ar)try{Oe("export LC_ALL=C; lscpu; unset LC_ALL",function(r,i){r||i.toString().split(`
|
|
126
|
+
`).forEach(function(o){let a=o.split(":");a[0].toUpperCase().indexOf("L1D CACHE")!==-1&&(e.l1d=parseInt(a[1].trim())*(a[1].indexOf("M")!==-1?1024*1024:a[1].indexOf("K")!==-1?1024:1)),a[0].toUpperCase().indexOf("L1I CACHE")!==-1&&(e.l1i=parseInt(a[1].trim())*(a[1].indexOf("M")!==-1?1024*1024:a[1].indexOf("K")!==-1?1024:1)),a[0].toUpperCase().indexOf("L2 CACHE")!==-1&&(e.l2=parseInt(a[1].trim())*(a[1].indexOf("M")!==-1?1024*1024:a[1].indexOf("K")!==-1?1024:1)),a[0].toUpperCase().indexOf("L3 CACHE")!==-1&&(e.l3=parseInt(a[1].trim())*(a[1].indexOf("M")!==-1?1024*1024:a[1].indexOf("K")!==-1?1024:1))}),s&&s(e),t(e)})}catch{s&&s(e),t(e)}if((zr||qr||Hr)&&Oe("export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL",function(r,i){let n=[];r||(n=i.toString().split("Cache Information"),n.shift());for(let o=0;o<n.length;o++){let a=n[o].split(`
|
|
127
|
+
`),l=P.getValue(a,"Socket Designation").toLowerCase().replace(" ","-").split("-");l=l.length?l[0]:"";let c=P.getValue(a,"Installed Size").split(" "),u=parseInt(c[0],10),p=c.length>1?c[1]:"kb";u=u*(p==="kb"?1024:p==="mb"?1024*1024:p==="gb"?1024*1024*1024:1),l&&(l==="l1"?(e.cache[l+"d"]=u/2,e.cache[l+"i"]=u/2):e.cache[l]=u)}s&&s(e),t(e)}),Gr&&Oe("sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize",function(r,i){r||i.toString().split(`
|
|
128
|
+
`).forEach(function(o){let a=o.split(":");a[0].toLowerCase().indexOf("hw.l1icachesize")!==-1&&(e.l1d=parseInt(a[1].trim())*(a[1].indexOf("K")!==-1?1024:1)),a[0].toLowerCase().indexOf("hw.l1dcachesize")!==-1&&(e.l1i=parseInt(a[1].trim())*(a[1].indexOf("K")!==-1?1024:1)),a[0].toLowerCase().indexOf("hw.l2cachesize")!==-1&&(e.l2=parseInt(a[1].trim())*(a[1].indexOf("K")!==-1?1024:1)),a[0].toLowerCase().indexOf("hw.l3cachesize")!==-1&&(e.l3=parseInt(a[1].trim())*(a[1].indexOf("K")!==-1?1024:1))}),s&&s(e),t(e)}),$r&&(s&&s(e),t(e)),jr)try{let r=[];r.push(P.powerShell("Get-CimInstance Win32_processor | select L2CacheSize, L3CacheSize | fl")),r.push(P.powerShell("Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl")),Promise.all(r).then(i=>{e=ao(i[0],i[1]),s&&s(e),t(e)})}catch{s&&s(e),t(e)}})})}function ao(s,t){let e={l1d:null,l1i:null,l2:null,l3:null},r=s.split(`\r
|
|
129
|
+
`);e.l1d=0,e.l1i=0,e.l2=P.getValue(r,"l2cachesize",":"),e.l3=P.getValue(r,"l3cachesize",":"),e.l2?e.l2=parseInt(e.l2,10)*1024:e.l2=0,e.l3?e.l3=parseInt(e.l3,10)*1024:e.l3=0;let i=t.split(/\n\s*\n/),n=0,o=0,a=0;return i.forEach(function(l){let c=l.split(`\r
|
|
130
|
+
`),u=P.getValue(c,"CacheType"),p=P.getValue(c,"Level"),f=P.getValue(c,"InstalledSize");p==="3"&&u==="3"&&(e.l1i=e.l1i+parseInt(f,10)*1024),p==="3"&&u==="4"&&(e.l1d=e.l1d+parseInt(f,10)*1024),p==="3"&&u==="5"&&(n=parseInt(f,10)/2,o=parseInt(f,10)/2),p==="4"&&u==="5"&&(a=a+parseInt(f,10)*1024)}),!e.l1i&&!e.l1d&&(e.l1i=n,e.l1d=o),a&&(e.l2=a),e}vt.cpuCache=oo;function su(){return new Promise(s=>{process.nextTick(()=>{let t=$e.loadavg().map(function(n){return n/P.cores()}),e=parseFloat(Math.max.apply(Math,t).toFixed(2)),r={};if(Date.now()-K.ms>=200){K.ms=Date.now();let n=$e.cpus().map(function(h){return h.times.steal=0,h.times.guest=0,h}),o=0,a=0,l=0,c=0,u=0,p=0,f=0,d=[];if(bn=n&&n.length?n.length:0,ar)try{let h=Bn("cat /proc/stat 2>/dev/null | grep cpu",P.execOptsLinux).toString().split(`
|
|
131
|
+
`);if(h.length>1&&(h.shift(),h.length===n.length))for(let y=0;y<h.length;y++){let S=h[y].split(" ");if(S.length>=10){let v=parseFloat(S[8])||0,x=parseFloat(S[9])||0;n[y].times.steal=v,n[y].times.guest=x}}}catch{P.noop()}for(let h=0;h<bn;h++){let y=n[h].times;o+=y.user,a+=y.sys,l+=y.nice,u+=y.idle,c+=y.irq,p+=y.steal||0,f+=y.guest||0;let S=C&&C[h]&&C[h].totalTick?C[h].totalTick:0,v=C&&C[h]&&C[h].totalLoad?C[h].totalLoad:0,x=C&&C[h]&&C[h].user?C[h].user:0,N=C&&C[h]&&C[h].sys?C[h].sys:0,T=C&&C[h]&&C[h].nice?C[h].nice:0,J=C&&C[h]&&C[h].idle?C[h].idle:0,E=C&&C[h]&&C[h].irq?C[h].irq:0,Z=C&&C[h]&&C[h].steal?C[h].steal:0,B=C&&C[h]&&C[h].guest?C[h].guest:0;C[h]=y,C[h].totalTick=C[h].user+C[h].sys+C[h].nice+C[h].irq+C[h].steal+C[h].guest+C[h].idle,C[h].totalLoad=C[h].user+C[h].sys+C[h].nice+C[h].irq+C[h].steal+C[h].guest,C[h].currentTick=C[h].totalTick-S,C[h].load=C[h].totalLoad-v,C[h].loadUser=C[h].user-x,C[h].loadSystem=C[h].sys-N,C[h].loadNice=C[h].nice-T,C[h].loadIdle=C[h].idle-J,C[h].loadIrq=C[h].irq-E,C[h].loadSteal=C[h].steal-Z,C[h].loadGuest=C[h].guest-B,d[h]={},d[h].load=C[h].load/C[h].currentTick*100,d[h].loadUser=C[h].loadUser/C[h].currentTick*100,d[h].loadSystem=C[h].loadSystem/C[h].currentTick*100,d[h].loadNice=C[h].loadNice/C[h].currentTick*100,d[h].loadIdle=C[h].loadIdle/C[h].currentTick*100,d[h].loadIrq=C[h].loadIrq/C[h].currentTick*100,d[h].loadSteal=C[h].loadSteal/C[h].currentTick*100,d[h].loadGuest=C[h].loadGuest/C[h].currentTick*100,d[h].rawLoad=C[h].load,d[h].rawLoadUser=C[h].loadUser,d[h].rawLoadSystem=C[h].loadSystem,d[h].rawLoadNice=C[h].loadNice,d[h].rawLoadIdle=C[h].loadIdle,d[h].rawLoadIrq=C[h].loadIrq,d[h].rawLoadSteal=C[h].loadSteal,d[h].rawLoadGuest=C[h].loadGuest}let m=o+a+l+c+p+f+u,g=o+a+l+c+p+f,_=m-K.tick;r={avgLoad:e,currentLoad:(g-K.load)/_*100,currentLoadUser:(o-K.user)/_*100,currentLoadSystem:(a-K.system)/_*100,currentLoadNice:(l-K.nice)/_*100,currentLoadIdle:(u-K.idle)/_*100,currentLoadIrq:(c-K.irq)/_*100,currentLoadSteal:(p-K.steal)/_*100,currentLoadGuest:(f-K.guest)/_*100,rawCurrentLoad:g-K.load,rawCurrentLoadUser:o-K.user,rawCurrentLoadSystem:a-K.system,rawCurrentLoadNice:l-K.nice,rawCurrentLoadIdle:u-K.idle,rawCurrentLoadIrq:c-K.irq,rawCurrentLoadSteal:p-K.steal,rawCurrentLoadGuest:f-K.guest,cpus:d},K={user:o,nice:l,system:a,idle:u,irq:c,steal:p,guest:f,tick:m,load:g,ms:K.ms,currentLoad:r.currentLoad,currentLoadUser:r.currentLoadUser,currentLoadSystem:r.currentLoadSystem,currentLoadNice:r.currentLoadNice,currentLoadIdle:r.currentLoadIdle,currentLoadIrq:r.currentLoadIrq,currentLoadSteal:r.currentLoadSteal,currentLoadGuest:r.currentLoadGuest,rawCurrentLoad:r.rawCurrentLoad,rawCurrentLoadUser:r.rawCurrentLoadUser,rawCurrentLoadSystem:r.rawCurrentLoadSystem,rawCurrentLoadNice:r.rawCurrentLoadNice,rawCurrentLoadIdle:r.rawCurrentLoadIdle,rawCurrentLoadIrq:r.rawCurrentLoadIrq,rawCurrentLoadSteal:r.rawCurrentLoadSteal,rawCurrentLoadGuest:r.rawCurrentLoadGuest}}else{let n=[];for(let o=0;o<bn;o++)n[o]={},n[o].load=C[o].load/C[o].currentTick*100,n[o].loadUser=C[o].loadUser/C[o].currentTick*100,n[o].loadSystem=C[o].loadSystem/C[o].currentTick*100,n[o].loadNice=C[o].loadNice/C[o].currentTick*100,n[o].loadIdle=C[o].loadIdle/C[o].currentTick*100,n[o].loadIrq=C[o].loadIrq/C[o].currentTick*100,n[o].rawLoad=C[o].load,n[o].rawLoadUser=C[o].loadUser,n[o].rawLoadSystem=C[o].loadSystem,n[o].rawLoadNice=C[o].loadNice,n[o].rawLoadIdle=C[o].loadIdle,n[o].rawLoadIrq=C[o].loadIrq,n[o].rawLoadSteal=C[o].loadSteal,n[o].rawLoadGuest=C[o].loadGuest;r={avgLoad:e,currentLoad:K.currentLoad,currentLoadUser:K.currentLoadUser,currentLoadSystem:K.currentLoadSystem,currentLoadNice:K.currentLoadNice,currentLoadIdle:K.currentLoadIdle,currentLoadIrq:K.currentLoadIrq,currentLoadSteal:K.currentLoadSteal,currentLoadGuest:K.currentLoadGuest,rawCurrentLoad:K.rawCurrentLoad,rawCurrentLoadUser:K.rawCurrentLoadUser,rawCurrentLoadSystem:K.rawCurrentLoadSystem,rawCurrentLoadNice:K.rawCurrentLoadNice,rawCurrentLoadIdle:K.rawCurrentLoadIdle,rawCurrentLoadIrq:K.rawCurrentLoadIrq,rawCurrentLoadSteal:K.rawCurrentLoadSteal,rawCurrentLoadGuest:K.rawCurrentLoadGuest,cpus:n}}s(r)})})}function ru(s){return new Promise(t=>{process.nextTick(()=>{su().then(e=>{s&&s(e),t(e)})})})}vt.currentLoad=ru;function nu(){return new Promise(s=>{process.nextTick(()=>{let t=$e.cpus(),e=0,r=0,i=0,n=0,o=0,a=0;if(t&&t.length){for(let c=0,u=t.length;c<u;c++){let p=t[c].times;e+=p.user,r+=p.sys,i+=p.nice,n+=p.irq,o+=p.idle}let l=o+n+i+r+e;a=(l-o)/l*100}s(a)})})}function iu(s){return new Promise(t=>{process.nextTick(()=>{nu().then(e=>{s&&s(e),t(e)})})})}vt.fullLoad=iu});var So=le(Wn=>{"use strict";var Je=require("os"),lr=require("child_process").exec,Yr=require("child_process").execSync,V=ce(),ou=require("fs"),xt=process.platform,po=xt==="linux"||xt==="android",fo=xt==="darwin",mo=xt==="win32",ho=xt==="freebsd",go=xt==="openbsd",yo=xt==="netbsd",_o=xt==="sunos",co={"0x014F":"Transcend Information","0x2C00":"Micron Technology Inc.","0x802C":"Micron Technology Inc.","0x80AD":"Hynix Semiconductor Inc.","0x80CE":"Samsung Electronics Inc.","0xAD00":"Hynix Semiconductor Inc.","0xCE00":"Samsung Electronics Inc.","0x02FE":"Elpida","0x5105":"Qimonda AG i. In.","0x8551":"Qimonda AG i. In.","0x859B":"Crucial","0x04CD":"G-Skill"},uo={"017A":"Apacer","0198":"HyperX","029E":"Corsair","04CB":"A-DATA","04CD":"G-Skill","059B":"Crucial","00CE":"Samsung",1315:"Crucial","014F":"Transcend Information","2C00":"Micron Technology Inc.","802C":"Micron Technology Inc.","80AD":"Hynix Semiconductor Inc.","80CE":"Samsung Electronics Inc.",AD00:"Hynix Semiconductor Inc.",CE00:"Samsung Electronics Inc.","02FE":"Elpida",5105:"Qimonda AG i. In.",8551:"Qimonda AG i. In.","859B":"Crucial"};function au(s){return new Promise(t=>{process.nextTick(()=>{let e={total:Je.totalmem(),free:Je.freemem(),used:Je.totalmem()-Je.freemem(),active:Je.totalmem()-Je.freemem(),available:Je.freemem(),buffers:0,cached:0,slab:0,buffcache:0,swaptotal:0,swapused:0,swapfree:0,writeback:null,dirty:null};if(po)try{ou.readFile("/proc/meminfo",function(r,i){if(!r){let n=i.toString().split(`
|
|
132
|
+
`);e.total=parseInt(V.getValue(n,"memtotal"),10),e.total=e.total?e.total*1024:Je.totalmem(),e.free=parseInt(V.getValue(n,"memfree"),10),e.free=e.free?e.free*1024:Je.freemem(),e.used=e.total-e.free,e.buffers=parseInt(V.getValue(n,"buffers"),10),e.buffers=e.buffers?e.buffers*1024:0,e.cached=parseInt(V.getValue(n,"cached"),10),e.cached=e.cached?e.cached*1024:0,e.slab=parseInt(V.getValue(n,"slab"),10),e.slab=e.slab?e.slab*1024:0,e.buffcache=e.buffers+e.cached+e.slab;let o=parseInt(V.getValue(n,"memavailable"),10);e.available=o?o*1024:e.free+e.buffcache,e.active=e.total-e.available,e.swaptotal=parseInt(V.getValue(n,"swaptotal"),10),e.swaptotal=e.swaptotal?e.swaptotal*1024:0,e.swapfree=parseInt(V.getValue(n,"swapfree"),10),e.swapfree=e.swapfree?e.swapfree*1024:0,e.swapused=e.swaptotal-e.swapfree,e.writeback=parseInt(V.getValue(n,"writeback"),10),e.writeback=e.writeback?e.writeback*1024:0,e.dirty=parseInt(V.getValue(n,"dirty"),10),e.dirty=e.dirty?e.dirty*1024:0}s&&s(e),t(e)})}catch{s&&s(e),t(e)}if(ho||go||yo)try{lr("/sbin/sysctl hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size",function(r,i){if(!r){let n=i.toString().split(`
|
|
133
|
+
`),o=parseInt(V.getValue(n,"vm.stats.vm.v_page_size"),10),a=parseInt(V.getValue(n,"vm.stats.vm.v_inactive_count"),10)*o,l=parseInt(V.getValue(n,"vm.stats.vm.v_cache_count"),10)*o;e.total=parseInt(V.getValue(n,"hw.realmem"),10),isNaN(e.total)&&(e.total=parseInt(V.getValue(n,"hw.physmem"),10)),e.free=parseInt(V.getValue(n,"vm.stats.vm.v_free_count"),10)*o,e.buffcache=a+l,e.available=e.buffcache+e.free,e.active=e.total-e.free-e.buffcache,e.swaptotal=0,e.swapfree=0,e.swapused=0}s&&s(e),t(e)})}catch{s&&s(e),t(e)}if(_o&&(s&&s(e),t(e)),fo){let r=4096;try{r=V.toInt(Yr("sysctl -n vm.pagesize").toString())||r}catch{V.noop()}try{lr('vm_stat 2>/dev/null | grep "Pages active"',function(i,n){if(!i){let o=n.toString().split(`
|
|
134
|
+
`);e.active=parseInt(o[0].split(":")[1],10)*r,e.buffcache=e.used-e.active,e.available=e.free+e.buffcache}lr("sysctl -n vm.swapusage 2>/dev/null",function(o,a){if(!o){let l=a.toString().split(`
|
|
135
|
+
`);l.length>0&&l[0].replace(/,/g,".").replace(/M/g,"").trim().split(" ").forEach(p=>{p.toLowerCase().indexOf("total")!==-1&&(e.swaptotal=parseFloat(p.split("=")[1].trim())*1024*1024),p.toLowerCase().indexOf("used")!==-1&&(e.swapused=parseFloat(p.split("=")[1].trim())*1024*1024),p.toLowerCase().indexOf("free")!==-1&&(e.swapfree=parseFloat(p.split("=")[1].trim())*1024*1024)})}s&&s(e),t(e)})})}catch{s&&s(e),t(e)}}if(mo){let r=0,i=0;try{V.powerShell("Get-CimInstance Win32_PageFileUsage | Select AllocatedBaseSize, CurrentUsage").then((n,o)=>{o||n.split(`\r
|
|
136
|
+
`).filter(l=>l.trim()!=="").filter((l,c)=>c>0).forEach(function(l){l!==""&&(l=l.trim().split(/\s\s+/),r=r+(parseInt(l[0],10)||0),i=i+(parseInt(l[1],10)||0))}),e.swaptotal=r*1024*1024,e.swapused=i*1024*1024,e.swapfree=e.swaptotal-e.swapused,s&&s(e),t(e)})}catch{s&&s(e),t(e)}}})})}Wn.mem=au;function lu(s){function t(r){return{}.hasOwnProperty.call(co,r)?co[r]:r}function e(r){let i=r.replace("0x","").toUpperCase();return i.length===4&&{}.hasOwnProperty.call(uo,i)?uo[i]:r}return new Promise(r=>{process.nextTick(()=>{let i=[];if((po||ho||go||yo)&&lr('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL',function(n,o){if(!n){let a=o.toString().split("Memory Device");a.shift(),a.forEach(function(l){let c=l.split(`
|
|
137
|
+
`),u=V.getValue(c,"Size"),p=u.indexOf("GB")>=0?parseInt(u,10)*1024*1024*1024:parseInt(u,10)*1024*1024,f=V.getValue(c,"Bank Locator");if(f.toLowerCase().indexOf("bad")>=0&&(f=""),parseInt(V.getValue(c,"Size"),10)>0){let d=V.toInt(V.getValue(c,"Total Width")),m=V.toInt(V.getValue(c,"Data Width"));i.push({size:p,bank:f,type:V.getValue(c,"Type:"),ecc:m&&d?d>m:!1,clockSpeed:V.getValue(c,"Configured Clock Speed:")?parseInt(V.getValue(c,"Configured Clock Speed:"),10):V.getValue(c,"Speed:")?parseInt(V.getValue(c,"Speed:"),10):null,formFactor:V.getValue(c,"Form Factor:"),manufacturer:e(V.getValue(c,"Manufacturer:")),partNum:V.getValue(c,"Part Number:"),serialNum:V.getValue(c,"Serial Number:"),voltageConfigured:parseFloat(V.getValue(c,"Configured Voltage:"))||null,voltageMin:parseFloat(V.getValue(c,"Minimum Voltage:"))||null,voltageMax:parseFloat(V.getValue(c,"Maximum Voltage:"))||null})}else i.push({size:0,bank:f,type:"Empty",ecc:null,clockSpeed:0,formFactor:V.getValue(c,"Form Factor:"),partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null})})}if(!i.length){i.push({size:Je.totalmem(),bank:"",type:"",ecc:null,clockSpeed:0,formFactor:"",partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null});try{let a=Yr("cat /proc/cpuinfo 2>/dev/null",V.execOptsLinux),l=a.toString().split(`
|
|
138
|
+
`),c=V.getValue(l,"hardware",":",!0).toUpperCase(),u=V.getValue(l,"revision",":",!0).toLowerCase();if(c==="BCM2835"||c==="BCM2708"||c==="BCM2709"||c==="BCM2835"||c==="BCM2837"){let p={0:400,1:450,2:450,3:3200};i[0].type="LPDDR2",i[0].type=u&&u[2]&&u[2]==="3"?"LPDDR4":i[0].type,i[0].ecc=!1,i[0].clockSpeed=u&&u[2]&&p[u[2]]||400,i[0].clockSpeed=u&&u[4]&&u[4]==="d"?500:i[0].clockSpeed,i[0].formFactor="SoC",a=Yr("vcgencmd get_config sdram_freq 2>/dev/null",V.execOptsLinux),l=a.toString().split(`
|
|
139
|
+
`);let f=parseInt(V.getValue(l,"sdram_freq","=",!0),10)||0;f&&(i[0].clockSpeed=f),a=Yr("vcgencmd measure_volts sdram_p 2>/dev/null",V.execOptsLinux),l=a.toString().split(`
|
|
140
|
+
`);let d=parseFloat(V.getValue(l,"volt","=",!0))||0;d&&(i[0].voltageConfigured=d,i[0].voltageMin=d,i[0].voltageMax=d)}}catch{V.noop()}}s&&s(i),r(i)}),fo&&lr("system_profiler SPMemoryDataType",function(n,o){if(!n){let a=o.toString().split(`
|
|
141
|
+
`),l=V.getValue(a,"ecc",":",!0).toLowerCase(),c=o.toString().split(" BANK "),u=!0;c.length===1&&(c=o.toString().split(" DIMM"),u=!1),c.shift(),c.forEach(function(p){let f=p.split(`
|
|
142
|
+
`),d=(u?"BANK ":"DIMM")+f[0].trim().split("/")[0],m=parseInt(V.getValue(f," Size"));m?i.push({size:m*1024*1024*1024,bank:d,type:V.getValue(f," Type:"),ecc:l?l==="enabled":null,clockSpeed:parseInt(V.getValue(f," Speed:"),10),formFactor:"",manufacturer:t(V.getValue(f," Manufacturer:")),partNum:V.getValue(f," Part Number:"),serialNum:V.getValue(f," Serial Number:"),voltageConfigured:null,voltageMin:null,voltageMax:null}):i.push({size:0,bank:d,type:"Empty",ecc:null,clockSpeed:0,formFactor:"",manufacturer:"",partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null})})}if(!i.length){let a=o.toString().split(`
|
|
143
|
+
`),l=parseInt(V.getValue(a," Memory:")),c=V.getValue(a," Type:");l&&c&&i.push({size:l*1024*1024*1024,bank:"0",type:c,ecc:!1,clockSpeed:0,formFactor:"",manufacturer:"Apple",partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null})}s&&s(i),r(i)}),_o&&(s&&s(i),r(i)),mo){let n="Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4|Logical non-volatile device|HBM|HBM2|DDR5|LPDDR5".split("|"),o="Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA".split("|");try{V.powerShell("Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage,Tag | fl").then((a,l)=>{if(!l){let c=a.toString().split(/\n\s*\n/);c.shift(),c.forEach(function(u){let p=u.split(`\r
|
|
144
|
+
`),f=V.toInt(V.getValue(p,"DataWidth",":")),d=V.toInt(V.getValue(p,"TotalWidth",":")),m=parseInt(V.getValue(p,"Capacity",":"),10)||0,g=V.getValue(p,"Tag",":"),_=V.splitByNumber(g);m&&i.push({size:m,bank:V.getValue(p,"BankLabel",":")+(_[1]?"/"+_[1]:""),type:n[parseInt(V.getValue(p,"MemoryType",":"),10)||parseInt(V.getValue(p,"SMBIOSMemoryType",":"),10)],ecc:f&&d?d>f:!1,clockSpeed:parseInt(V.getValue(p,"ConfiguredClockSpeed",":"),10)||parseInt(V.getValue(p,"Speed",":"),10)||0,formFactor:o[parseInt(V.getValue(p,"FormFactor",":"),10)||0],manufacturer:V.getValue(p,"Manufacturer",":"),partNum:V.getValue(p,"PartNumber",":"),serialNum:V.getValue(p,"SerialNumber",":"),voltageConfigured:(parseInt(V.getValue(p,"ConfiguredVoltage",":"),10)||0)/1e3,voltageMin:(parseInt(V.getValue(p,"MinVoltage",":"),10)||0)/1e3,voltageMax:(parseInt(V.getValue(p,"MaxVoltage",":"),10)||0)/1e3})})}s&&s(i),r(i)})}catch{s&&s(i),r(i)}}})})}Wn.memLayout=lu});var wo=le((em,xo)=>{"use strict";var vo=require("child_process").exec,As=require("fs"),H=ce(),wt=process.platform,cu=wt==="linux"||wt==="android",uu=wt==="darwin",pu=wt==="win32",fu=wt==="freebsd",du=wt==="openbsd",mu=wt==="netbsd",hu=wt==="sunos";function gu(s,t,e){let r={},i=H.getValue(s,"BatteryStatus",":").trim();if(i>=0){let n=i?parseInt(i):0;r.status=n,r.hasBattery=!0,r.maxCapacity=e||parseInt(H.getValue(s,"DesignCapacity",":")||0),r.designedCapacity=parseInt(H.getValue(s,"DesignCapacity",":")||t),r.voltage=parseInt(H.getValue(s,"DesignVoltage",":")||0)/1e3,r.capacityUnit="mWh",r.percent=parseInt(H.getValue(s,"EstimatedChargeRemaining",":")||0),r.currentCapacity=parseInt(r.maxCapacity*r.percent/100),r.isCharging=n>=6&&n<=9||n===11||n!==3&&n!==1&&r.percent<100,r.acConnected=r.isCharging||n===2,r.model=H.getValue(s,"DeviceID",":")}else r.status=-1;return r}xo.exports=function(s){return new Promise(t=>{process.nextTick(()=>{let e={hasBattery:!1,cycleCount:0,isCharging:!1,designedCapacity:0,maxCapacity:0,currentCapacity:0,voltage:0,capacityUnit:"",percent:0,timeRemaining:null,acConnected:!0,type:"",model:"",manufacturer:"",serial:""};if(cu){let r="";As.existsSync("/sys/class/power_supply/BAT1/uevent")?r="/sys/class/power_supply/BAT1/":As.existsSync("/sys/class/power_supply/BAT0/uevent")&&(r="/sys/class/power_supply/BAT0/");let i=!1,n="";As.existsSync("/sys/class/power_supply/AC/online")?n="/sys/class/power_supply/AC/online":As.existsSync("/sys/class/power_supply/AC0/online")&&(n="/sys/class/power_supply/AC0/online"),n&&(i=As.readFileSync(n).toString().trim()==="1"),r?As.readFile(r+"uevent",function(o,a){if(o)s&&s(e),t(e);else{let l=a.toString().split(`
|
|
145
|
+
`);e.isCharging=H.getValue(l,"POWER_SUPPLY_STATUS","=").toLowerCase()==="charging",e.acConnected=i||e.isCharging,e.voltage=parseInt("0"+H.getValue(l,"POWER_SUPPLY_VOLTAGE_NOW","="),10)/1e6,e.capacityUnit=e.voltage?"mWh":"mAh",e.cycleCount=parseInt("0"+H.getValue(l,"POWER_SUPPLY_CYCLE_COUNT","="),10),e.maxCapacity=Math.round(parseInt("0"+H.getValue(l,"POWER_SUPPLY_CHARGE_FULL","=",!0,!0),10)/1e3*(e.voltage||1));let c=parseInt("0"+H.getValue(l,"POWER_SUPPLY_VOLTAGE_MIN_DESIGN","="),10)/1e6;e.designedCapacity=Math.round(parseInt("0"+H.getValue(l,"POWER_SUPPLY_CHARGE_FULL_DESIGN","=",!0,!0),10)/1e3*(c||e.voltage||1)),e.currentCapacity=Math.round(parseInt("0"+H.getValue(l,"POWER_SUPPLY_CHARGE_NOW","="),10)/1e3*(e.voltage||1)),e.maxCapacity||(e.maxCapacity=parseInt("0"+H.getValue(l,"POWER_SUPPLY_ENERGY_FULL","=",!0,!0),10)/1e3,e.designedCapacity=parseInt("0"+H.getValue(l,"POWER_SUPPLY_ENERGY_FULL_DESIGN","=",!0,!0),10)/1e3|e.maxCapacity,e.currentCapacity=parseInt("0"+H.getValue(l,"POWER_SUPPLY_ENERGY_NOW","="),10)/1e3);let u=H.getValue(l,"POWER_SUPPLY_CAPACITY","="),p=parseInt("0"+H.getValue(l,"POWER_SUPPLY_ENERGY_NOW","="),10),f=parseInt("0"+H.getValue(l,"POWER_SUPPLY_POWER_NOW","="),10),d=parseInt("0"+H.getValue(l,"POWER_SUPPLY_CURRENT_NOW","="),10),m=parseInt("0"+H.getValue(l,"POWER_SUPPLY_CHARGE_NOW","="),10);e.percent=parseInt("0"+u,10),e.maxCapacity&&e.currentCapacity&&(e.hasBattery=!0,u||(e.percent=100*e.currentCapacity/e.maxCapacity)),e.isCharging&&(e.hasBattery=!0),p&&f?e.timeRemaining=Math.floor(p/f*60):d&&m?e.timeRemaining=Math.floor(m/d*60):d&&e.currentCapacity&&(e.timeRemaining=Math.floor(e.currentCapacity/d*60)),e.type=H.getValue(l,"POWER_SUPPLY_TECHNOLOGY","="),e.model=H.getValue(l,"POWER_SUPPLY_MODEL_NAME","="),e.manufacturer=H.getValue(l,"POWER_SUPPLY_MANUFACTURER","="),e.serial=H.getValue(l,"POWER_SUPPLY_SERIAL_NUMBER","="),s&&s(e),t(e)}}):(s&&s(e),t(e))}if((fu||du||mu)&&vo("sysctl -i hw.acpi.battery hw.acpi.acline",function(r,i){let n=i.toString().split(`
|
|
146
|
+
`),o=parseInt("0"+H.getValue(n,"hw.acpi.battery.units"),10),a=parseInt("0"+H.getValue(n,"hw.acpi.battery.life"),10);e.hasBattery=o>0,e.cycleCount=null,e.isCharging=H.getValue(n,"hw.acpi.acline")!=="1",e.acConnected=e.isCharging,e.maxCapacity=null,e.currentCapacity=null,e.capacityUnit="unknown",e.percent=o?a:null,s&&s(e),t(e)}),uu&&vo('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|BatterySerialNumber|TimeRemaining|Voltage"; pmset -g batt | grep %',function(r,i){if(i){let n=i.toString().replace(/ +/g,"").replace(/"+/g,"").replace(/-/g,"").split(`
|
|
147
|
+
`);e.cycleCount=parseInt("0"+H.getValue(n,"cyclecount","="),10),e.voltage=parseInt("0"+H.getValue(n,"voltage","="),10)/1e3,e.capacityUnit=e.voltage?"mWh":"mAh",e.maxCapacity=Math.round(parseInt("0"+H.getValue(n,"applerawmaxcapacity","="),10)*(e.voltage||1)),e.currentCapacity=Math.round(parseInt("0"+H.getValue(n,"applerawcurrentcapacity","="),10)*(e.voltage||1)),e.designedCapacity=Math.round(parseInt("0"+H.getValue(n,"DesignCapacity","="),10)*(e.voltage||1)),e.manufacturer="Apple",e.serial=H.getValue(n,"BatterySerialNumber","=");let o=null,l=H.getValue(n,"internal","Battery").split(";");if(l&&l[0]){let c=l[0].split(" ");c&&c[1]&&(o=parseFloat(c[1].trim().replace(/%/g,"")))}l&&l[1]?(e.isCharging=l[1].trim()==="charging",e.acConnected=l[1].trim()!=="discharging"):(e.isCharging=H.getValue(n,"ischarging","=").toLowerCase()==="yes",e.acConnected=e.isCharging),e.maxCapacity&&e.currentCapacity&&(e.hasBattery=!0,e.type="Li-ion",e.percent=o!==null?o:Math.round(100*e.currentCapacity/e.maxCapacity),e.isCharging||(e.timeRemaining=parseInt("0"+H.getValue(n,"TimeRemaining","="),10)))}s&&s(e),t(e)}),hu&&(s&&s(e),t(e)),pu)try{let r=[];r.push(H.powerShell("Get-CimInstance Win32_Battery | select BatteryStatus, DesignCapacity, DesignVoltage, EstimatedChargeRemaining, DeviceID | fl")),r.push(H.powerShell("(Get-WmiObject -Class BatteryStaticData -Namespace ROOT/WMI).DesignedCapacity")),r.push(H.powerShell("(Get-CimInstance -Class BatteryFullChargedCapacity -Namespace ROOT/WMI).FullChargedCapacity")),H.promiseAll(r).then(i=>{if(i){let n=i.results[0].split(/\n\s*\n/),o=[],a=u=>/\S/.test(u);for(let u=0;u<n.length;u++)a(n[u])&&(!o.length||!a(n[u-1]))&&o.push([]),a(n[u])&&o[o.length-1].push(n[u]);let l=i.results[1].split(`\r
|
|
148
|
+
`).filter(u=>u),c=i.results[2].split(`\r
|
|
149
|
+
`).filter(u=>u);if(o.length){let u=!1,p=[];for(let f=0;f<o.length;f++){let d=o[f][0].split(`\r
|
|
150
|
+
`),m=l&&l.length>=f+1&&l[f]?H.toInt(l[f]):0,g=c&&c.length>=f+1&&c[f]?H.toInt(c[f]):0,_=gu(d,m,g);!u&&_.status>0&&_.status!==10?(e.hasBattery=_.hasBattery,e.maxCapacity=_.maxCapacity,e.designedCapacity=_.designedCapacity,e.voltage=_.voltage,e.capacityUnit=_.capacityUnit,e.percent=_.percent,e.currentCapacity=_.currentCapacity,e.isCharging=_.isCharging,e.acConnected=_.acConnected,e.model=_.model,u=!0):_.status!==-1&&p.push({hasBattery:_.hasBattery,maxCapacity:_.maxCapacity,designedCapacity:_.designedCapacity,voltage:_.voltage,capacityUnit:_.capacityUnit,percent:_.percent,currentCapacity:_.currentCapacity,isCharging:_.isCharging,timeRemaining:null,acConnected:_.acConnected,model:_.model,type:"",manufacturer:"",serial:""})}!u&&p.length&&(e=p[0],p.shift()),p.length&&(e.additionalBatteries=p)}}s&&s(e),t(e)})}catch{s&&s(e),t(e)}})})}});var Eo=le(Lo=>{"use strict";var Xr=require("fs"),bs=require("child_process").exec,Un=require("child_process").execSync,b=ce(),Ct=process.platform,cr="",Kr=Ct==="linux"||Ct==="android",yu=Ct==="darwin",Co=Ct==="win32",_u=Ct==="freebsd",Su=Ct==="openbsd",vu=Ct==="netbsd",xu=Ct==="sunos",ur=0,pr=0,Zr=0,Jr=0,Oo={"-2":"UNINITIALIZED","-1":"OTHER",0:"HD15",1:"SVIDEO",2:"Composite video",3:"Component video",4:"DVI",5:"HDMI",6:"LVDS",8:"D_JPN",9:"SDI",10:"DP",11:"DP embedded",12:"UDI",13:"UDI embedded",14:"SDTVDONGLE",15:"MIRACAST","2147483648":"INTERNAL"};function Io(s){let t=[{pattern:"^LG.+",manufacturer:"LG"},{pattern:"^BENQ.+",manufacturer:"BenQ"},{pattern:"^ASUS.+",manufacturer:"Asus"},{pattern:"^DELL.+",manufacturer:"Dell"},{pattern:"^SAMSUNG.+",manufacturer:"Samsung"},{pattern:"^VIEWSON.+",manufacturer:"ViewSonic"},{pattern:"^SONY.+",manufacturer:"Sony"},{pattern:"^ACER.+",manufacturer:"Acer"},{pattern:"^AOC.+",manufacturer:"AOC Monitors"},{pattern:"^HP.+",manufacturer:"HP"},{pattern:"^EIZO.?",manufacturer:"Eizo"},{pattern:"^PHILIPS.?",manufacturer:"Philips"},{pattern:"^IIYAMA.?",manufacturer:"Iiyama"},{pattern:"^SHARP.?",manufacturer:"Sharp"},{pattern:"^NEC.?",manufacturer:"NEC"},{pattern:"^LENOVO.?",manufacturer:"Lenovo"},{pattern:"COMPAQ.?",manufacturer:"Compaq"},{pattern:"APPLE.?",manufacturer:"Apple"},{pattern:"INTEL.?",manufacturer:"Intel"},{pattern:"AMD.?",manufacturer:"AMD"},{pattern:"NVIDIA.?",manufacturer:"NVDIA"}],e="";return s&&(s=s.toUpperCase(),t.forEach(r=>{RegExp(r.pattern).test(s)&&(e=r.manufacturer)})),e}function wu(s){return{610:"Apple","1e6d":"LG","10ac":"DELL","4dd9":"Sony","38a3":"NEC"}[s]||""}function Cu(s){let t="";return s=(s||"").toLowerCase(),s.indexOf("apple")>=0?t="0x05ac":s.indexOf("nvidia")>=0?t="0x10de":s.indexOf("intel")>=0?t="0x8086":(s.indexOf("ati")>=0||s.indexOf("amd")>=0)&&(t="0x1002"),t}function Ou(s){return{spdisplays_mtlgpufamilymac1:"mac1",spdisplays_mtlgpufamilymac2:"mac2",spdisplays_mtlgpufamilyapple1:"apple1",spdisplays_mtlgpufamilyapple2:"apple2",spdisplays_mtlgpufamilyapple3:"apple3",spdisplays_mtlgpufamilyapple4:"apple4",spdisplays_mtlgpufamilyapple5:"apple5",spdisplays_mtlgpufamilyapple6:"apple6",spdisplays_mtlgpufamilyapple7:"apple7",spdisplays_metalfeaturesetfamily11:"family1_v1",spdisplays_metalfeaturesetfamily12:"family1_v2",spdisplays_metalfeaturesetfamily13:"family1_v3",spdisplays_metalfeaturesetfamily14:"family1_v4",spdisplays_metalfeaturesetfamily21:"family2_v1"}[s]||""}function Iu(s){function t(f){let d={controllers:[],displays:[]};try{return f.forEach(function(m){let g=(m.sppci_bus||"").indexOf("builtin")>-1?"Built-In":(m.sppci_bus||"").indexOf("pcie")>-1?"PCIe":"",_=(parseInt(m.spdisplays_vram||"",10)||0)*((m.spdisplays_vram||"").indexOf("GB")>-1?1024:1),h=(parseInt(m.spdisplays_vram_shared||"",10)||0)*((m.spdisplays_vram_shared||"").indexOf("GB")>-1?1024:1),y=Ou(m.spdisplays_metal||m.spdisplays_metalfamily||"");d.controllers.push({vendor:Io(m.spdisplays_vendor||"")||m.spdisplays_vendor||"",model:m.sppci_model||"",bus:g,vramDynamic:g==="Built-In",vram:_||h||null,deviceId:m["spdisplays_device-id"]||"",vendorId:m["spdisplays_vendor-id"]||Cu((m.spdisplays_vendor||"")+(m.sppci_model||"")),external:m.sppci_device_type==="spdisplays_egpu",cores:m.sppci_cores||null,metalVersion:y}),m.spdisplays_ndrvs&&m.spdisplays_ndrvs.length&&m.spdisplays_ndrvs.forEach(function(S){let v=S.spdisplays_connection_type||"",x=(S._spdisplays_resolution||"").split("@"),N=x[0].split("x"),T=(S._spdisplays_pixels||"").split("x"),J=S.spdisplays_depth||"",E=S["_spdisplays_display-serial-number"]||S["_spdisplays_display-serial-number2"]||null;d.displays.push({vendor:wu(S["_spdisplays_display-vendor-id"]||"")||Io(S._name||""),vendorId:S["_spdisplays_display-vendor-id"]||"",model:S._name||"",productionYear:S["_spdisplays_display-year"]||null,serial:E!=="0"?E:null,displayId:S._spdisplays_displayID||null,main:S.spdisplays_main?S.spdisplays_main==="spdisplays_yes":!1,builtin:(S.spdisplays_display_type||"").indexOf("built-in")>-1,connection:v.indexOf("_internal")>-1?"Internal":v.indexOf("_displayport")>-1?"Display Port":v.indexOf("_hdmi")>-1?"HDMI":null,sizeX:null,sizeY:null,pixelDepth:J==="CGSThirtyBitColor"?30:J==="CGSThirtytwoBitColor"?32:J==="CGSTwentyfourBitColor"?24:null,resolutionX:T.length>1?parseInt(T[0],10):null,resolutionY:T.length>1?parseInt(T[1],10):null,currentResX:N.length>1?parseInt(N[0],10):null,currentResY:N.length>1?parseInt(N[1],10):null,positionX:0,positionY:0,currentRefreshRate:x.length>1?parseInt(x[1],10):null})})}),d}catch{return d}}function e(f){let d=[],m={vendor:"",subVendor:"",model:"",bus:"",busAddress:"",vram:null,vramDynamic:!1,pciID:""},g=!1,_=[];try{_=Un('export LC_ALL=C; dmidecode -t 9 2>/dev/null; unset LC_ALL | grep "Bus Address: "',b.execOptsLinux).toString().split(`
|
|
151
|
+
`);for(let y=0;y<_.length;y++)_[y]=_[y].replace("Bus Address:","").replace("0000:","").trim();_=_.filter(function(y){return y!=null&&y})}catch{b.noop()}let h=1;return f.forEach(y=>{let S="";if(h<f.length&&f[h]&&(S=f[h],S.indexOf(":")>0&&(S=S.split(":")[1])),y.trim()!==""){if(y[0]!==" "&&y[0]!==" "){let v=_.indexOf(y.split(" ")[0])>=0,x=y.toLowerCase().indexOf(" vga "),N=y.toLowerCase().indexOf("3d controller");if(x!==-1||N!==-1){N!==-1&&x===-1&&(x=N),(m.vendor||m.model||m.bus||m.vram!==null||m.vramDynamic)&&(d.push(m),m={vendor:"",model:"",bus:"",busAddress:"",vram:null,vramDynamic:!1});let T=y.split(" ")[0];/[\da-fA-F]{2}:[\da-fA-F]{2}\.[\da-fA-F]/.test(T)&&(m.busAddress=T),g=!0;let J=y.search(/\[[0-9a-f]{4}:[0-9a-f]{4}]|$/),E=y.substr(x,J-x).split(":");if(m.busAddress=y.substr(0,x).trim(),E.length>1&&(E[1]=E[1].trim(),E[1].toLowerCase().indexOf("corporation")>=0?(m.vendor=E[1].substr(0,E[1].toLowerCase().indexOf("corporation")+11).trim(),m.model=E[1].substr(E[1].toLowerCase().indexOf("corporation")+11,200).split("(")[0].trim(),m.bus=_.length>0&&v?"PCIe":"Onboard",m.vram=null,m.vramDynamic=!1):E[1].toLowerCase().indexOf(" inc.")>=0?((E[1].match(/]/g)||[]).length>1?(m.vendor=E[1].substr(0,E[1].toLowerCase().indexOf("]")+1).trim(),m.model=E[1].substr(E[1].toLowerCase().indexOf("]")+1,200).trim().split("(")[0].trim()):(m.vendor=E[1].substr(0,E[1].toLowerCase().indexOf(" inc.")+5).trim(),m.model=E[1].substr(E[1].toLowerCase().indexOf(" inc.")+5,200).trim().split("(")[0].trim()),m.bus=_.length>0&&v?"PCIe":"Onboard",m.vram=null,m.vramDynamic=!1):E[1].toLowerCase().indexOf(" ltd.")>=0&&((E[1].match(/]/g)||[]).length>1?(m.vendor=E[1].substr(0,E[1].toLowerCase().indexOf("]")+1).trim(),m.model=E[1].substr(E[1].toLowerCase().indexOf("]")+1,200).trim().split("(")[0].trim()):(m.vendor=E[1].substr(0,E[1].toLowerCase().indexOf(" ltd.")+5).trim(),m.model=E[1].substr(E[1].toLowerCase().indexOf(" ltd.")+5,200).trim().split("(")[0].trim())),m.model&&S.indexOf(m.model)!==-1)){let Z=S.split(m.model)[0].trim();Z&&(m.subVendor=Z)}}else g=!1}if(g){let v=y.split(":");if(v.length>1&&v[0].replace(/ +/g,"").toLowerCase().indexOf("devicename")!==-1&&v[1].toLowerCase().indexOf("onboard")!==-1&&(m.bus="Onboard"),v.length>1&&v[0].replace(/ +/g,"").toLowerCase().indexOf("region")!==-1&&v[1].toLowerCase().indexOf("memory")!==-1){let x=v[1].split("=");x.length>1&&(m.vram=parseInt(x[1]))}}}h++}),(m.vendor||m.model||m.bus||m.busAddress||m.vram!==null||m.vramDynamic)&&d.push(m),d}function r(f,d){let m=/\[([^\]]+)\]\s+(\w+)\s+(.*)/,g=d.reduce((_,h)=>{let y=m.exec(h.trim());return y&&(_[y[1]]||(_[y[1]]={}),_[y[1]][y[2]]=y[3]),_},{});for(let _ in g){let h=g[_];if(h.CL_DEVICE_TYPE==="CL_DEVICE_TYPE_GPU"){let y;if(h.CL_DEVICE_TOPOLOGY_AMD){let S=h.CL_DEVICE_TOPOLOGY_AMD.match(/[a-zA-Z0-9]+:\d+\.\d+/);S&&(y=S[0])}else if(h.CL_DEVICE_PCI_BUS_ID_NV&&h.CL_DEVICE_PCI_SLOT_ID_NV){let S=parseInt(h.CL_DEVICE_PCI_BUS_ID_NV),v=parseInt(h.CL_DEVICE_PCI_SLOT_ID_NV);if(!isNaN(S)&&!isNaN(v)){let x=S&255,N=v>>3&255,T=v&7;y=`${x.toString().padStart(2,"0")}:${N.toString().padStart(2,"0")}.${T}`}}if(y){let S=f.find(x=>x.busAddress===y);S||(S={vendor:"",model:"",bus:"",busAddress:y,vram:null,vramDynamic:!1},f.push(S)),S.vendor=h.CL_DEVICE_VENDOR,h.CL_DEVICE_BOARD_NAME_AMD?S.model=h.CL_DEVICE_BOARD_NAME_AMD:S.model=h.CL_DEVICE_NAME;let v=parseInt(h.CL_DEVICE_GLOBAL_MEM_SIZE);isNaN(v)||(S.vram=Math.round(v/1024/1024))}}}return f}function i(){if(cr)return cr;if(Co)try{let f=b.WINDIR+"\\System32\\DriverStore\\FileRepository",m=Xr.readdirSync(f).filter(g=>Xr.readdirSync([f,g].join("/")).includes("nvidia-smi.exe")).reduce((g,_)=>{let h=Xr.statSync([f,g,"nvidia-smi.exe"].join("/")),y=Xr.statSync([f,_,"nvidia-smi.exe"].join("/"));return h.ctimeMs>y.ctimeMs?g:_});m&&(cr=[f,m,"nvidia-smi.exe"].join("/"))}catch{b.noop()}else Kr&&(cr="nvidia-smi");return cr}function n(f){let d=i();if(f=f||b.execOptsWin,d){let g=d+" "+"--query-gpu=driver_version,pci.sub_device_id,name,pci.bus_id,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu,temperature.memory,power.draw,power.limit,clocks.gr,clocks.mem --format=csv,noheader,nounits"+(Kr?" 2>/dev/null":"");Kr&&(f.stdio=["pipe","pipe","ignore"]);try{return Un(g,f).toString()}catch{b.noop()}}return""}function o(){function f(_){return[null,void 0].includes(_)?_:parseFloat(_)}let d=n();if(!d)return[];let g=d.split(`
|
|
152
|
+
`).filter(Boolean).map(_=>{let h=_.split(", ").map(y=>y.includes("N/A")?void 0:y);return h.length===16?{driverVersion:h[0],subDeviceId:h[1],name:h[2],pciBus:h[3],fanSpeed:f(h[4]),memoryTotal:f(h[5]),memoryUsed:f(h[6]),memoryFree:f(h[7]),utilizationGpu:f(h[8]),utilizationMemory:f(h[9]),temperatureGpu:f(h[10]),temperatureMemory:f(h[11]),powerDraw:f(h[12]),powerLimit:f(h[13]),clockCore:f(h[14]),clockMemory:f(h[15])}:{}});return g=g.filter(_=>"pciBus"in _),g}function a(f,d){return d.driverVersion&&(f.driverVersion=d.driverVersion),d.subDeviceId&&(f.subDeviceId=d.subDeviceId),d.name&&(f.name=d.name),d.pciBus&&(f.pciBus=d.pciBus),d.fanSpeed&&(f.fanSpeed=d.fanSpeed),d.memoryTotal&&(f.memoryTotal=d.memoryTotal,f.vram=d.memoryTotal,f.vramDynamic=!1),d.memoryUsed&&(f.memoryUsed=d.memoryUsed),d.memoryFree&&(f.memoryFree=d.memoryFree),d.utilizationGpu&&(f.utilizationGpu=d.utilizationGpu),d.utilizationMemory&&(f.utilizationMemory=d.utilizationMemory),d.temperatureGpu&&(f.temperatureGpu=d.temperatureGpu),d.temperatureMemory&&(f.temperatureMemory=d.temperatureMemory),d.powerDraw&&(f.powerDraw=d.powerDraw),d.powerLimit&&(f.powerLimit=d.powerLimit),d.clockCore&&(f.clockCore=d.clockCore),d.clockMemory&&(f.clockMemory=d.clockMemory),f}function l(f){let d={vendor:"",model:"",deviceName:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null},m=108;if(f.substr(m,6)==="000000"&&(m+=36),f.substr(m,6)==="000000"&&(m+=36),f.substr(m,6)==="000000"&&(m+=36),f.substr(m,6)==="000000"&&(m+=36),d.resolutionX=parseInt("0x0"+f.substr(m+8,1)+f.substr(m+4,2)),d.resolutionY=parseInt("0x0"+f.substr(m+14,1)+f.substr(m+10,2)),d.sizeX=parseInt("0x0"+f.substr(m+28,1)+f.substr(m+24,2)),d.sizeY=parseInt("0x0"+f.substr(m+29,1)+f.substr(m+26,2)),m=f.indexOf("000000fc00"),m>=0){let g=f.substr(m+10,26);g.indexOf("0a")!==-1&&(g=g.substr(0,g.indexOf("0a")));try{g.length>2&&(d.model=g.match(/.{1,2}/g).map(function(_){return String.fromCharCode(parseInt(_,16))}).join(""))}catch{b.noop()}}else d.model="";return d}function c(f,d){let m=[],g={vendor:"",model:"",deviceName:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null},_=!1,h=!1,y="",S=0;for(let v=1;v<f.length;v++)if(f[v].trim()!==""){if(f[v][0]!==" "&&f[v][0]!==" "&&f[v].toLowerCase().indexOf(" connected ")!==-1){(g.model||g.main||g.builtin||g.connection||g.sizeX!==null||g.pixelDepth!==null||g.resolutionX!==null)&&(m.push(g),g={vendor:"",model:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null});let x=f[v].split(" ");g.connection=x[0],g.main=f[v].toLowerCase().indexOf(" primary ")>=0,g.builtin=x[0].toLowerCase().indexOf("edp")>=0}if(_)if(f[v].search(/\S|$/)>S)y+=f[v].toLowerCase().trim();else{let x=l(y);g.vendor=x.vendor,g.model=x.model,g.resolutionX=x.resolutionX,g.resolutionY=x.resolutionY,g.sizeX=x.sizeX,g.sizeY=x.sizeY,g.pixelDepth=d,_=!1}if(f[v].toLowerCase().indexOf("edid:")>=0&&(_=!0,S=f[v].search(/\S|$/)),f[v].toLowerCase().indexOf("*current")>=0){let x=f[v].split("(");if(x&&x.length>1&&x[0].indexOf("x")>=0){let N=x[0].trim().split("x");g.currentResX=b.toInt(N[0]),g.currentResY=b.toInt(N[1])}h=!0}if(h&&f[v].toLowerCase().indexOf("clock")>=0&&f[v].toLowerCase().indexOf("hz")>=0&&f[v].toLowerCase().indexOf("v: height")>=0){let x=f[v].split("clock");x&&x.length>1&&x[1].toLowerCase().indexOf("hz")>=0&&(g.currentRefreshRate=b.toInt(x[1])),h=!1}}return(g.model||g.main||g.builtin||g.connection||g.sizeX!==null||g.pixelDepth!==null||g.resolutionX!==null)&&m.push(g),m}return new Promise(f=>{process.nextTick(()=>{let d={controllers:[],displays:[]};if(yu&&bs("system_profiler -xml -detailLevel full SPDisplaysDataType",function(g,_){if(!g){try{let h=_.toString();d=t(b.plistParser(h)[0]._items)}catch{b.noop()}try{_=Un('defaults read /Library/Preferences/com.apple.windowserver.plist 2>/dev/null;defaults read /Library/Preferences/com.apple.windowserver.displays.plist 2>/dev/null; echo ""',{maxBuffer:1024*2e4});let h=(_||"").toString(),y=b.plistReader(h);if(y.DisplayAnyUserSets&&y.DisplayAnyUserSets.Configs&&y.DisplayAnyUserSets.Configs[0]&&y.DisplayAnyUserSets.Configs[0].DisplayConfig){let S=y.DisplayAnyUserSets.Configs[0].DisplayConfig,v=0;S.forEach(x=>{x.CurrentInfo&&x.CurrentInfo.OriginX!==void 0&&d.displays&&d.displays[v]&&(d.displays[v].positionX=x.CurrentInfo.OriginX),x.CurrentInfo&&x.CurrentInfo.OriginY!==void 0&&d.displays&&d.displays[v]&&(d.displays[v].positionY=x.CurrentInfo.OriginY),v++})}if(y.DisplayAnyUserSets&&y.DisplayAnyUserSets.length>0&&y.DisplayAnyUserSets[0].length>0&&y.DisplayAnyUserSets[0][0].DisplayID){let S=y.DisplayAnyUserSets[0],v=0;S.forEach(x=>{"OriginX"in x&&d.displays&&d.displays[v]&&(d.displays[v].positionX=x.OriginX),"OriginY"in x&&d.displays&&d.displays[v]&&(d.displays[v].positionY=x.OriginY),x.Mode&&x.Mode.BitsPerPixel!==void 0&&d.displays&&d.displays[v]&&(d.displays[v].pixelDepth=x.Mode.BitsPerPixel),v++})}}catch{b.noop()}}s&&s(d),f(d)}),Kr&&(b.isRaspberry()&&b.isRaspbian()?bs(`fbset -s | grep 'mode "'; vcgencmd get_mem gpu; tvservice -s; tvservice -n;`,function(g,_){let h=_.toString().split(`
|
|
153
|
+
`);if(h.length>3&&h[0].indexOf('mode "')>=-1&&h[2].indexOf("0x12000a")>-1){let y=h[0].replace("mode","").replace(/"/g,"").trim().split("x");y.length===2&&d.displays.push({vendor:"",model:b.getValue(h,"device_name","="),main:!0,builtin:!1,connection:"HDMI",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:parseInt(y[0],10),resolutionY:parseInt(y[1],10),currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null})}h.length>1&&_.toString().indexOf("gpu=")>=-1&&d.controllers.push({vendor:"Broadcom",model:b.getRpiGpu(),bus:"",vram:b.getValue(h,"gpu","=").replace("M",""),vramDynamic:!0}),s&&s(d),f(d)}):bs("lspci -vvv 2>/dev/null",function(g,_){if(!g){let y=_.toString().split(`
|
|
154
|
+
`);d.controllers=e(y);let S=o();d.controllers=d.controllers.map(v=>a(v,S.find(x=>x.pciBus.toLowerCase().endsWith(v.busAddress.toLowerCase()))||{}))}bs("clinfo --raw",function(y,S){if(!y){let x=S.toString().split(`
|
|
155
|
+
`);d.controllers=r(d.controllers,x)}bs("xdpyinfo 2>/dev/null | grep 'depth of root window' | awk '{ print $5 }'",function(x,N){let T=0;if(!x){let E=N.toString().split(`
|
|
156
|
+
`);T=parseInt(E[0])||0}bs("xrandr --verbose 2>/dev/null",function(E,Z){if(!E){let B=Z.toString().split(`
|
|
157
|
+
`);d.displays=c(B,T)}s&&s(d),f(d)})})})})),(_u||Su||vu)&&(s&&s(null),f(null)),xu&&(s&&s(null),f(null)),Co)try{let m=[];m.push(b.powerShell("Get-CimInstance win32_VideoController | fl *")),m.push(b.powerShell('gp "HKLM:\\SYSTEM\\ControlSet001\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}\\*" -ErrorAction SilentlyContinue | where MatchingDeviceId $null -NE | select MatchingDeviceId,HardwareInformation.qwMemorySize | fl')),m.push(b.powerShell("Get-CimInstance win32_desktopmonitor | fl *")),m.push(b.powerShell("Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorBasicDisplayParams | fl")),m.push(b.powerShell("Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens")),m.push(b.powerShell("Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorConnectionParams | fl")),m.push(b.powerShell('gwmi WmiMonitorID -Namespace root\\wmi | ForEach-Object {(($_.ManufacturerName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.ProductCodeID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.UserFriendlyName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.SerialNumberID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + $_.InstanceName}'));let g=o();Promise.all(m).then(_=>{let h=_[0].replace(/\r/g,"").split(/\n\s*\n/),y=_[1].replace(/\r/g,"").split(/\n\s*\n/);d.controllers=u(h,y),d.controllers=d.controllers.map(E=>E.vendor.toLowerCase()==="nvidia"?a(E,g.find(Z=>{let B=(E.subDeviceId||"").toLowerCase(),ae=Z.subDeviceId.split("x"),fe=ae.length>1?ae[1].toLowerCase():ae[0].toLowerCase(),_e=Math.abs(B.length-fe.length);if(B.length>fe.length)for(let X=0;X<_e;X++)fe="0"+fe;else if(B.length<fe.length)for(let X=0;X<_e;X++)B="0"+B;return B===fe})||{}):E);let S=_[2].replace(/\r/g,"").split(/\n\s*\n/);S[0].trim()===""&&S.shift(),S.length&&S[S.length-1].trim()===""&&S.pop();let v=_[3].replace(/\r/g,"").split("Active ");v.shift();let x=_[4].replace(/\r/g,"").split("BitsPerPixel ");x.shift();let N=_[5].replace(/\r/g,"").split(/\n\s*\n/);N.shift();let T=_[6].replace(/\r/g,"").split(/\n/),J=[];T.forEach(E=>{let Z=E.split("|");Z.length===5&&J.push({vendor:Z[0],code:Z[1],model:Z[2],serial:Z[3],instanceId:Z[4]})}),d.displays=p(x,v,S,N,J),d.displays.length===1&&(ur&&(d.displays[0].resolutionX=ur,d.displays[0].currentResX||(d.displays[0].currentResX=ur)),pr&&(d.displays[0].resolutionY=pr,d.displays[0].currentResY===0&&(d.displays[0].currentResY=pr)),Zr&&(d.displays[0].pixelDepth=Zr)),d.displays=d.displays.map(E=>(Jr&&!E.currentRefreshRate&&(E.currentRefreshRate=Jr),E)),s&&s(d),f(d)}).catch(()=>{s&&s(d),f(d)})}catch{s&&s(d),f(d)}})});function u(f,d){let m={};for(let _ in d)if({}.hasOwnProperty.call(d,_)&&d[_].trim()!==""){let h=d[_].trim().split(`
|
|
158
|
+
`),y=b.getValue(h,"MatchingDeviceId").match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i);if(y){let S=parseInt(b.getValue(h,"HardwareInformation.qwMemorySize"));if(!isNaN(S)){let v=y[1].toUpperCase()+"&"+y[2].toUpperCase();y[3]&&(v+="&"+y[3].toUpperCase()),y[4]&&(v+="&"+y[4].toUpperCase()),m[v]=S}}}let g=[];for(let _ in f)if({}.hasOwnProperty.call(f,_)&&f[_].trim()!==""){let h=f[_].trim().split(`
|
|
159
|
+
`),y=b.getValue(h,"PNPDeviceID",":").match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i),S=null,v=null;if(y){if(S=y[3]||"",S&&(S=S.split("_")[1]),v==null&&y[3]&&y[4]){let x=y[1].toUpperCase()+"&"+y[2].toUpperCase()+"&"+y[3].toUpperCase()+"&"+y[4].toUpperCase();({}).hasOwnProperty.call(m,x)&&(v=m[x])}if(v==null&&y[3]){let x=y[1].toUpperCase()+"&"+y[2].toUpperCase()+"&"+y[3].toUpperCase();({}).hasOwnProperty.call(m,x)&&(v=m[x])}if(v==null&&y[4]){let x=y[1].toUpperCase()+"&"+y[2].toUpperCase()+"&"+y[4].toUpperCase();({}).hasOwnProperty.call(m,x)&&(v=m[x])}if(v==null){let x=y[1].toUpperCase()+"&"+y[2].toUpperCase();({}).hasOwnProperty.call(m,x)&&(v=m[x])}}g.push({vendor:b.getValue(h,"AdapterCompatibility",":"),model:b.getValue(h,"name",":"),bus:b.getValue(h,"PNPDeviceID",":").startsWith("PCI")?"PCI":"",vram:(v??b.toInt(b.getValue(h,"AdapterRAM",":")))/1024/1024,vramDynamic:b.getValue(h,"VideoMemoryType",":")==="2",subDeviceId:S}),ur=b.toInt(b.getValue(h,"CurrentHorizontalResolution",":"))||ur,pr=b.toInt(b.getValue(h,"CurrentVerticalResolution",":"))||pr,Jr=b.toInt(b.getValue(h,"CurrentRefreshRate",":"))||Jr,Zr=b.toInt(b.getValue(h,"CurrentBitsPerPixel",":"))||Zr}return g}function p(f,d,m,g,_){let h=[],y="",S="",v="",x=0,N=0;if(m&&m.length){let T=m[0].split(`
|
|
160
|
+
`);y=b.getValue(T,"MonitorManufacturer",":"),S=b.getValue(T,"Name",":"),v=b.getValue(T,"PNPDeviceID",":").replace(/&/g,"&").toLowerCase(),x=b.toInt(b.getValue(T,"ScreenWidth",":")),N=b.toInt(b.getValue(T,"ScreenHeight",":"))}for(let T=0;T<f.length;T++)if(f[T].trim()!==""){f[T]="BitsPerPixel "+f[T],d[T]="Active "+d[T],(g.length===0||g[T]===void 0)&&(g[T]="Unknown");let J=f[T].split(`
|
|
161
|
+
`),E=d[T].split(`
|
|
162
|
+
`),Z=g[T].split(`
|
|
163
|
+
`),B=b.getValue(J,"BitsPerPixel"),ae=b.getValue(J,"Bounds").replace("{","").replace("}","").replace(/=/g,":").split(","),fe=b.getValue(J,"Primary"),_e=b.getValue(E,"MaxHorizontalImageSize"),X=b.getValue(E,"MaxVerticalImageSize"),Se=b.getValue(E,"InstanceName").toLowerCase(),de=b.getValue(Z,"VideoOutputTechnology"),De=b.getValue(J,"DeviceName"),Pe="",ne="";_.forEach(ie=>{ie.instanceId.toLowerCase().startsWith(Se)&&y.startsWith("(")&&S.startsWith("PnP")&&(Pe=ie.vendor,ne=ie.model)}),h.push({vendor:Se.startsWith(v)&&Pe===""?y:Pe,model:Se.startsWith(v)&&ne===""?S:ne,deviceName:De,main:fe.toLowerCase()==="true",builtin:de==="2147483648",connection:de&&Oo[de]?Oo[de]:"",resolutionX:b.toInt(b.getValue(ae,"Width",":")),resolutionY:b.toInt(b.getValue(ae,"Height",":")),sizeX:_e?parseInt(_e,10):null,sizeY:X?parseInt(X,10):null,pixelDepth:B,currentResX:b.toInt(b.getValue(ae,"Width",":")),currentResY:b.toInt(b.getValue(ae,"Height",":")),positionX:b.toInt(b.getValue(ae,"X",":")),positionY:b.toInt(b.getValue(ae,"Y",":"))})}return f.length===0&&h.push({vendor:y,model:S,main:!0,sizeX:null,sizeY:null,resolutionX:x,resolutionY:N,pixelDepth:null,currentResX:x,currentResY:N,positionX:0,positionY:0}),h}}Lo.graphics=Iu});var Do=le(us=>{"use strict";var O=ce(),Po=require("fs"),xe=require("child_process").exec,Ot=require("child_process").execSync,Lu=O.promisifySave(require("child_process").exec),Lt=process.platform,ke=Lt==="linux"||Lt==="android",It=Lt==="darwin",Ms=Lt==="win32",Fe=Lt==="freebsd",Be=Lt==="openbsd",We=Lt==="netbsd",Rs=Lt==="sunos",se={},W={};function Eu(s,t){O.isFunction(s)&&(t=s,s="");let e=[],r=[];function i(l){if(!l.startsWith("/"))return"NFS";let c=l.split("/"),u=c[c.length-1],p=e.filter(f=>f.indexOf(u)>=0);return p.length===1&&p[0].indexOf("APFS")>=0?"APFS":"HFS"}function n(l){let c=["rootfs","unionfs","squashfs","cramfs","initrd","initramfs","devtmpfs","tmpfs","udev","devfs","specfs","type","appimaged"],u=!1;return c.forEach(p=>{l.toLowerCase().indexOf(p)>=0&&(u=!0)}),u}function o(l){let c=l.toString().split(`
|
|
164
|
+
`);if(c.shift(),l.toString().toLowerCase().indexOf("filesystem")){let u=0;for(let p=0;p<c.length;p++)c[p]&&c[p].toLowerCase().startsWith("filesystem")&&(u=p);for(let p=0;p<u;p++)c.shift()}return c}function a(l){let c=[];return l.forEach(function(u){if(u!==""&&(u=u.replace(/ +/g," ").split(" "),u&&(u[0].startsWith("/")||u[6]&&u[6]==="/"||u[0].indexOf("/")>0||u[0].indexOf(":")===1||!It&&!n(u[1])))){let p=u[0],f=ke||Fe||Be||We?u[1]:i(u[0]),d=parseInt(ke||Fe||Be||We?u[2]:u[1])*1024,m=parseInt(ke||Fe||Be||We?u[3]:u[2])*1024,g=parseInt(ke||Fe||Be||We?u[4]:u[3])*1024,_=parseFloat((100*(m/(m+g))).toFixed(2)),h=r&&Object.keys(r).length>0?r[p]||!1:null;u.splice(0,ke||Fe||Be||We?6:5);let y=u.join(" ");c.find(S=>S.fs===p&&S.type===f)||c.push({fs:p,type:f,size:d,used:m,available:g,use:_,mount:y,rw:h})}}),c}return new Promise(l=>{process.nextTick(()=>{let c=[];if(ke||Fe||Be||We||It){let u="";if(e=[],r={},It){u="df -kP";try{e=Ot("diskutil list").toString().split(`
|
|
165
|
+
`).filter(p=>!p.startsWith("/")&&p.indexOf(":")>0),Ot("mount").toString().split(`
|
|
166
|
+
`).filter(p=>p.startsWith("/")).forEach(p=>{r[p.split(" ")[0]]=p.toLowerCase().indexOf("read-only")===-1})}catch{O.noop()}}if(ke)try{u="export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL",Ot("cat /proc/mounts 2>/dev/null",O.execOptsLinux).toString().split(`
|
|
167
|
+
`).filter(p=>p.startsWith("/")).forEach(p=>{r[p.split(" ")[0]]=r[p.split(" ")[0]]||!1,p.toLowerCase().indexOf("/snap/")===-1&&(r[p.split(" ")[0]]=p.toLowerCase().indexOf("rw,")>=0||p.toLowerCase().indexOf(" rw ")>=0)})}catch{O.noop()}if(Fe||Be||We)try{u="df -lkPT",Ot("mount").toString().split(`
|
|
168
|
+
`).forEach(p=>{r[p.split(" ")[0]]=p.toLowerCase().indexOf("read-only")===-1})}catch{O.noop()}xe(u,{maxBuffer:1024*1024},function(p,f){let d=o(f);c=a(d),s&&(c=c.filter(m=>m.fs.toLowerCase().indexOf(s.toLowerCase())>=0||m.mount.toLowerCase().indexOf(s.toLowerCase())>=0)),(!p||c.length)&&f.toString().trim()!==""?(t&&t(c),l(c)):xe("df -kPT",{maxBuffer:1024*1024},function(m,g){if(!m){let _=o(g);c=a(_)}t&&t(c),l(c)})})}if(Rs&&(t&&t(c),l(c)),Ms)try{let u=`Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size ${s?"| where -property Caption -eq "+s:""} | fl`;O.powerShell(u).then((p,f)=>{f||p.toString().split(/\n\s*\n/).forEach(function(m){let g=m.split(`\r
|
|
169
|
+
`),_=O.toInt(O.getValue(g,"size",":")),h=O.toInt(O.getValue(g,"freespace",":")),y=O.getValue(g,"caption",":"),S=O.getValue(g,"access",":"),v=S?O.toInt(S)!==1:null;_&&c.push({fs:y,type:O.getValue(g,"filesystem",":"),size:_,used:_-h,available:h,use:parseFloat((100*(_-h)/_).toFixed(2)),mount:y,rw:v})}),t&&t(c),l(c)})}catch{t&&t(c),l(c)}})})}us.fsSize=Eu;function Pu(s){return new Promise(t=>{process.nextTick(()=>{let e={max:null,allocated:null,available:null};(Fe||Be||We||It)&&xe("sysctl -i kern.maxfiles kern.num_files kern.open_files",{maxBuffer:1024*1024},function(i,n){if(!i){let o=n.toString().split(`
|
|
170
|
+
`);e.max=parseInt(O.getValue(o,"kern.maxfiles",":"),10),e.allocated=parseInt(O.getValue(o,"kern.num_files",":"),10)||parseInt(O.getValue(o,"kern.open_files",":"),10),e.available=e.max-e.allocated}s&&s(e),t(e)}),ke&&Po.readFile("/proc/sys/fs/file-nr",function(r,i){if(r)Po.readFile("/proc/sys/fs/file-max",function(n,o){if(!n){let a=o.toString().split(`
|
|
171
|
+
`);a[0]&&(e.max=parseInt(a[0],10))}s&&s(e),t(e)});else{let n=i.toString().split(`
|
|
172
|
+
`);if(n[0]){let o=n[0].replace(/\s+/g," ").split(" ");o.length===3&&(e.allocated=parseInt(o[0],10),e.available=parseInt(o[1],10),e.max=parseInt(o[2],10),e.available||(e.available=e.max-e.allocated))}s&&s(e),t(e)}}),Rs&&(s&&s(null),t(null)),Ms&&(s&&s(null),t(null))})})}us.fsOpenFiles=Pu;function Tu(s){return parseInt(s.substr(s.indexOf(" (")+2,s.indexOf(" Bytes)")-10))}function Vu(s){let t=[],e=0;return s.forEach(r=>{if(r.length>0)if(r[0]==="*")e++;else{let i=r.split(":");i.length>1&&(t[e]||(t[e]={name:"",identifier:"",type:"disk",fsType:"",mount:"",size:0,physical:"HDD",uuid:"",label:"",model:"",serial:"",removable:!1,protocol:"",group:"",device:""}),i[0]=i[0].trim().toUpperCase().replace(/ +/g,""),i[1]=i[1].trim(),i[0]==="DEVICEIDENTIFIER"&&(t[e].identifier=i[1]),i[0]==="DEVICENODE"&&(t[e].name=i[1]),i[0]==="VOLUMENAME"&&i[1].indexOf("Not applicable")===-1&&(t[e].label=i[1]),i[0]==="PROTOCOL"&&(t[e].protocol=i[1]),i[0]==="DISKSIZE"&&(t[e].size=Tu(i[1])),i[0]==="FILESYSTEMPERSONALITY"&&(t[e].fsType=i[1]),i[0]==="MOUNTPOINT"&&(t[e].mount=i[1]),i[0]==="VOLUMEUUID"&&(t[e].uuid=i[1]),i[0]==="READ-ONLYMEDIA"&&i[1]==="Yes"&&(t[e].physical="CD/DVD"),i[0]==="SOLIDSTATE"&&i[1]==="Yes"&&(t[e].physical="SSD"),i[0]==="VIRTUAL"&&(t[e].type="virtual"),i[0]==="REMOVABLEMEDIA"&&(t[e].removable=i[1]==="Removable"),i[0]==="PARTITIONTYPE"&&(t[e].type="part"),i[0]==="DEVICE/MEDIANAME"&&(t[e].model=i[1]))}}),t}function Gn(s){let t=[];return s.filter(e=>e!=="").forEach(e=>{try{e=decodeURIComponent(e.replace(/\\x/g,"%")),e=e.replace(/\\/g,"\\\\");let r=JSON.parse(e);t.push({name:r.name,type:r.type,fsType:r.fsType,mount:r.mountpoint,size:parseInt(r.size),physical:r.type==="disk"?r.rota==="0"?"SSD":"HDD":r.type==="rom"?"CD/DVD":"",uuid:r.uuid,label:r.label,model:(r.model||"").trim(),serial:r.serial,removable:r.rm==="1",protocol:r.tran,group:r.group||""})}catch{O.noop()}}),t=O.unique(t),t=O.sortByKey(t,["type","name"]),t}function Nu(s){let t=O.getValue(s,"md_level","="),e=O.getValue(s,"md_name","="),r=O.getValue(s,"md_uuid","="),i=[];return s.forEach(n=>{n.toLowerCase().startsWith("md_device_dev")&&n.toLowerCase().indexOf("/dev/")>0&&i.push(n.split("/dev/")[1])}),{raid:t,label:e,uuid:r,members:i}}function To(s){let t=s;try{s.forEach(e=>{if(e.type.startsWith("raid")){let r=Ot(`mdadm --export --detail /dev/${e.name}`,O.execOptsLinux).toString().split(`
|
|
173
|
+
`),i=Nu(r);e.label=i.label,e.uuid=i.uuid,i.members&&i.members.length&&i.raid===e.type&&(t=t.map(n=>(n.fsType==="linux_raid_member"&&i.members.indexOf(n.name)>=0&&(n.group=e.name),n)))}})}catch{O.noop()}return t}function Du(s){let t=[];return s.forEach(e=>{e.type.startsWith("disk")&&t.push(e.name)}),t}function Au(s){let t=s;try{let e=Du(s);t=t.map(r=>((r.type.startsWith("part")||r.type.startsWith("disk"))&&e.forEach(i=>{r.name.startsWith(i)&&(r.device="/dev/"+i)}),r))}catch{O.noop()}return t}function bu(s){let t=[];return s.forEach(e=>{if(e.type.startsWith("disk")&&t.push({name:e.name,model:e.model,device:e.name}),e.type.startsWith("virtual")){let r="";t.forEach(i=>{i.model===e.model&&(r=i.device)}),r&&t.push({name:e.name,model:e.model,device:r})}}),t}function Mu(s){let t=s;try{let e=bu(s);t=t.map(r=>((r.type.startsWith("part")||r.type.startsWith("disk")||r.type.startsWith("virtual"))&&e.forEach(i=>{r.name.startsWith(i.name)&&(r.device=i.device)}),r))}catch{O.noop()}return t}function Ru(s){let t=[];return s.forEach(e=>{let r=e.split(`\r
|
|
174
|
+
`),i=O.getValue(r,"DeviceID",":"),n=e.split("@{DeviceID=");n.length>1&&(n=n.slice(1),n.forEach(o=>{t.push({name:o.split(";")[0].toUpperCase(),device:i})}))}),t}function ku(s,t){let e=Ru(t);return s.map(r=>{let i=e.filter(n=>n.name===r.name.toUpperCase());return i.length>0&&(r.device=i[0].device),r}),s}function jn(s){return s.toString().replace(/NAME=/g,'{"name":').replace(/FSTYPE=/g,',"fsType":').replace(/TYPE=/g,',"type":').replace(/SIZE=/g,',"size":').replace(/MOUNTPOINT=/g,',"mountpoint":').replace(/UUID=/g,',"uuid":').replace(/ROTA=/g,',"rota":').replace(/RO=/g,',"ro":').replace(/RM=/g,',"rm":').replace(/TRAN=/g,',"tran":').replace(/SERIAL=/g,',"serial":').replace(/LABEL=/g,',"label":').replace(/MODEL=/g,',"model":').replace(/OWNER=/g,',"owner":').replace(/GROUP=/g,',"group":').replace(/\n/g,`}
|
|
175
|
+
`)}function Fu(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(ke&&xe("lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER 2>/dev/null",{maxBuffer:1024*1024},function(r,i){if(r)xe("lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER 2>/dev/null",{maxBuffer:1024*1024},function(n,o){if(!n){let a=jn(o).split(`
|
|
176
|
+
`);e=Gn(a),e=To(e)}s&&s(e),t(e)});else{let n=jn(i).split(`
|
|
177
|
+
`);e=Gn(n),e=To(e),e=Au(e),s&&s(e),t(e)}}),It&&xe("diskutil info -all",{maxBuffer:1024*1024},function(r,i){if(!r){let n=i.toString().split(`
|
|
178
|
+
`);e=Vu(n),e=Mu(e)}s&&s(e),t(e)}),Rs&&(s&&s(e),t(e)),Ms){let r=["Unknown","NoRoot","Removable","Local","Network","CD/DVD","RAM"];try{let i=[];i.push(O.powerShell("Get-CimInstance -ClassName Win32_LogicalDisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl")),i.push(O.powerShell("Get-WmiObject -Class Win32_diskdrive | Select-Object -Property PNPDeviceId,DeviceID, Model, Size, @{L='Partitions'; E={$_.GetRelated('Win32_DiskPartition').GetRelated('Win32_LogicalDisk') | Select-Object -Property DeviceID, VolumeName, Size, FreeSpace}} | fl")),O.promiseAll(i).then(n=>{let o=n.results[0].toString().split(/\n\s*\n/),a=n.results[1].toString().split(/\n\s*\n/);o.forEach(function(l){let c=l.split(`\r
|
|
179
|
+
`),u=O.getValue(c,"drivetype",":");u&&e.push({name:O.getValue(c,"name",":"),identifier:O.getValue(c,"caption",":"),type:"disk",fsType:O.getValue(c,"filesystem",":").toLowerCase(),mount:O.getValue(c,"caption",":"),size:O.getValue(c,"size",":"),physical:u>=0&&u<=6?r[u]:r[0],uuid:O.getValue(c,"volumeserialnumber",":"),label:O.getValue(c,"volumename",":"),model:"",serial:O.getValue(c,"volumeserialnumber",":"),removable:u==="2",protocol:"",group:"",device:""})}),e=ku(e,a),s&&s(e),t(e)})}catch{s&&s(e),t(e)}}(Fe||Be||We)&&(s&&s(null),t(null))})})}us.blockDevices=Fu;function Vo(s,t){let e={rx:0,wx:0,tx:0,rx_sec:null,wx_sec:null,tx_sec:null,ms:0};return se&&se.ms?(e.rx=s,e.wx=t,e.tx=e.rx+e.wx,e.ms=Date.now()-se.ms,e.rx_sec=(e.rx-se.bytes_read)/(e.ms/1e3),e.wx_sec=(e.wx-se.bytes_write)/(e.ms/1e3),e.tx_sec=e.rx_sec+e.wx_sec,se.rx_sec=e.rx_sec,se.wx_sec=e.wx_sec,se.tx_sec=e.tx_sec,se.bytes_read=e.rx,se.bytes_write=e.wx,se.bytes_overall=e.rx+e.wx,se.ms=Date.now(),se.last_ms=e.ms):(e.rx=s,e.wx=t,e.tx=e.rx+e.wx,se.rx_sec=null,se.wx_sec=null,se.tx_sec=null,se.bytes_read=e.rx,se.bytes_write=e.wx,se.bytes_overall=e.rx+e.wx,se.ms=Date.now(),se.last_ms=0),e}function Bu(s){return new Promise(t=>{process.nextTick(()=>{if(Ms||Fe||Be||We||Rs)return t(null);let e={rx:0,wx:0,tx:0,rx_sec:null,wx_sec:null,tx_sec:null,ms:0},r=0,i=0;se&&!se.ms||se&&se.ms&&Date.now()-se.ms>=500?(ke&&xe("lsblk -r 2>/dev/null | grep /",{maxBuffer:1024*1024},function(n,o){if(n)s&&s(e),t(e);else{let a=o.toString().split(`
|
|
180
|
+
`),l=[];a.forEach(function(u){u!==""&&(u=u.trim().split(" "),l.indexOf(u[0])===-1&&l.push(u[0]))});let c=l.join("|");xe('cat /proc/diskstats | egrep "'+c+'"',{maxBuffer:1024*1024},function(u,p){u||(p.toString().split(`
|
|
181
|
+
`).forEach(function(d){d=d.trim(),d!==""&&(d=d.replace(/ +/g," ").split(" "),r+=parseInt(d[5])*512,i+=parseInt(d[9])*512)}),e=Vo(r,i)),s&&s(e),t(e)})}}),It&&xe(`ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,
|
|
182
|
+
"`,{maxBuffer:1024*1024},function(n,o){n||(o.toString().split(`
|
|
183
|
+
`).forEach(function(l){l=l.trim(),l!==""&&(l=l.split(","),r+=parseInt(l[2]),i+=parseInt(l[9]))}),e=Vo(r,i)),s&&s(e),t(e)})):(e.ms=se.last_ms,e.rx=se.bytes_read,e.wx=se.bytes_write,e.tx=se.bytes_read+se.bytes_write,e.rx_sec=se.rx_sec,e.wx_sec=se.wx_sec,e.tx_sec=se.tx_sec,s&&s(e),t(e))})})}us.fsStats=Bu;function No(s,t,e,r,i){let n={rIO:0,wIO:0,tIO:0,rIO_sec:null,wIO_sec:null,tIO_sec:null,rWaitTime:0,wWaitTime:0,tWaitTime:0,rWaitPercent:null,wWaitPercent:null,tWaitPercent:null,ms:0};return W&&W.ms?(n.rIO=s,n.wIO=t,n.tIO=s+t,n.ms=Date.now()-W.ms,n.rIO_sec=(n.rIO-W.rIO)/(n.ms/1e3),n.wIO_sec=(n.wIO-W.wIO)/(n.ms/1e3),n.tIO_sec=n.rIO_sec+n.wIO_sec,n.rWaitTime=e,n.wWaitTime=r,n.tWaitTime=i,n.rWaitPercent=(n.rWaitTime-W.rWaitTime)*100/n.ms,n.wWaitPercent=(n.wWaitTime-W.wWaitTime)*100/n.ms,n.tWaitPercent=(n.tWaitTime-W.tWaitTime)*100/n.ms,W.rIO=s,W.wIO=t,W.rIO_sec=n.rIO_sec,W.wIO_sec=n.wIO_sec,W.tIO_sec=n.tIO_sec,W.rWaitTime=e,W.wWaitTime=r,W.tWaitTime=i,W.rWaitPercent=n.rWaitPercent,W.wWaitPercent=n.wWaitPercent,W.tWaitPercent=n.tWaitPercent,W.last_ms=n.ms,W.ms=Date.now()):(n.rIO=s,n.wIO=t,n.tIO=s+t,n.rWaitTime=e,n.wWaitTime=r,n.tWaitTime=i,W.rIO=s,W.wIO=t,W.rIO_sec=null,W.wIO_sec=null,W.tIO_sec=null,W.rWaitTime=e,W.wWaitTime=r,W.tWaitTime=i,W.rWaitPercent=null,W.wWaitPercent=null,W.tWaitPercent=null,W.last_ms=0,W.ms=Date.now()),n}function Wu(s){return new Promise(t=>{process.nextTick(()=>{if(Ms||Rs)return t(null);let e={rIO:0,wIO:0,tIO:0,rIO_sec:null,wIO_sec:null,tIO_sec:null,rWaitTime:0,wWaitTime:0,tWaitTime:0,rWaitPercent:null,wWaitPercent:null,tWaitPercent:null,ms:0},r=0,i=0,n=0,o=0,a=0;W&&!W.ms||W&&W.ms&&Date.now()-W.ms>=500?((ke||Fe||Be||We)&&xe('for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[\u2502\u2514\u2500\u251C]//g" | awk \'{$1=$1};1\' | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done',{maxBuffer:1024*1024},function(c,u){c?(s&&s(e),t(e)):(u.split(`
|
|
184
|
+
`).forEach(function(f){if(!f)return;let d=f.split(";");r+=parseInt(d[0]),i+=parseInt(d[4]),n+=parseInt(d[3]),o+=parseInt(d[7]),a+=parseInt(d[10])}),e=No(r,i,n,o,a),s&&s(e),t(e))}),It&&xe(`ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,
|
|
185
|
+
"`,{maxBuffer:1024*1024},function(l,c){l||(c.toString().split(`
|
|
186
|
+
`).forEach(function(p){p=p.trim(),p!==""&&(p=p.split(","),r+=parseInt(p[10]),i+=parseInt(p[0]))}),e=No(r,i,n,o,a)),s&&s(e),t(e)})):(e.rIO=W.rIO,e.wIO=W.wIO,e.tIO=W.rIO+W.wIO,e.ms=W.last_ms,e.rIO_sec=W.rIO_sec,e.wIO_sec=W.wIO_sec,e.tIO_sec=W.tIO_sec,e.rWaitTime=W.rWaitTime,e.wWaitTime=W.wWaitTime,e.tWaitTime=W.tWaitTime,e.rWaitPercent=W.rWaitPercent,e.wWaitPercent=W.wWaitPercent,e.tWaitPercent=W.tWaitPercent,s&&s(e),t(e))})})}us.disksIO=Wu;function Uu(s){function t(e){let r=[{pattern:"WESTERN.*",manufacturer:"Western Digital"},{pattern:"^WDC.*",manufacturer:"Western Digital"},{pattern:"WD.*",manufacturer:"Western Digital"},{pattern:"TOSHIBA.*",manufacturer:"Toshiba"},{pattern:"HITACHI.*",manufacturer:"Hitachi"},{pattern:"^IC.*",manufacturer:"Hitachi"},{pattern:"^HTS.*",manufacturer:"Hitachi"},{pattern:"SANDISK.*",manufacturer:"SanDisk"},{pattern:"KINGSTON.*",manufacturer:"Kingston Technology"},{pattern:"^SONY.*",manufacturer:"Sony"},{pattern:"TRANSCEND.*",manufacturer:"Transcend"},{pattern:"SAMSUNG.*",manufacturer:"Samsung"},{pattern:"^ST(?!I\\ ).*",manufacturer:"Seagate"},{pattern:"^STI\\ .*",manufacturer:"SimpleTech"},{pattern:"^D...-.*",manufacturer:"IBM"},{pattern:"^IBM.*",manufacturer:"IBM"},{pattern:"^FUJITSU.*",manufacturer:"Fujitsu"},{pattern:"^MP.*",manufacturer:"Fujitsu"},{pattern:"^MK.*",manufacturer:"Toshiba"},{pattern:"MAXTO.*",manufacturer:"Maxtor"},{pattern:"PIONEER.*",manufacturer:"Pioneer"},{pattern:"PHILIPS.*",manufacturer:"Philips"},{pattern:"QUANTUM.*",manufacturer:"Quantum Technology"},{pattern:"FIREBALL.*",manufacturer:"Quantum Technology"},{pattern:"^VBOX.*",manufacturer:"VirtualBox"},{pattern:"CORSAIR.*",manufacturer:"Corsair Components"},{pattern:"CRUCIAL.*",manufacturer:"Crucial"},{pattern:"ECM.*",manufacturer:"ECM"},{pattern:"INTEL.*",manufacturer:"INTEL"},{pattern:"EVO.*",manufacturer:"Samsung"},{pattern:"APPLE.*",manufacturer:"Apple"}],i="";return e&&(e=e.toUpperCase(),r.forEach(n=>{RegExp(n.pattern).test(e)&&(i=n.manufacturer)})),i}return new Promise(e=>{process.nextTick(()=>{let r=o=>{for(let a=0;a<o.length;a++)delete o[a].BSDName;s&&s(o),e(o)},i=[],n="";if(ke){let o="";xe("export LC_ALL=C; lsblk -ablJO 2>/dev/null; unset LC_ALL",{maxBuffer:1024*1024},function(a,l){if(!a)try{let c=l.toString().trim(),u=[];try{let p=JSON.parse(c);p&&{}.hasOwnProperty.call(p,"blockdevices")&&(u=p.blockdevices.filter(f=>f.type==="disk"&&f.size>0&&(f.model!==null||f.mountpoint===null&&f.label===null&&f.fstype===null&&f.parttype===null&&f.path&&f.path.indexOf("/ram")!==0&&f.path.indexOf("/loop")!==0&&f["disc-max"]&&f["disc-max"]!==0)))}catch{try{let f=Ot("export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL",O.execOptsLinux).toString(),d=jn(f).split(`
|
|
187
|
+
`);u=Gn(d).filter(g=>g.type==="disk"&&g.size>0&&(g.model!==null&&g.model!==""||g.mount===""&&g.label===""&&g.fsType===""))}catch{O.noop()}}u.forEach(p=>{let f="",d="/dev/"+p.name,m=p.name;try{f=Ot("cat /sys/block/"+m+"/queue/rotational 2>/dev/null",O.execOptsLinux).toString().split(`
|
|
188
|
+
`)[0]}catch{O.noop()}let g=p.tran?p.tran.toUpperCase().trim():"";g==="NVME"&&(f="2",g="PCIe"),i.push({device:d,type:f==="0"?"SSD":f==="1"?"HD":f==="2"?"NVMe":p.model&&p.model.indexOf("SSD")>-1?"SSD":p.model&&p.model.indexOf("NVM")>-1?"NVMe":"HD",name:p.model||"",vendor:t(p.model)||(p.vendor?p.vendor.trim():""),size:p.size||0,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:p.rev?p.rev.trim():"",serialNum:p.serial?p.serial.trim():"",interfaceType:g,smartStatus:"unknown",temperature:null,BSDName:d}),n+=`printf "
|
|
189
|
+
${d}|"; smartctl -H ${d} | grep overall;`,o+=`${o?'printf ",";':""}smartctl -a -j ${d};`})}catch{O.noop()}o?xe(o,{maxBuffer:1024*1024},function(c,u){try{JSON.parse(`[${u}]`).forEach(f=>{let d=f.smartctl.argv[f.smartctl.argv.length-1];for(let m=0;m<i.length;m++)i[m].BSDName===d&&(i[m].smartStatus=f.smart_status.passed?"Ok":f.smart_status.passed===!1?"Predicted Failure":"unknown",f.temperature&&f.temperature.current&&(i[m].temperature=f.temperature.current),i[m].smartData=f)}),r(i)}catch{n?(n=n+`printf "
|
|
190
|
+
"`,xe(n,{maxBuffer:1024*1024},function(f,d){d.toString().split(`
|
|
191
|
+
`).forEach(g=>{if(g){let _=g.split("|");if(_.length===2){let h=_[0];_[1]=_[1].trim();let y=_[1].split(":");if(y.length===2){y[1]=y[1].trim();let S=y[1].toLowerCase();for(let v=0;v<i.length;v++)i[v].BSDName===h&&(i[v].smartStatus=S==="passed"?"Ok":S==="failed!"?"Predicted Failure":"unknown")}}}}),r(i)})):r(i)}}):r(i)})}if((Fe||Be||We)&&(s&&s(i),e(i)),Rs&&(s&&s(i),e(i)),It&&xe("system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType",{maxBuffer:1024*1024},function(o,a){if(!o){let l=a.toString().split(`
|
|
192
|
+
`),c=[],u=[],p=[],f="SATA";l.forEach(d=>{d==="NVMExpress:"?f="NVMe":d==="USB:"?f="USB":d==="SATA/SATA Express:"?f="SATA":f==="SATA"?c.push(d):f==="NVMe"?u.push(d):f==="USB"&&p.push(d)});try{let d=c.join(`
|
|
193
|
+
`).split(" Physical Interconnect: ");d.shift(),d.forEach(function(m){m="InterfaceType: "+m;let g=m.split(`
|
|
194
|
+
`),_=O.getValue(g,"Medium Type",":",!0).trim(),h=O.getValue(g,"capacity",":",!0).trim(),y=O.getValue(g,"BSD Name",":",!0).trim();if(h){let S=0;if(h.indexOf("(")>=0&&(S=parseInt(h.match(/\(([^)]+)\)/)[1].replace(/\./g,"").replace(/,/g,"").replace(/\s/g,""))),S||(S=parseInt(h)),S){let v=O.getValue(g,"S.M.A.R.T. status",":",!0).trim().toLowerCase();i.push({device:y,type:_.startsWith("Solid")?"SSD":"HD",name:O.getValue(g,"Model",":",!0).trim(),vendor:t(O.getValue(g,"Model",":",!0).trim())||O.getValue(g,"Manufacturer",":",!0),size:S,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:O.getValue(g,"Revision",":",!0).trim(),serialNum:O.getValue(g,"Serial Number",":",!0).trim(),interfaceType:O.getValue(g,"InterfaceType",":",!0).trim(),smartStatus:v==="verified"?"OK":v||"unknown",temperature:null,BSDName:y}),n=n+`printf "
|
|
195
|
+
`+y+'|"; diskutil info /dev/'+y+" | grep SMART;"}}})}catch{O.noop()}try{let d=u.join(`
|
|
196
|
+
`).split(`
|
|
197
|
+
|
|
198
|
+
Capacity:`);d.shift(),d.forEach(function(m){m="!Capacity: "+m;let g=m.split(`
|
|
199
|
+
`),_=O.getValue(g,"link width",":",!0).trim(),h=O.getValue(g,"!capacity",":",!0).trim(),y=O.getValue(g,"BSD Name",":",!0).trim();if(h){let S=0;if(h.indexOf("(")>=0&&(S=parseInt(h.match(/\(([^)]+)\)/)[1].replace(/\./g,"").replace(/,/g,"").replace(/\s/g,""))),S||(S=parseInt(h)),S){let v=O.getValue(g,"S.M.A.R.T. status",":",!0).trim().toLowerCase();i.push({device:y,type:"NVMe",name:O.getValue(g,"Model",":",!0).trim(),vendor:t(O.getValue(g,"Model",":",!0).trim()),size:S,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:O.getValue(g,"Revision",":",!0).trim(),serialNum:O.getValue(g,"Serial Number",":",!0).trim(),interfaceType:("PCIe "+_).trim(),smartStatus:v==="verified"?"OK":v||"unknown",temperature:null,BSDName:y}),n=n+`printf "
|
|
200
|
+
`+y+'|"; diskutil info /dev/'+y+" | grep SMART;"}}})}catch{O.noop()}try{let d=p.join(`
|
|
201
|
+
`).replaceAll(`Media:
|
|
202
|
+
`,"Model:").split(`
|
|
203
|
+
|
|
204
|
+
Product ID:`);d.shift(),d.forEach(function(m){let g=m.split(`
|
|
205
|
+
`),_=O.getValue(g,"Capacity",":",!0).trim(),h=O.getValue(g,"BSD Name",":",!0).trim();if(_){let y=0;if(_.indexOf("(")>=0&&(y=parseInt(_.match(/\(([^)]+)\)/)[1].replace(/\./g,"").replace(/,/g,"").replace(/\s/g,""))),y||(y=parseInt(_)),y){let S=O.getValue(g,"S.M.A.R.T. status",":",!0).trim().toLowerCase();i.push({device:h,type:"USB",name:O.getValue(g,"Model",":",!0).trim().replaceAll(":",""),vendor:t(O.getValue(g,"Model",":",!0).trim()),size:y,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:O.getValue(g,"Revision",":",!0).trim(),serialNum:O.getValue(g,"Serial Number",":",!0).trim(),interfaceType:"USB",smartStatus:S==="verified"?"OK":S||"unknown",temperature:null,BSDName:h}),n=n+`printf "
|
|
206
|
+
`+h+'|"; diskutil info /dev/'+h+" | grep SMART;"}}})}catch{O.noop()}if(n)n=n+`printf "
|
|
207
|
+
"`,xe(n,{maxBuffer:1024*1024},function(d,m){m.toString().split(`
|
|
208
|
+
`).forEach(_=>{if(_){let h=_.split("|");if(h.length===2){let y=h[0];h[1]=h[1].trim();let S=h[1].split(":");if(S.length===2){S[1]=S[1].trim();let v=S[1].toLowerCase();for(let x=0;x<i.length;x++)i[x].BSDName===y&&(i[x].smartStatus=v==="not supported"?"not supported":v==="verified"?"Ok":v==="failing"?"Predicted Failure":"unknown")}}}});for(let _=0;_<i.length;_++)delete i[_].BSDName;s&&s(i),e(i)});else{for(let d=0;d<i.length;d++)delete i[d].BSDName;s&&s(i),e(i)}}}),Ms)try{let o=[];if(o.push(O.powerShell("Get-CimInstance Win32_DiskDrive | select Caption,Size,Status,PNPDeviceId,DeviceId,BytesPerSector,TotalCylinders,TotalHeads,TotalSectors,TotalTracks,TracksPerCylinder,SectorsPerTrack,FirmwareRevision,SerialNumber,InterfaceType | fl")),o.push(O.powerShell("Get-PhysicalDisk | select BusType,MediaType,FriendlyName,Model,SerialNumber,Size | fl")),O.smartMonToolsInstalled())try{let a=JSON.parse(Ot("smartctl --scan -j").toString());a&&a.devices&&a.devices.length>0&&a.devices.forEach(l=>{o.push(Lu(`smartctl -j -a ${l.name}`,O.execOptsWin))})}catch{O.noop()}O.promiseAll(o).then(a=>{let l=a.results[0].toString().split(/\n\s*\n/);l.forEach(function(c){let u=c.split(`\r
|
|
209
|
+
`),p=O.getValue(u,"Size",":").trim(),f=O.getValue(u,"Status",":").trim().toLowerCase();p&&i.push({device:O.getValue(u,"DeviceId",":"),type:c.indexOf("SSD")>-1?"SSD":"HD",name:O.getValue(u,"Caption",":"),vendor:t(O.getValue(u,"Caption",":",!0).trim()),size:parseInt(p),bytesPerSector:parseInt(O.getValue(u,"BytesPerSector",":")),totalCylinders:parseInt(O.getValue(u,"TotalCylinders",":")),totalHeads:parseInt(O.getValue(u,"TotalHeads",":")),totalSectors:parseInt(O.getValue(u,"TotalSectors",":")),totalTracks:parseInt(O.getValue(u,"TotalTracks",":")),tracksPerCylinder:parseInt(O.getValue(u,"TracksPerCylinder",":")),sectorsPerTrack:parseInt(O.getValue(u,"SectorsPerTrack",":")),firmwareRevision:O.getValue(u,"FirmwareRevision",":").trim(),serialNum:O.getValue(u,"SerialNumber",":").trim(),interfaceType:O.getValue(u,"InterfaceType",":").trim(),smartStatus:f==="ok"?"Ok":f==="degraded"?"Degraded":f==="pred fail"?"Predicted Failure":"Unknown",temperature:null})}),l=a.results[1].split(/\n\s*\n/),l.forEach(function(c){let u=c.split(`\r
|
|
210
|
+
`),p=O.getValue(u,"SerialNumber",":").trim(),f=O.getValue(u,"FriendlyName",":").trim().replace("Msft ","Microsoft"),d=O.getValue(u,"Size",":").trim(),m=O.getValue(u,"Model",":").trim(),g=O.getValue(u,"BusType",":").trim(),_=O.getValue(u,"MediaType",":").trim();if((_==="3"||_==="HDD")&&(_="HD"),_==="4"&&(_="SSD"),_==="5"&&(_="SCM"),_==="Unspecified"&&(m.toLowerCase().indexOf("virtual")>-1||m.toLowerCase().indexOf("vbox")>-1)&&(_="Virtual"),d){let h=O.findObjectByKey(i,"serialNum",p);(h===-1||p==="")&&(h=O.findObjectByKey(i,"name",f)),h!=-1&&(i[h].type=_,i[h].interfaceType=g)}}),a.results.shift(),a.results.shift(),a.results.length&&a.results.forEach(c=>{try{let u=JSON.parse(c);if(u.serial_number){let p=u.serial_number,f=O.findObjectByKey(i,"serialNum",p);f!=-1&&(i[f].smartStatus=u.smart_status&&u.smart_status.passed?"Ok":u.smart_status&&u.smart_status.passed===!1?"Predicted Failure":"unknown",u.temperature&&u.temperature.current&&(i[f].temperature=u.temperature.current),i[f].smartData=u)}}catch{O.noop()}}),s&&s(i),e(i)})}catch{s&&s(i),e(i)}})})}us.diskLayout=Uu});var Wo=le(ds=>{"use strict";var en=require("os"),Ne=require("child_process").exec,ue=require("child_process").execSync,Gu=require("fs"),D=ce(),Et=process.platform,it=Et==="linux"||Et==="android",ot=Et==="darwin",fr=Et==="win32",Pt=Et==="freebsd",Tt=Et==="openbsd",Vt=Et==="netbsd",Ao=Et==="sunos",Q={},bo="",ks={},Mo=[],Fs=[],Bs={},ps;function fs(){let s="",t="";try{let e=en.networkInterfaces(),r=9999;for(let i in e)({}).hasOwnProperty.call(e,i)&&e[i].forEach(function(n){n&&n.internal===!1&&(t=t||i,n.scopeid&&n.scopeid<r&&(s=i,r=n.scopeid))});if(s=s||t||"",fr){let i="";if(ue("netstat -r",D.execOptsWin).toString().split(en.EOL).forEach(l=>{if(l=l.replace(/\s+/g," ").trim(),l.indexOf("0.0.0.0 0.0.0.0")>-1&&!/[a-zA-Z]/.test(l)){let c=l.split(" ");c.length>=5&&(i=c[c.length-2])}}),i)for(let l in e)({}).hasOwnProperty.call(e,l)&&e[l].forEach(function(c){c&&c.address&&c.address===i&&(s=l)})}if(it){let o=ue("ip route 2> /dev/null | grep default",D.execOptsLinux).toString().split(`
|
|
211
|
+
`)[0].split(/\s+/);o[0]==="none"&&o[5]?s=o[5]:o[4]&&(s=o[4]),s.indexOf(":")>-1&&(s=s.split(":")[1].trim())}if(ot||Pt||Tt||Vt||Ao){let i="";it&&(i="ip route 2> /dev/null | grep default | awk '{print $5}'"),ot&&(i="route -n get default 2>/dev/null | grep interface: | awk '{print $2}'"),(Pt||Tt||Vt||Ao)&&(i="route get 0.0.0.0 | grep interface:"),s=ue(i).toString().split(`
|
|
212
|
+
`)[0],s.indexOf(":")>-1&&(s=s.split(":")[1].trim())}}catch{D.noop()}return s&&(bo=s),bo}ds.getDefaultNetworkInterface=fs;function Ro(){let s="",t="",e={};if(it||Pt||Tt||Vt){if(typeof ps>"u")try{let r=ue("which ip",D.execOptsLinux).toString().split(`
|
|
213
|
+
`);r.length&&r[0].indexOf(":")===-1&&r[0].indexOf("/")===0?ps=r[0]:ps=""}catch{ps=""}try{let r="export LC_ALL=C; "+(ps?ps+" link show up":"/sbin/ifconfig")+"; unset LC_ALL",n=ue(r,D.execOptsLinux).toString().split(`
|
|
214
|
+
`);for(let o=0;o<n.length;o++)if(n[o]&&n[o][0]!==" "){if(ps){let a=n[o+1].trim().split(" ");a[0]==="link/ether"&&(s=n[o].split(" ")[1],s=s.slice(0,s.length-1),t=a[1])}else s=n[o].split(" ")[0],t=n[o].split("HWaddr ")[1];s&&t&&(e[s]=t.trim(),s="",t="")}}catch{D.noop()}}if(ot)try{let n=ue("/sbin/ifconfig").toString().split(`
|
|
215
|
+
`);for(let o=0;o<n.length;o++)n[o]&&n[o][0]!==" "&&n[o].indexOf(":")>0?s=n[o].split(":")[0]:n[o].indexOf(" ether ")===0&&(t=n[o].split(" ether ")[1],s&&t&&(e[s]=t.trim(),s="",t=""))}catch{D.noop()}return e}function ju(s){return new Promise(t=>{process.nextTick(()=>{let e=fs();s&&s(e),t(e)})})}ds.networkInterfaceDefault=ju;function zu(s,t){let e=[];for(let r in s)if({}.hasOwnProperty.call(s,r)&&s[r].trim()!==""){let i=s[r].trim().split(`\r
|
|
216
|
+
`),n=t&&t[r]?t[r].trim().split(`\r
|
|
217
|
+
`):[],o=D.getValue(i,"NetEnabled",":"),a=D.getValue(i,"AdapterTypeID",":")==="9"?"wireless":"wired",l=D.getValue(i,"Name",":").replace(/\]/g,")").replace(/\[/g,"("),c=D.getValue(i,"NetConnectionID",":").replace(/\]/g,")").replace(/\[/g,"(");if((l.toLowerCase().indexOf("wi-fi")>=0||l.toLowerCase().indexOf("wireless")>=0)&&(a="wireless"),o!==""){let u=parseInt(D.getValue(i,"speed",":").trim(),10)/1e6;e.push({mac:D.getValue(i,"MACAddress",":").toLowerCase(),dhcp:D.getValue(n,"dhcpEnabled",":").toLowerCase()==="true",name:l,iface:c,netEnabled:o==="TRUE",speed:isNaN(u)?null:u,operstate:D.getValue(i,"NetConnectionStatus",":")==="2"?"up":"down",type:a})}}return e}function qu(){return new Promise(s=>{process.nextTick(()=>{let t="Get-CimInstance Win32_NetworkAdapter | fl *; echo '#-#-#-#';";t+="Get-CimInstance Win32_NetworkAdapterConfiguration | fl DHCPEnabled";try{D.powerShell(t).then(e=>{e=e.split("#-#-#-#");let r=(e[0]||"").split(/\n\s*\n/),i=(e[1]||"").split(/\n\s*\n/);s(zu(r,i))})}catch{s([])}})})}function Hu(){let s={},t={primaryDNS:"",exitCode:0,ifaces:[]};try{return ue("ipconfig /all",D.execOptsWin).split(`\r
|
|
218
|
+
\r
|
|
219
|
+
`).forEach((i,n)=>{if(n==1){let o=i.split(`\r
|
|
220
|
+
`).filter(l=>l.toUpperCase().includes("DNS")),a=o[0].substring(o[0].lastIndexOf(":")+1);t.primaryDNS=a.trim(),t.primaryDNS||(t.primaryDNS="Not defined")}if(n>1)if(n%2==0){let o=i.substring(i.lastIndexOf(" ")+1).replace(":","");s.name=o}else{let o=i.split(`\r
|
|
221
|
+
`).filter(l=>l.toUpperCase().includes("DNS")),a=o[0].substring(o[0].lastIndexOf(":")+1);s.dnsSuffix=a.trim(),t.ifaces.push(s),s={}}}),t}catch{return{primaryDNS:"",exitCode:0,ifaces:[]}}}function $u(s,t){let e="",r=t+".";try{let i=s.filter(n=>r.includes(n.name+".")).map(n=>n.dnsSuffix);return i[0]&&(e=i[0]),e||(e=""),e}catch{return"Unknown"}}function Yu(){try{return ue("netsh lan show profiles",D.execOptsWin).split(`\r
|
|
222
|
+
Profile on interface`)}catch(s){return s.status===1&&s.stdout.includes("AutoConfig")?"Disabled":[]}}function Xu(s){try{return ue(`netsh wlan show interface name="${s}" | findstr "SSID"`,D.execOptsWin).split(`\r
|
|
223
|
+
`).shift().split(":").pop()}catch{return"Unknown"}}function Ku(s,t,e){let r={state:"Unknown",protocol:"Unknown"};if(e==="Disabled")return r.state="Disabled",r.protocol="Not defined",r;if(s=="wired"&&e.length>0)try{let n=e.find(a=>a.includes(t+`\r
|
|
224
|
+
`)).split(`\r
|
|
225
|
+
`),o=n.find(a=>a.includes("802.1x"));if(o.includes("Disabled"))r.state="Disabled",r.protocol="Not defined";else if(o.includes("Enabled")){let a=n.find(l=>l.includes("EAP"));r.protocol=a.split(":").pop(),r.state="Enabled"}}catch{return r}else if(s=="wireless"){let i="",n="";try{let o=Xu(t);o!=="Unknown"&&(i=ue(`netsh wlan show profiles "${o}" | findstr "802.1X"`,D.execOptsWin),n=ue(`netsh wlan show profiles "${o}" | findstr "EAP"`,D.execOptsWin)),i.includes(":")&&n.includes(":")&&(r.state=i.split(":").pop(),r.protocol=n.split(":").pop())}catch(o){return o.status===1&&o.stdout.includes("AutoConfig")&&(r.state="Disabled",r.protocol="Not defined"),r}}return r}function ko(s){let t=[],e=[];return s.forEach(function(r){!r.startsWith(" ")&&!r.startsWith(" ")&&e.length&&(t.push(e),e=[]),e.push(r)}),e.length&&t.push(e),t}function Zu(s){let t=[];return s.forEach(e=>{let r={iface:"",mtu:null,mac:"",ip6:"",ip4:"",speed:null,type:"",operstate:"",duplex:"",internal:!1},i=e[0];r.iface=i.split(":")[0].trim();let n=i.split("> mtu");r.mtu=n.length>1?parseInt(n[1],10):null,isNaN(r.mtu)&&(r.mtu=null),r.internal=n[0].toLowerCase().indexOf("loopback")>-1,e.forEach(l=>{l.trim().startsWith("ether ")&&(r.mac=l.split("ether ")[1].toLowerCase().trim()),l.trim().startsWith("inet6 ")&&!r.ip6&&(r.ip6=l.split("inet6 ")[1].toLowerCase().split("%")[0].split(" ")[0]),l.trim().startsWith("inet ")&&!r.ip4&&(r.ip4=l.split("inet ")[1].toLowerCase().split(" ")[0])});let o=D.getValue(e,"link rate");r.speed=o?parseFloat(o):null,r.speed===null?(o=D.getValue(e,"uplink rate"),r.speed=o?parseFloat(o):null,r.speed!==null&&o.toLowerCase().indexOf("gbps")>=0&&(r.speed=r.speed*1e3)):o.toLowerCase().indexOf("gbps")>=0&&(r.speed=r.speed*1e3),r.type=D.getValue(e,"type").toLowerCase().indexOf("wi-fi")>-1?"wireless":"wired";let a=D.getValue(e,"status").toLowerCase();r.operstate=a==="active"?"up":a==="inactive"?"down":"unknown",r.duplex=D.getValue(e,"media").toLowerCase().indexOf("half-duplex")>-1?"half":"full",(r.ip6||r.ip4||r.mac)&&t.push(r)}),t}function Ju(){let s="/sbin/ifconfig -v";try{let t=ue(s,{maxBuffer:2048e4}).toString().split(`
|
|
226
|
+
`),e=ko(t);return Zu(e)}catch{return[]}}function Qu(s){let t=`nmcli device status 2>/dev/null | grep ${s}`;try{let n=ue(t,D.execOptsLinux).toString().replace(/\s+/g," ").trim().split(" ").slice(3).join(" ");return n!="--"?n:""}catch{return""}}function Fo(s){let t=[];try{let e=`cat ${s} 2> /dev/null | grep 'iface\\|source'`;ue(e,D.execOptsLinux).toString().split(`
|
|
227
|
+
`).forEach(i=>{let n=i.replace(/\s+/g," ").trim().split(" ");if(n.length>=4&&i.toLowerCase().indexOf(" inet ")>=0&&i.toLowerCase().indexOf("dhcp")>=0&&t.push(n[1]),i.toLowerCase().includes("source")){let o=i.split(" ")[1];t=t.concat(Fo(o))}})}catch{D.noop()}return t}function ep(){let s="ip a 2> /dev/null",t=[];try{let e=ue(s,D.execOptsLinux).toString().split(`
|
|
228
|
+
`),r=ko(e);t=tp(r)}catch{D.noop()}try{t=Fo("/etc/network/interfaces")}catch{D.noop()}return t}function tp(s){let t=[];return s&&s.length&&s.forEach(e=>{if(e&&e.length&&e[0].split(":").length>2){for(let i of e)if(i.indexOf(" inet ")>=0&&i.indexOf(" dynamic ")>=0){let n=i.split(" "),o=n[n.length-1].trim();t.push(o);break}}}),t}function sp(s,t,e){let r=!1;if(t){let i=`nmcli connection show "${t}" 2>/dev/null | grep ipv4.method;`;try{switch(ue(i,D.execOptsLinux).toString().replace(/\s+/g," ").trim().split(" ").slice(1).toString()){case"auto":r=!0;break;default:r=!1;break}return r}catch{return e.indexOf(s)>=0}}else return e.indexOf(s)>=0}function rp(s){let t=!1,e=`ipconfig getpacket "${s}" 2>/dev/null | grep lease_time;`;try{let r=ue(e).toString().split(`
|
|
229
|
+
`);r.length&&r[0].startsWith("lease_time")&&(t=!0)}catch{D.noop()}return t}function np(s){if(s){let t=`nmcli connection show "${s}" 2>/dev/null | grep ipv4.dns-search;`;try{let i=ue(t,D.execOptsLinux).toString().replace(/\s+/g," ").trim().split(" ").slice(1).toString();return i=="--"?"Not defined":i}catch{return"Unknown"}}else return"Unknown"}function ip(s){if(s){let t=`nmcli connection show "${s}" 2>/dev/null | grep 802-1x.eap;`;try{let i=ue(t,D.execOptsLinux).toString().replace(/\s+/g," ").trim().split(" ").slice(1).toString();return i=="--"?"":i}catch{return"Not defined"}}else return"Not defined"}function op(s){return s?s=="Not defined"?"Disabled":"Enabled":"Unknown"}function zn(s,t,e){let r=["00:00:00:00:00:00","00:03:FF","00:05:69","00:0C:29","00:0F:4B","00:13:07","00:13:BE","00:15:5d","00:16:3E","00:1C:42","00:21:F6","00:24:0B","00:50:56","00:A0:B1","00:E0:C8","08:00:27","0A:00:27","18:92:2C","16:DF:49","3C:F3:92","54:52:00","FC:15:97"];return e?r.filter(i=>e.toUpperCase().toUpperCase().startsWith(i.substring(0,e.length))).length>0||s.toLowerCase().indexOf(" virtual ")>-1||t.toLowerCase().indexOf(" virtual ")>-1||s.toLowerCase().indexOf("vethernet ")>-1||t.toLowerCase().indexOf("vethernet ")>-1||s.toLowerCase().startsWith("veth")||t.toLowerCase().startsWith("veth")||s.toLowerCase().startsWith("vboxnet")||t.toLowerCase().startsWith("vboxnet"):!1}function qn(s,t,e){return typeof s=="string"&&(e=s,t=!0,s=null),typeof s=="boolean"&&(t=s,s=null,e=""),typeof t>"u"&&(t=!0),e=e||"",e=""+e,new Promise(r=>{process.nextTick(()=>{let i=en.networkInterfaces(),n=[],o=[],a=[],l=[];if(ot||Pt||Tt||Vt)if(JSON.stringify(i)===JSON.stringify(ks)&&!t)n=Fs,s&&s(n),r(n);else{let c=fs();ks=JSON.parse(JSON.stringify(i)),o=Ju(),o.forEach(u=>{({}).hasOwnProperty.call(i,u.iface)&&i[u.iface].forEach(function(m){(m.family==="IPv4"||m.family===4)&&(u.ip4subnet=m.netmask),(m.family==="IPv6"||m.family===6)&&(u.ip6subnet=m.netmask)});let p="",f=D.isPrototypePolluted()?"---":D.sanitizeShellString(u.iface),d=D.mathMin(f.length,2e3);for(let m=0;m<=d;m++)f[m]!==void 0&&(p=p+f[m]);n.push({iface:u.iface,ifaceName:u.iface,default:u.iface===c,ip4:u.ip4,ip4subnet:u.ip4subnet||"",ip6:u.ip6,ip6subnet:u.ip6subnet||"",mac:u.mac,internal:u.internal,virtual:u.internal?!1:zn(u.iface,u.iface,u.mac),operstate:u.operstate,type:u.type,duplex:u.duplex,mtu:u.mtu,speed:u.speed,dhcp:rp(p),dnsSuffix:"",ieee8021xAuth:"",ieee8021xState:"",carrierChanges:0})}),Fs=n,e.toLowerCase().indexOf("default")>=0&&(n=n.filter(u=>u.default),n.length>0?n=n[0]:n=[]),s&&s(n),r(n)}if(it)if(JSON.stringify(i)===JSON.stringify(ks)&&!t)n=Fs,s&&s(n),r(n);else{ks=JSON.parse(JSON.stringify(i)),Mo=ep();let c=fs();for(let u in i){let p="",f="",d="",m="",g="",_="",h="",y=null,S=0,v=!1,x="",N="",T="",J="";if({}.hasOwnProperty.call(i,u)){let E=u;i[u].forEach(function(ie){(ie.family==="IPv4"||ie.family===4)&&(p=ie.address,f=ie.netmask),(ie.family==="IPv6"||ie.family===6)&&(!d||d.match(/^fe80::/i))&&(d=ie.address,m=ie.netmask),g=ie.mac;let vi=parseInt(process.versions.node.split("."),10);g.indexOf("00:00:0")>-1&&(it||ot)&&!ie.internal&&vi>=8&&vi<=11&&(Object.keys(Bs).length===0&&(Bs=Ro()),g=Bs[u]||"")});let Z=u.split(":")[0].trim().toLowerCase(),B="",ae=D.isPrototypePolluted()?"---":D.sanitizeShellString(Z),fe=D.mathMin(ae.length,2e3);for(let ie=0;ie<=fe;ie++)ae[ie]!==void 0&&(B=B+ae[ie]);let _e=`echo -n "addr_assign_type: "; cat /sys/class/net/${B}/addr_assign_type 2>/dev/null; echo;
|
|
230
|
+
echo -n "address: "; cat /sys/class/net/${B}/address 2>/dev/null; echo;
|
|
231
|
+
echo -n "addr_len: "; cat /sys/class/net/${B}/addr_len 2>/dev/null; echo;
|
|
232
|
+
echo -n "broadcast: "; cat /sys/class/net/${B}/broadcast 2>/dev/null; echo;
|
|
233
|
+
echo -n "carrier: "; cat /sys/class/net/${B}/carrier 2>/dev/null; echo;
|
|
234
|
+
echo -n "carrier_changes: "; cat /sys/class/net/${B}/carrier_changes 2>/dev/null; echo;
|
|
235
|
+
echo -n "dev_id: "; cat /sys/class/net/${B}/dev_id 2>/dev/null; echo;
|
|
236
|
+
echo -n "dev_port: "; cat /sys/class/net/${B}/dev_port 2>/dev/null; echo;
|
|
237
|
+
echo -n "dormant: "; cat /sys/class/net/${B}/dormant 2>/dev/null; echo;
|
|
238
|
+
echo -n "duplex: "; cat /sys/class/net/${B}/duplex 2>/dev/null; echo;
|
|
239
|
+
echo -n "flags: "; cat /sys/class/net/${B}/flags 2>/dev/null; echo;
|
|
240
|
+
echo -n "gro_flush_timeout: "; cat /sys/class/net/${B}/gro_flush_timeout 2>/dev/null; echo;
|
|
241
|
+
echo -n "ifalias: "; cat /sys/class/net/${B}/ifalias 2>/dev/null; echo;
|
|
242
|
+
echo -n "ifindex: "; cat /sys/class/net/${B}/ifindex 2>/dev/null; echo;
|
|
243
|
+
echo -n "iflink: "; cat /sys/class/net/${B}/iflink 2>/dev/null; echo;
|
|
244
|
+
echo -n "link_mode: "; cat /sys/class/net/${B}/link_mode 2>/dev/null; echo;
|
|
245
|
+
echo -n "mtu: "; cat /sys/class/net/${B}/mtu 2>/dev/null; echo;
|
|
246
|
+
echo -n "netdev_group: "; cat /sys/class/net/${B}/netdev_group 2>/dev/null; echo;
|
|
247
|
+
echo -n "operstate: "; cat /sys/class/net/${B}/operstate 2>/dev/null; echo;
|
|
248
|
+
echo -n "proto_down: "; cat /sys/class/net/${B}/proto_down 2>/dev/null; echo;
|
|
249
|
+
echo -n "speed: "; cat /sys/class/net/${B}/speed 2>/dev/null; echo;
|
|
250
|
+
echo -n "tx_queue_len: "; cat /sys/class/net/${B}/tx_queue_len 2>/dev/null; echo;
|
|
251
|
+
echo -n "type: "; cat /sys/class/net/${B}/type 2>/dev/null; echo;
|
|
252
|
+
echo -n "wireless: "; cat /proc/net/wireless 2>/dev/null | grep ${B}; echo;
|
|
253
|
+
echo -n "wirelessspeed: "; iw dev ${B} link 2>&1 | grep bitrate; echo;`,X=[];try{X=ue(_e,D.execOptsLinux).toString().split(`
|
|
254
|
+
`);let ie=Qu(B);v=sp(B,ie,Mo),x=np(ie),N=ip(ie),T=op(N)}catch{D.noop()}_=D.getValue(X,"duplex"),_=_.startsWith("cat")?"":_,h=parseInt(D.getValue(X,"mtu"),10);let Se=parseInt(D.getValue(X,"speed"),10);y=isNaN(Se)?null:Se;let de=D.getValue(X,"wirelessspeed").split("tx bitrate: ");y===null&&de.length===2&&(Se=parseFloat(de[1]),y=isNaN(Se)?null:Se),S=parseInt(D.getValue(X,"carrier_changes"),10);let De=D.getValue(X,"operstate");J=De==="up"?D.getValue(X,"wireless").trim()?"wireless":"wired":"unknown",(B==="lo"||B.startsWith("bond"))&&(J="virtual");let Pe=i[u]&&i[u][0]?i[u][0].internal:!1;(u.toLowerCase().indexOf("loopback")>-1||E.toLowerCase().indexOf("loopback")>-1)&&(Pe=!0);let ne=Pe?!1:zn(u,E,g);n.push({iface:B,ifaceName:E,default:Z===c,ip4:p,ip4subnet:f,ip6:d,ip6subnet:m,mac:g,internal:Pe,virtual:ne,operstate:De,type:J,duplex:_,mtu:h,speed:y,dhcp:v,dnsSuffix:x,ieee8021xAuth:N,ieee8021xState:T,carrierChanges:S})}}Fs=n,e.toLowerCase().indexOf("default")>=0&&(n=n.filter(u=>u.default),n.length>0?n=n[0]:n=[]),s&&s(n),r(n)}if(fr)if(JSON.stringify(i)===JSON.stringify(ks)&&!t)n=Fs,s&&s(n),r(n);else{ks=JSON.parse(JSON.stringify(i));let c=fs();qu().then(function(u){u.forEach(p=>{let f=!1;Object.keys(i).forEach(d=>{f||i[d].forEach(m=>{Object.keys(m).indexOf("mac")>=0&&(f=m.mac===p.mac)})}),f||(i[p.name]=[{mac:p.mac}])}),l=Yu(),a=Hu();for(let p in i){let f="",d=D.isPrototypePolluted()?"---":D.sanitizeShellString(p),m=D.mathMin(d.length,2e3);for(let X=0;X<=m;X++)d[X]!==void 0&&(f=f+d[X]);let g=p,_="",h="",y="",S="",v="",x="",N="",T=null,J=0,E="down",Z=!1,B="",ae="",fe="",_e="";if({}.hasOwnProperty.call(i,p)){let X=p;i[p].forEach(function(ne){(ne.family==="IPv4"||ne.family===4)&&(_=ne.address,h=ne.netmask),(ne.family==="IPv6"||ne.family===6)&&(!y||y.match(/^fe80::/i))&&(y=ne.address,S=ne.netmask),v=ne.mac;let ie=parseInt(process.versions.node.split("."),10);v.indexOf("00:00:0")>-1&&(it||ot)&&!ne.internal&&ie>=8&&ie<=11&&(Object.keys(Bs).length===0&&(Bs=Ro()),v=Bs[p]||"")}),B=$u(a.ifaces,f);let Se=!1;u.forEach(ne=>{ne.mac===v&&!Se&&(g=ne.iface||g,X=ne.name,Z=ne.dhcp,E=ne.operstate,T=E==="up"?ne.speed:0,_e=ne.type,Se=!0)}),(p.toLowerCase().indexOf("wlan")>=0||X.toLowerCase().indexOf("wlan")>=0||X.toLowerCase().indexOf("802.11n")>=0||X.toLowerCase().indexOf("wireless")>=0||X.toLowerCase().indexOf("wi-fi")>=0||X.toLowerCase().indexOf("wifi")>=0)&&(_e="wireless");let de=Ku(_e,f,l);ae=de.protocol,fe=de.state;let De=i[p]&&i[p][0]?i[p][0].internal:!1;(p.toLowerCase().indexOf("loopback")>-1||X.toLowerCase().indexOf("loopback")>-1)&&(De=!0);let Pe=De?!1:zn(p,X,v);n.push({iface:g,ifaceName:X,default:g===c,ip4:_,ip4subnet:h,ip6:y,ip6subnet:S,mac:v,internal:De,virtual:Pe,operstate:E,type:_e,duplex:x,mtu:N,speed:T,dhcp:Z,dnsSuffix:B,ieee8021xAuth:ae,ieee8021xState:fe,carrierChanges:J})}}Fs=n,e.toLowerCase().indexOf("default")>=0&&(n=n.filter(p=>p.default),n.length>0?n=n[0]:n=[]),s&&s(n),r(n)})}})})}ds.networkInterfaces=qn;function Qr(s,t,e,r,i,n,o,a){let l={iface:s,operstate:r,rx_bytes:t,rx_dropped:i,rx_errors:n,tx_bytes:e,tx_dropped:o,tx_errors:a,rx_sec:null,tx_sec:null,ms:0};return Q[s]&&Q[s].ms?(l.ms=Date.now()-Q[s].ms,l.rx_sec=t-Q[s].rx_bytes>=0?(t-Q[s].rx_bytes)/(l.ms/1e3):0,l.tx_sec=e-Q[s].tx_bytes>=0?(e-Q[s].tx_bytes)/(l.ms/1e3):0,Q[s].rx_bytes=t,Q[s].tx_bytes=e,Q[s].rx_sec=l.rx_sec,Q[s].tx_sec=l.tx_sec,Q[s].ms=Date.now(),Q[s].last_ms=l.ms,Q[s].operstate=r):(Q[s]||(Q[s]={}),Q[s].rx_bytes=t,Q[s].tx_bytes=e,Q[s].rx_sec=null,Q[s].tx_sec=null,Q[s].ms=Date.now(),Q[s].last_ms=0,Q[s].operstate=r),l}function Bo(s,t){let e=[];return new Promise(r=>{process.nextTick(()=>{if(D.isFunction(s)&&!t)t=s,e=[fs()];else{if(typeof s!="string"&&s!==void 0)return t&&t([]),r([]);s=s||fs(),s.__proto__.toLowerCase=D.stringToLower,s.__proto__.replace=D.stringReplace,s.__proto__.trim=D.stringTrim,s=s.trim().toLowerCase().replace(/,+/g,"|"),e=s.split("|")}let i=[],n=[];if(e.length&&e[0].trim()==="*")e=[],qn(!1).then(o=>{for(let a of o)e.push(a.iface);Bo(e.join(",")).then(a=>{t&&t(a),r(a)})});else{for(let o of e)n.push(ap(o.trim()));n.length?Promise.all(n).then(o=>{t&&t(o),r(o)}):(t&&t(i),r(i))}})})}function ap(s){function t(e){let r=[];for(let i in e)if({}.hasOwnProperty.call(e,i)&&e[i].trim()!==""){let n=e[i].trim().split(`\r
|
|
255
|
+
`);r.push({name:D.getValue(n,"Name",":").replace(/[()[\] ]+/g,"").replace(/#|\//g,"_").toLowerCase(),rx_bytes:parseInt(D.getValue(n,"BytesReceivedPersec",":"),10),rx_errors:parseInt(D.getValue(n,"PacketsReceivedErrors",":"),10),rx_dropped:parseInt(D.getValue(n,"PacketsReceivedDiscarded",":"),10),tx_bytes:parseInt(D.getValue(n,"BytesSentPersec",":"),10),tx_errors:parseInt(D.getValue(n,"PacketsOutboundErrors",":"),10),tx_dropped:parseInt(D.getValue(n,"PacketsOutboundDiscarded",":"),10)})}return r}return new Promise(e=>{process.nextTick(()=>{let r="",i=D.isPrototypePolluted()?"---":D.sanitizeShellString(s),n=D.mathMin(i.length,2e3);for(let h=0;h<=n;h++)i[h]!==void 0&&(r=r+i[h]);let o={iface:r,operstate:"unknown",rx_bytes:0,rx_dropped:0,rx_errors:0,tx_bytes:0,tx_dropped:0,tx_errors:0,rx_sec:null,tx_sec:null,ms:0},a="unknown",l=0,c=0,u=0,p=0,f=0,d=0,m,g,_;if(!Q[r]||Q[r]&&!Q[r].ms||Q[r]&&Q[r].ms&&Date.now()-Q[r].ms>=500){if(it&&(Gu.existsSync("/sys/class/net/"+r)?(m="cat /sys/class/net/"+r+"/operstate; cat /sys/class/net/"+r+"/statistics/rx_bytes; cat /sys/class/net/"+r+"/statistics/tx_bytes; cat /sys/class/net/"+r+"/statistics/rx_dropped; cat /sys/class/net/"+r+"/statistics/rx_errors; cat /sys/class/net/"+r+"/statistics/tx_dropped; cat /sys/class/net/"+r+"/statistics/tx_errors; ",Ne(m,function(h,y){h||(g=y.toString().split(`
|
|
256
|
+
`),a=g[0].trim(),l=parseInt(g[1],10),c=parseInt(g[2],10),u=parseInt(g[3],10),p=parseInt(g[4],10),f=parseInt(g[5],10),d=parseInt(g[6],10),o=Qr(r,l,c,a,u,p,f,d)),e(o)})):e(o)),(Pt||Tt||Vt)&&(m="netstat -ibndI "+r,Ne(m,function(h,y){if(!h){g=y.toString().split(`
|
|
257
|
+
`);for(let S=1;S<g.length;S++){let v=g[S].replace(/ +/g," ").split(" ");v&&v[0]&&v[7]&&v[10]&&(l=l+parseInt(v[7]),v[6].trim()!=="-"&&(u=u+parseInt(v[6])),v[5].trim()!=="-"&&(p=p+parseInt(v[5])),c=c+parseInt(v[10]),v[12].trim()!=="-"&&(f=f+parseInt(v[12])),v[9].trim()!=="-"&&(d=d+parseInt(v[9])),a="up")}o=Qr(r,l,c,a,u,p,f,d)}e(o)})),ot&&(m="ifconfig "+r+' | grep "status"',Ne(m,function(h,y){o.operstate=(y.toString().split(":")[1]||"").trim(),o.operstate=(o.operstate||"").toLowerCase(),o.operstate=o.operstate==="active"?"up":o.operstate==="inactive"?"down":"unknown",m="netstat -bdI "+r,Ne(m,function(S,v){if(!S&&(g=v.toString().split(`
|
|
258
|
+
`),g.length>1&&g[1].trim()!=="")){_=g[1].replace(/ +/g," ").split(" ");let x=_.length>11?1:0;l=parseInt(_[x+5]),u=parseInt(_[x+10]),p=parseInt(_[x+4]),c=parseInt(_[x+8]),f=parseInt(_[x+10]),d=parseInt(_[x+7]),o=Qr(r,l,c,o.operstate,u,p,f,d)}e(o)})})),fr){let h=[],y=r;D.powerShell("Get-CimInstance Win32_PerfRawData_Tcpip_NetworkInterface | select Name,BytesReceivedPersec,PacketsReceivedErrors,PacketsReceivedDiscarded,BytesSentPersec,PacketsOutboundErrors,PacketsOutboundDiscarded | fl").then((S,v)=>{if(!v){let x=S.toString().split(/\n\s*\n/);h=t(x)}qn(!1).then(x=>{l=0,c=0,h.forEach(N=>{x.forEach(T=>{(T.iface.toLowerCase()===r.toLowerCase()||T.mac.toLowerCase()===r.toLowerCase()||T.ip4.toLowerCase()===r.toLowerCase()||T.ip6.toLowerCase()===r.toLowerCase()||T.ifaceName.replace(/[()[\] ]+/g,"").replace(/#|\//g,"_").toLowerCase()===r.replace(/[()[\] ]+/g,"").replace("#","_").toLowerCase())&&T.ifaceName.replace(/[()[\] ]+/g,"").replace(/#|\//g,"_").toLowerCase()===N.name&&(y=T.iface,l=N.rx_bytes,u=N.rx_dropped,p=N.rx_errors,c=N.tx_bytes,f=N.tx_dropped,d=N.tx_errors,a=T.operstate)})}),l&&c&&(o=Qr(y,parseInt(l),parseInt(c),a,u,p,f,d)),e(o)})})}}else o.rx_bytes=Q[r].rx_bytes,o.tx_bytes=Q[r].tx_bytes,o.rx_sec=Q[r].rx_sec,o.tx_sec=Q[r].tx_sec,o.ms=Q[r].last_ms,o.operstate=Q[r].operstate,e(o)})})}ds.networkStats=Bo;function lp(s,t){let e="";s.forEach(i=>{let n=i.split(" ");(parseInt(n[0],10)||-1)===t&&(n.shift(),e=n.join(" ").split(":")[0])}),e=e.split(" -")[0];let r=e.split("/");return r[r.length-1]}function cp(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(it||Pt||Tt||Vt){let r='export LC_ALL=C; netstat -tunap | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL';(Pt||Tt||Vt)&&(r='export LC_ALL=C; netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL'),Ne(r,{maxBuffer:1024*2e4},function(i,n){let o=n.toString().split(`
|
|
259
|
+
`);!i&&(o.length>1||o[0]!="")?(o.forEach(function(a){if(a=a.replace(/ +/g," ").split(" "),a.length>=7){let l=a[3],c="",u=a[3].split(":");u.length>1&&(c=u[u.length-1],u.pop(),l=u.join(":"));let p=a[4],f="",d=a[4].split(":");d.length>1&&(f=d[d.length-1],d.pop(),p=d.join(":"));let m=a[5],g=a[6].split("/");m&&e.push({protocol:a[0],localAddress:l,localPort:c,peerAddress:p,peerPort:f,state:m,pid:g[0]&&g[0]!=="-"?parseInt(g[0],10):null,process:g[1]?g[1].split(" ")[0].split(":")[0]:""})}}),s&&s(e),t(e)):(r='ss -tunap | grep "ESTAB\\|SYN-SENT\\|SYN-RECV\\|FIN-WAIT1\\|FIN-WAIT2\\|TIME-WAIT\\|CLOSE\\|CLOSE-WAIT\\|LAST-ACK\\|LISTEN\\|CLOSING"',Ne(r,{maxBuffer:1024*2e4},function(a,l){a||l.toString().split(`
|
|
260
|
+
`).forEach(function(u){if(u=u.replace(/ +/g," ").split(" "),u.length>=6){let p=u[4],f="",d=u[4].split(":");d.length>1&&(f=d[d.length-1],d.pop(),p=d.join(":"));let m=u[5],g="",_=u[5].split(":");_.length>1&&(g=_[_.length-1],_.pop(),m=_.join(":"));let h=u[1];h==="ESTAB"&&(h="ESTABLISHED"),h==="TIME-WAIT"&&(h="TIME_WAIT");let y=null,S="";if(u.length>=7&&u[6].indexOf("users:")>-1){let v=u[6].replace('users:(("',"").replace(/"/g,"").split(",");v.length>2&&(S=v[0].split(" ")[0].split(":")[0],y=parseInt(v[1],10))}h&&e.push({protocol:u[0],localAddress:p,localPort:f,peerAddress:m,peerPort:g,state:h,pid:y,process:S})}}),s&&s(e),t(e)}))})}if(ot){let r='netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"',i="ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN";Ne(r,{maxBuffer:1024*2e4},function(n,o){n||Ne("ps -axo pid,command",{maxBuffer:1024*2e4},function(a,l){let c=l.toString().split(`
|
|
261
|
+
`);c=c.map(p=>p.trim().replace(/ +/g," ")),o.toString().split(`
|
|
262
|
+
`).forEach(function(p){if(p=p.replace(/ +/g," ").split(" "),p.length>=8){let f=p[3],d="",m=p[3].split(".");m.length>1&&(d=m[m.length-1],m.pop(),f=m.join("."));let g=p[4],_="",h=p[4].split(".");h.length>1&&(_=h[h.length-1],h.pop(),g=h.join("."));let y=i.indexOf(p[5])>=0,S=y?p[5]:"UNKNOWN",v=parseInt(p[8+(y?0:-1)],10);S&&e.push({protocol:p[0],localAddress:f,localPort:d,peerAddress:g,peerPort:_,state:S,pid:v,process:lp(c,v)})}}),s&&s(e),t(e)})})}if(fr){let r="netstat -nao";try{Ne(r,D.execOptsWin,function(i,n){i||(n.toString().split(`\r
|
|
263
|
+
`).forEach(function(a){if(a=a.trim().replace(/ +/g," ").split(" "),a.length>=4){let l=a[1],c="",u=a[1].split(":");u.length>1&&(c=u[u.length-1],u.pop(),l=u.join(":")),l=l.replace(/\[/g,"").replace(/\]/g,"");let p=a[2],f="",d=a[2].split(":");d.length>1&&(f=d[d.length-1],d.pop(),p=d.join(":")),p=p.replace(/\[/g,"").replace(/\]/g,"");let m=D.toInt(a[4]),g=a[3];g==="HERGESTELLT"&&(g="ESTABLISHED"),g.startsWith("ABH")&&(g="LISTEN"),g==="SCHLIESSEN_WARTEN"&&(g="CLOSE_WAIT"),g==="WARTEND"&&(g="TIME_WAIT"),g==="SYN_GESENDET"&&(g="SYN_SENT"),g==="LISTENING"&&(g="LISTEN"),g==="SYN_RECEIVED"&&(g="SYN_RECV"),g==="FIN_WAIT_1"&&(g="FIN_WAIT1"),g==="FIN_WAIT_2"&&(g="FIN_WAIT2"),a[0].toLowerCase()!=="udp"&&g?e.push({protocol:a[0].toLowerCase(),localAddress:l,localPort:c,peerAddress:p,peerPort:f,state:g,pid:m,process:""}):a[0].toLowerCase()==="udp"&&e.push({protocol:a[0].toLowerCase(),localAddress:l,localPort:c,peerAddress:p,peerPort:f,state:"",pid:parseInt(a[3],10),process:""})}}),s&&s(e),t(e))})}catch{s&&s(e),t(e)}}})})}ds.networkConnections=cp;function up(s){return new Promise(t=>{process.nextTick(()=>{let e="";if(it||Pt||Tt||Vt){let r="ip route get 1";try{Ne(r,{maxBuffer:1024*2e4},function(i,n){if(i)s&&s(e),t(e);else{let o=n.toString().split(`
|
|
264
|
+
`),l=(o&&o[0]?o[0]:"").split(" via ");l&&l[1]&&(l=l[1].split(" "),e=l[0]),s&&s(e),t(e)}})}catch{s&&s(e),t(e)}}if(ot){let r="route -n get default";try{Ne(r,{maxBuffer:1024*2e4},function(i,n){if(!i){let o=n.toString().split(`
|
|
265
|
+
`).map(a=>a.trim());e=D.getValue(o,"gateway")}e?(s&&s(e),t(e)):(r="netstat -rn | awk '/default/ {print $2}'",Ne(r,{maxBuffer:1024*2e4},function(o,a){e=a.toString().split(`
|
|
266
|
+
`).map(c=>c.trim()).find(c=>/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(c)),s&&s(e),t(e)}))})}catch{s&&s(e),t(e)}}if(fr)try{Ne("netstat -r",D.execOptsWin,function(r,i){i.toString().split(en.EOL).forEach(o=>{if(o=o.replace(/\s+/g," ").trim(),o.indexOf("0.0.0.0 0.0.0.0")>-1&&!/[a-zA-Z]/.test(o)){let a=o.split(" ");a.length>=5&&a[a.length-3].indexOf(".")>-1&&(e=a[a.length-3])}}),e?(s&&s(e),t(e)):D.powerShell("Get-CimInstance -ClassName Win32_IP4RouteTable | Where-Object { $_.Destination -eq '0.0.0.0' -and $_.Mask -eq '0.0.0.0' }").then(o=>{let a=o.toString().split(`\r
|
|
267
|
+
`);a.length>1&&!e&&(e=D.getValue(a,"NextHop"),s&&s(e),t(e))})})}catch{s&&s(e),t(e)}})})}ds.networkGatewayDefault=up});var Ho=le(nn=>{"use strict";var dr=require("os"),tn=require("child_process").exec,Nt=require("child_process").execSync,I=ce(),sn=process.platform,Hn=sn==="linux"||sn==="android",$n=sn==="darwin",Yn=sn==="win32";function Xn(s){let t=parseFloat(s);return t<0?0:t>=100?-50:t/2-100}function rn(s){let t=2*(parseFloat(s)+100);return t<=100?t:100}var mr={1:2412,2:2417,3:2422,4:2427,5:2432,6:2437,7:2442,8:2447,9:2452,10:2457,11:2462,12:2467,13:2472,14:2484,32:5160,34:5170,36:5180,38:5190,40:5200,42:5210,44:5220,46:5230,48:5240,50:5250,52:5260,54:5270,56:5280,58:5290,60:5300,62:5310,64:5320,68:5340,96:5480,100:5500,102:5510,104:5520,106:5530,108:5540,110:5550,112:5560,114:5570,116:5580,118:5590,120:5600,122:5610,124:5620,126:5630,128:5640,132:5660,134:5670,136:5680,138:5690,140:5700,142:5710,144:5720,149:5745,151:5755,153:5765,155:5775,157:5785,159:5795,161:5805,165:5825,169:5845,173:5865,183:4915,184:4920,185:4925,187:4935,188:4940,189:4945,192:4960,196:4980};function Ws(s){return{}.hasOwnProperty.call(mr,s)?mr[s]:null}function pp(s){let t=0;for(let e in mr)({}).hasOwnProperty.call(mr,e)&&mr[e]===s&&(t=I.toInt(e));return t}function jo(){let s=[],t="iw dev 2>/dev/null";try{let r=Nt(t,I.execOptsLinux).toString().split(`
|
|
268
|
+
`).map(i=>i.trim()).join(`
|
|
269
|
+
`).split(`
|
|
270
|
+
Interface `);return r.shift(),r.forEach(i=>{let n=i.split(`
|
|
271
|
+
`),o=n[0],a=I.toInt(I.getValue(n,"ifindex"," ")),l=I.getValue(n,"addr"," "),c=I.toInt(I.getValue(n,"channel"," "));s.push({id:a,iface:o,mac:l,channel:c})}),s}catch{try{let i=Nt("nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null",I.execOptsLinux).toString().split(`
|
|
272
|
+
|
|
273
|
+
`),n=1;return i.forEach(o=>{let a=o.split(`
|
|
274
|
+
`),l=I.getValue(a,"GENERAL.DEVICE"),c=I.getValue(a,"GENERAL.TYPE"),u=n++,p=I.getValue(a,"GENERAL.HWADDR");c.toLowerCase()==="wifi"&&s.push({id:u,iface:l,mac:p,channel:""})}),s}catch{return[]}}}function zo(s){let t=`nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${s} 2>/dev/null`;try{let e=Nt(t,I.execOptsLinux).toString().split(`
|
|
275
|
+
`),r=I.getValue(e,"GENERAL.CONNECTION");return{iface:s,type:I.getValue(e,"GENERAL.TYPE"),vendor:I.getValue(e,"GENERAL.VENDOR"),product:I.getValue(e,"GENERAL.PRODUCT"),mac:I.getValue(e,"GENERAL.HWADDR").toLowerCase(),ssid:r!=="--"?r:null}}catch{return{}}}function fp(s){let t=`nmcli -t --show-secrets connection show ${s} 2>/dev/null`;try{let e=Nt(t,I.execOptsLinux).toString().split(`
|
|
276
|
+
`),r=I.getValue(e,"802-11-wireless.seen-bssids").toLowerCase();return{ssid:s!=="--"?s:null,uuid:I.getValue(e,"connection.uuid"),type:I.getValue(e,"connection.type"),autoconnect:I.getValue(e,"connection.autoconnect")==="yes",security:I.getValue(e,"802-11-wireless-security.key-mgmt"),bssid:r!=="--"?r:null}}catch{return{}}}function dp(s){if(!s)return{};let t=`wpa_cli -i ${s} status 2>&1`;try{let e=Nt(t,I.execOptsLinux).toString().split(`
|
|
277
|
+
`),r=I.toInt(I.getValue(e,"freq","="));return{ssid:I.getValue(e,"ssid","="),uuid:I.getValue(e,"uuid","="),security:I.getValue(e,"key_mgmt","="),freq:r,channel:pp(r),bssid:I.getValue(e,"bssid","=").toLowerCase()}}catch{return{}}}function qo(){let s=[],t="nmcli -t -m multiline --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list 2>/dev/null";try{let r=Nt(t,I.execOptsLinux).toString().split("ACTIVE:");return r.shift(),r.forEach(i=>{i="ACTIVE:"+i;let n=i.split(dr.EOL),o=I.getValue(n,"CHAN"),a=I.getValue(n,"FREQ").toLowerCase().replace("mhz","").trim(),l=I.getValue(n,"SECURITY").replace("(","").replace(")",""),c=I.getValue(n,"WPA-FLAGS").replace("(","").replace(")",""),u=I.getValue(n,"RSN-FLAGS").replace("(","").replace(")",""),p=I.getValue(n,"SIGNAL");s.push({ssid:I.getValue(n,"SSID"),bssid:I.getValue(n,"BSSID").toLowerCase(),mode:I.getValue(n,"MODE"),channel:o?parseInt(o,10):null,frequency:a?parseInt(a,10):null,signalLevel:Xn(p),quality:p?parseInt(p,10):null,security:l&&l!=="none"?l.split(" "):[],wpaFlags:c&&c!=="none"?c.split(" "):[],rsnFlags:u&&u!=="none"?u.split(" "):[]})}),s}catch{return[]}}function Uo(s){let t=[];try{let e=Nt(`export LC_ALL=C; iwlist ${s} scan 2>&1; unset LC_ALL`,I.execOptsLinux).toString().split(" Cell ");return e[0].indexOf("resource busy")>=0?-1:(e.length>1&&(e.shift(),e.forEach(r=>{let i=r.split(`
|
|
278
|
+
`),n=I.getValue(i,"channel",":",!0),o=i&&i.length&&i[0].indexOf("Address:")>=0?i[0].split("Address:")[1].trim().toLowerCase():"",a=I.getValue(i,"mode",":",!0),l=I.getValue(i,"frequency",":",!0),u=I.getValue(i,"Quality","=",!0).toLowerCase().split("signal level="),p=u.length>1?I.toInt(u[1]):0,f=p?rn(p):0,d=I.getValue(i,"essid",":",!0),m=r.indexOf(" WPA ")>=0,g=r.indexOf("WPA2 ")>=0,_=[];m&&_.push("WPA"),g&&_.push("WPA2");let h=[],y="";i.forEach(function(S){let v=S.trim().toLowerCase();if(v.indexOf("group cipher")>=0){y&&h.push(y);let x=v.split(":");x.length>1&&(y=x[1].trim().toUpperCase())}if(v.indexOf("pairwise cipher")>=0){let x=v.split(":");x.length>1&&(x[1].indexOf("tkip")?y=y?"TKIP/"+y:"TKIP":x[1].indexOf("ccmp")?y=y?"CCMP/"+y:"CCMP":x[1].indexOf("proprietary")&&(y=y?"PROP/"+y:"PROP"))}if(v.indexOf("authentication suites")>=0){let x=v.split(":");x.length>1&&(x[1].indexOf("802.1x")?y=y?"802.1x/"+y:"802.1x":x[1].indexOf("psk")&&(y=y?"PSK/"+y:"PSK"))}}),y&&h.push(y),t.push({ssid:d,bssid:o,mode:a,channel:n?I.toInt(n):null,frequency:l?I.toInt(l.replace(".","")):null,signalLevel:p,quality:f,security:_,wpaFlags:h,rsnFlags:[]})})),t)}catch{return-1}}function mp(s){let t=[];return s&&s.forEach(function(e){let r=e.RSSI,i=[],n=[],o=e.SSID_STR||"";if(e.WPA_IE&&(i.push("WPA"),e.WPA_IE.IE_KEY_WPA_UCIPHERS&&e.WPA_IE.IE_KEY_WPA_UCIPHERS.forEach(function(a){a===0&&n.indexOf("unknown/TKIP")===-1&&n.push("unknown/TKIP"),a===2&&n.indexOf("PSK/TKIP")===-1&&n.push("PSK/TKIP"),a===4&&n.indexOf("PSK/AES")===-1&&n.push("PSK/AES")})),e.RSN_IE&&(i.push("WPA2"),e.RSN_IE.IE_KEY_RSN_UCIPHERS&&e.RSN_IE.IE_KEY_RSN_UCIPHERS.forEach(function(a){a===0&&n.indexOf("unknown/TKIP")===-1&&n.push("unknown/TKIP"),a===2&&n.indexOf("TKIP/TKIP")===-1&&n.push("TKIP/TKIP"),a===4&&n.indexOf("PSK/AES")===-1&&n.push("PSK/AES")})),e.SSID&&o==="")try{o=Buffer.from(e.SSID,"base64").toString("utf8")}catch{I.noop()}t.push({ssid:o,bssid:e.BSSID||"",mode:"",channel:e.CHANNEL,frequency:Ws(e.CHANNEL),signalLevel:r?parseInt(r,10):null,quality:rn(r),security:i,wpaFlags:n,rsnFlags:[]})}),t}function hp(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(Hn)if(e=qo(),e.length===0)try{let r=Nt("export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL",I.execOptsLinux).toString().split(`
|
|
279
|
+
|
|
280
|
+
`),i="";if(r.forEach(n=>{n.indexOf("no wireless")===-1&&n.trim()!==""&&(i=n.split(" ")[0])}),i){let n="",o=I.isPrototypePolluted()?"---":I.sanitizeShellString(i,!0),a=I.mathMin(o.length,2e3);for(let c=0;c<=a;c++)o[c]!==void 0&&(n=n+o[c]);let l=Uo(n);l===-1?setTimeout(function(c){let u=Uo(c);u!=-1&&(e=u),s&&s(e),t(e)},4e3):(e=l,s&&s(e),t(e))}else s&&s(e),t(e)}catch{s&&s(e),t(e)}else s&&s(e),t(e);else $n?tn("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s -x",{maxBuffer:1024*4e4},function(i,n){let o=n.toString();e=mp(I.plistParser(o)),s&&s(e),t(e)}):Yn?I.powerShell("netsh wlan show networks mode=Bssid").then(i=>{let n=i.toString("utf8").split(dr.EOL+dr.EOL+"SSID ");n.shift(),n.forEach(o=>{let a=o.split(dr.EOL);if(a&&a.length>=8&&a[0].indexOf(":")>=0){let l=o.split(" BSSID");l.shift(),l.forEach(c=>{let u=c.split(dr.EOL),p=u[0].split(":");p.shift();let f=p.join(":").trim().toLowerCase(),d=u[3].split(":").pop().trim(),m=u[1].split(":").pop().trim();e.push({ssid:a[0].split(":").pop().trim(),bssid:f,mode:"",channel:d?parseInt(d,10):null,frequency:Ws(d),signalLevel:Xn(m),quality:m?parseInt(m,10):null,security:[a[2].split(":").pop().trim()],wpaFlags:[a[3].split(":").pop().trim()],rsnFlags:[]})})}}),s&&s(e),t(e)}):(s&&s(e),t(e))})})}nn.wifiNetworks=hp;function gp(s){s=s.toLowerCase();let t="";return s.indexOf("intel")>=0?t="Intel":s.indexOf("realtek")>=0?t="Realtek":s.indexOf("qualcom")>=0?t="Qualcom":s.indexOf("broadcom")>=0?t="Broadcom":s.indexOf("cavium")>=0?t="Cavium":s.indexOf("cisco")>=0?t="Cisco":s.indexOf("marvel")>=0?t="Marvel":s.indexOf("zyxel")>=0?t="Zyxel":s.indexOf("melanox")>=0?t="Melanox":s.indexOf("d-link")>=0?t="D-Link":s.indexOf("tp-link")>=0?t="TP-Link":s.indexOf("asus")>=0?t="Asus":s.indexOf("linksys")>=0&&(t="Linksys"),t}function Go(s){return s=s.replace(/</g,"").replace(/>/g,"").match(/.{1,2}/g)||[],s.join(":")}function yp(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(Hn){let r=jo(),i=qo();r.forEach(n=>{let o="",a=I.isPrototypePolluted()?"---":I.sanitizeShellString(n.iface,!0),l=I.mathMin(a.length,2e3);for(let v=0;v<=l;v++)a[v]!==void 0&&(o=o+a[v]);let c=zo(o),u=dp(o),p=c.ssid||u.ssid,f=i.filter(v=>v.ssid===p),d="",m=I.isPrototypePolluted()?"---":I.sanitizeShellString(p,!0),g=I.mathMin(m.length,2e3);for(let v=0;v<=g;v++)m[v]!==void 0&&(d=d+m[v]);let _=fp(d),h=f&&f.length&&f[0].channel?f[0].channel:u.channel?u.channel:null,y=f&&f.length&&f[0].bssid?f[0].bssid:u.bssid?u.bssid:null,S=f&&f.length&&f[0].signalLevel?f[0].signalLevel:null;p&&y&&e.push({id:n.id,iface:n.iface,model:c.product,ssid:p,bssid:f&&f.length&&f[0].bssid?f[0].bssid:u.bssid?u.bssid:null,channel:h,frequency:h?Ws(h):null,type:_.type?_.type:"802.11",security:_.security?_.security:u.security?u.security:null,signalLevel:S,quality:rn(S),txRate:null})}),s&&s(e),t(e)}else if($n){let r="system_profiler SPNetworkDataType";tn(r,function(i,n){let o=n.toString().split(`
|
|
281
|
+
|
|
282
|
+
Wi-Fi:
|
|
283
|
+
|
|
284
|
+
`);if(o.length>1){let a=o[1].split(`
|
|
285
|
+
|
|
286
|
+
`)[0].split(`
|
|
287
|
+
`),l=I.getValue(a,"BSD Device Name",":",!0),c=I.getValue(a,"hardware",":",!0);r='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I 2>/dev/null; echo "######" ; ioreg -n AppleBCMWLANSkywalkInterface -r 2>/dev/null',tn(r,function(u,p){let f=p.toString().split("######"),d=f[0].split(`
|
|
288
|
+
`),m=[];if(f[1].indexOf(" | {")>0&&f[1].indexOf(" | }")>f[1].indexOf(" | {")&&(m=f[1].split(" | {")[1].split(" | }")[0].replace(/ \| /g,"").replace(/"/g,"").split(`
|
|
289
|
+
`)),d.length>10){let g=I.getValue(d,"ssid",":",!0),_=I.getValue(d,"bssid",":",!0)||Go(I.getValue(m,"IO80211BSSID","=",!0)),h=I.getValue(d,"link auth",":",!0),y=I.getValue(d,"lastTxRate",":",!0),S=I.getValue(d,"channel",":",!0).split(",")[0],v="802.11",N=I.toInt(I.getValue(d,"agrCtlRSSI",":",!0));(g||_)&&e.push({id:"Wi-Fi",iface:l,model:c,ssid:g,bssid:_,channel:I.toInt(S),frequency:S?Ws(S):null,type:v,security:h,signalLevel:N,quality:rn(N),txRate:y})}if(m.length>10){let g=I.getValue(m,"IO80211SSID","=",!0),_=Go(I.getValue(m,"IO80211BSSID","=",!0)),h="",y=-1,S=-1,v=-1,x=I.getValue(m,"IO80211Channel","=",!0);(g||_)&&!e.length&&e.push({id:"Wi-Fi",iface:l,model:c,ssid:g,bssid:_,channel:I.toInt(x),frequency:x?Ws(x):null,type:"802.11",security:h,signalLevel:S,quality:v,txRate:y})}s&&s(e),t(e)})}else s&&s(e),t(e)})}else Yn?I.powerShell("netsh wlan show interfaces").then(function(i){let n=i.toString().split(`\r
|
|
290
|
+
`);for(let a=0;a<n.length;a++)n[a]=n[a].trim();let o=n.join(`\r
|
|
291
|
+
`).split(`:\r
|
|
292
|
+
\r
|
|
293
|
+
`);o.shift(),o.forEach(a=>{let l=a.split(`\r
|
|
294
|
+
`);if(l.length>=5){let c=l[0].indexOf(":")>=0?l[0].split(":")[1].trim():"",u=l[1].indexOf(":")>=0?l[1].split(":")[1].trim():"",p=l[2].indexOf(":")>=0?l[2].split(":")[1].trim():"",f=I.getValue(l,"SSID",":",!0),d=I.getValue(l,"BSSID",":",!0),m=I.getValue(l,"Signal",":",!0),g=Xn(m),_=I.getValue(l,"Radio type",":",!0)||I.getValue(l,"Type de radio",":",!0)||I.getValue(l,"Funktyp",":",!0)||null,h=I.getValue(l,"authentication",":",!0)||I.getValue(l,"Authentification",":",!0)||I.getValue(l,"Authentifizierung",":",!0)||null,y=I.getValue(l,"Channel",":",!0)||I.getValue(l,"Canal",":",!0)||I.getValue(l,"Kanal",":",!0)||null,S=I.getValue(l,"Transmit rate (mbps)",":",!0)||I.getValue(l,"Transmission (mbit/s)",":",!0)||I.getValue(l,"Empfangsrate (MBit/s)",":",!0)||null;u&&p&&f&&d&&e.push({id:p,iface:c,model:u,ssid:f,bssid:d,channel:I.toInt(y),frequency:y?Ws(y):null,type:_,security:h,signalLevel:g,quality:m?parseInt(m,10):null,txRate:I.toInt(S)||null})}}),s&&s(e),t(e)}):(s&&s(e),t(e))})})}nn.wifiConnections=yp;function _p(s){return new Promise(t=>{process.nextTick(()=>{let e=[];Hn?(jo().forEach(i=>{let n=zo(i.iface);e.push({id:i.id,iface:i.iface,model:n.product?n.product:null,vendor:n.vendor?n.vendor:null,mac:i.mac})}),s&&s(e),t(e)):$n?tn("system_profiler SPNetworkDataType",function(i,n){let o=n.toString().split(`
|
|
295
|
+
|
|
296
|
+
Wi-Fi:
|
|
297
|
+
|
|
298
|
+
`);if(o.length>1){let a=o[1].split(`
|
|
299
|
+
|
|
300
|
+
`)[0].split(`
|
|
301
|
+
`),l=I.getValue(a,"BSD Device Name",":",!0),c=I.getValue(a,"MAC Address",":",!0),u=I.getValue(a,"hardware",":",!0);e.push({id:"Wi-Fi",iface:l,model:u,vendor:"",mac:c})}s&&s(e),t(e)}):Yn?I.powerShell("netsh wlan show interfaces").then(function(i){let n=i.toString().split(`\r
|
|
302
|
+
`);for(let a=0;a<n.length;a++)n[a]=n[a].trim();let o=n.join(`\r
|
|
303
|
+
`).split(`:\r
|
|
304
|
+
\r
|
|
305
|
+
`);o.shift(),o.forEach(a=>{let l=a.split(`\r
|
|
306
|
+
`);if(l.length>=5){let c=l[0].indexOf(":")>=0?l[0].split(":")[1].trim():"",u=l[1].indexOf(":")>=0?l[1].split(":")[1].trim():"",p=l[2].indexOf(":")>=0?l[2].split(":")[1].trim():"",f=l[3].indexOf(":")>=0?l[3].split(":"):[];f.shift();let d=f.join(":").trim(),m=gp(u);c&&u&&p&&d&&e.push({id:p,iface:c,model:u,vendor:m,mac:d})}}),s&&s(e),t(e)}):(s&&s(e),t(e))})})}nn.wifiInterfaces=_p});var Xo=le(ln=>{"use strict";var an=require("os"),Sp=require("fs"),vp=require("path"),hr=require("child_process").exec,Kn=require("child_process").execSync,j=ce(),Dt=process.platform,Qe=Dt==="linux"||Dt==="android",ms=Dt==="darwin",Zn=Dt==="win32",gr=Dt==="freebsd",yr=Dt==="openbsd",_r=Dt==="netbsd",on=Dt==="sunos",he={all:0,all_utime:0,all_stime:0,list:{},ms:0,result:{}},Us={all:0,all_utime:0,all_stime:0,list:{},ms:0,result:{}},Ee={all:0,all_utime:0,all_stime:0,list:{},ms:0,result:{}},$o={0:"unknown",1:"other",2:"ready",3:"running",4:"blocked",5:"suspended blocked",6:"suspended ready",7:"terminated",8:"stopped",9:"growing"};function xp(s){let t=s,e=s.replace(/ +/g," ").split(" ");return e.length===5&&(t=e[4]+"-"+("0"+("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC".indexOf(e[1].toUpperCase())/3+1)).slice(-2)+"-"+("0"+e[2]).slice(-2)+" "+e[3]),t}function wp(s){let t=new Date;t=new Date(t.getTime()-t.getTimezoneOffset()*6e4);let e=s.split("-"),r=e.length-1,i=r>0?parseInt(e[r-1]):0,n=e[r].split(":"),o=n.length===3?parseInt(n[0]||0):0,a=parseInt(n[n.length===3?1:0]||0),l=parseInt(n[n.length===3?2:1]||0),c=(((i*24+o)*60+a)*60+l)*1e3,u=new Date(t.getTime()),p=u.toISOString().substring(0,10)+" "+u.toISOString().substring(11,19);try{u=new Date(t.getTime()-c),p=u.toISOString().substring(0,10)+" "+u.toISOString().substring(11,19)}catch{j.noop()}return p}function Cp(s,t){return j.isFunction(s)&&!t&&(t=s,s=""),new Promise(e=>{process.nextTick(()=>{if(typeof s!="string")return t&&t([]),e([]);if(s){let r="";r.__proto__.toLowerCase=j.stringToLower,r.__proto__.replace=j.stringReplace,r.__proto__.trim=j.stringTrim;let i=j.sanitizeShellString(s),n=j.mathMin(i.length,2e3);for(let c=0;c<=n;c++)i[c]!==void 0&&(r=r+i[c]);r=r.trim().toLowerCase().replace(/, /g,"|").replace(/,+/g,"|"),r===""&&(r="*"),j.isPrototypePolluted()&&r!=="*"&&(r="------");let o=r.split("|"),a=[],l=[];if(Qe||gr||yr||_r||ms){if((Qe||gr||yr||_r)&&r==="*")try{let u=Kn("systemctl --all --type=service --no-legend 2> /dev/null",j.execOptsLinux).toString().split(`
|
|
307
|
+
`);o=[];for(let p of u){let f=p.split(".service")[0];f&&p.indexOf(" not-found ")===-1&&o.push(f.trim())}r=o.join("|")}catch{try{r="";let p=Kn("service --status-all 2> /dev/null",j.execOptsLinux).toString().split(`
|
|
308
|
+
`);for(let f of p){let d=f.split("]");d.length===2&&(r+=(r!==""?"|":"")+d[1].trim())}o=r.split("|")}catch{try{let f=Kn("ls /etc/init.d/ -m 2> /dev/null",j.execOptsLinux).toString().split(`
|
|
309
|
+
`).join("");if(r="",f){let d=f.split(",");for(let m of d){let g=m.trim();g&&(r+=(r!==""?"|":"")+g)}o=r.split("|")}}catch{r="",o=[]}}}ms&&r==="*"&&(t&&t(a),e(a));let c=ms?["-caxo","pcpu,pmem,pid,command"]:["-axo","pcpu,pmem,pid,command"];r!==""&&o.length>0?j.execSafe("ps",c).then(u=>{if(u){let p=u.replace(/ +/g," ").replace(/,+/g,".").split(`
|
|
310
|
+
`);if(o.forEach(function(f){let d;ms?d=p.filter(function(g){return g.toLowerCase().indexOf(f)!==-1}):d=p.filter(function(g){return g.toLowerCase().indexOf(" "+f.toLowerCase()+":")!==-1||g.toLowerCase().indexOf("/"+f.toLowerCase())!==-1});let m=[];for(let g of d){let _=g.trim().split(" ")[2];_&&m.push(parseInt(_,10))}a.push({name:f,running:d.length>0,startmode:"",pids:m,cpu:parseFloat(d.reduce(function(g,_){return g+parseFloat(_.trim().split(" ")[0])},0).toFixed(2)),mem:parseFloat(d.reduce(function(g,_){return g+parseFloat(_.trim().split(" ")[1])},0).toFixed(2))})}),Qe){let f='cat /proc/stat | grep "cpu "';for(let d in a)for(let m in a[d].pids)f+=";cat /proc/"+a[d].pids[m]+"/stat";hr(f,{maxBuffer:1024*2e4},function(d,m){let g=m.toString().split(`
|
|
311
|
+
`),_=Jn(g.shift()),h={},y={};g.forEach(S=>{if(y=Qn(S,_,Us),y.pid){let v=-1;for(let x in a)for(let N in a[x].pids)parseInt(a[x].pids[N])===parseInt(y.pid)&&(v=x);v>=0&&(a[v].cpu+=y.cpuu+y.cpus),h[y.pid]={cpuu:y.cpuu,cpus:y.cpus,utime:y.utime,stime:y.stime,cutime:y.cutime,cstime:y.cstime}}}),Us.all=_,Us.list=Object.assign({},h),Us.ms=Date.now()-Us.ms,Us.result=Object.assign({},a),t&&t(a),e(a)})}else t&&t(a),e(a)}else c=["-o","comm"],j.execSafe("ps",c).then(p=>{if(p){let f=p.replace(/ +/g," ").replace(/,+/g,".").split(`
|
|
312
|
+
`);o.forEach(function(d){let m=f.filter(function(g){return g.indexOf(d)!==-1});a.push({name:d,running:m.length>0,startmode:"",cpu:0,mem:0})}),t&&t(a),e(a)}else o.forEach(function(f){a.push({name:f,running:!1,startmode:"",cpu:0,mem:0})}),t&&t(a),e(a)})}):(t&&t(a),e(a))}if(Zn)try{let c="Get-CimInstance Win32_Service";o[0]!=="*"&&(c+=' -Filter "',o.forEach(u=>{c+=`Name='${u}' or `}),c=`${c.slice(0,-4)}"`),c+=" | select Name,Caption,Started,StartMode,ProcessId | fl",j.powerShell(c).then((u,p)=>{p?(o.forEach(function(f){a.push({name:f,running:!1,startmode:"",cpu:0,mem:0})}),t&&t(a),e(a)):(u.split(/\n\s*\n/).forEach(d=>{if(d.trim()!==""){let m=d.trim().split(`\r
|
|
313
|
+
`),g=j.getValue(m,"Name",":",!0).toLowerCase(),_=j.getValue(m,"Caption",":",!0).toLowerCase(),h=j.getValue(m,"Started",":",!0),y=j.getValue(m,"StartMode",":",!0),S=j.getValue(m,"ProcessId",":",!0);(r==="*"||o.indexOf(g)>=0||o.indexOf(_)>=0)&&(a.push({name:g,running:h.toLowerCase()==="true",startmode:y,pids:[S],cpu:0,mem:0}),l.push(g),l.push(_))}}),r!=="*"&&o.filter(function(m){return l.indexOf(m)===-1}).forEach(function(m){a.push({name:m,running:!1,startmode:"",pids:[],cpu:0,mem:0})}),t&&t(a),e(a))})}catch{t&&t(a),e(a)}}else t&&t([]),e([])})})}ln.services=Cp;function Jn(s){let t=s.replace(/ +/g," ").split(" "),e=t.length>=2?parseInt(t[1]):0,r=t.length>=3?parseInt(t[2]):0,i=t.length>=4?parseInt(t[3]):0,n=t.length>=5?parseInt(t[4]):0,o=t.length>=6?parseInt(t[5]):0,a=t.length>=7?parseInt(t[6]):0,l=t.length>=8?parseInt(t[7]):0,c=t.length>=9?parseInt(t[8]):0,u=t.length>=10?parseInt(t[9]):0,p=t.length>=11?parseInt(t[10]):0;return e+r+i+n+o+a+l+c+u+p}function Qn(s,t,e){let r=s.replace(/ +/g," ").split(")");if(r.length>=2){let i=r[1].split(" ");if(i.length>=16){let n=parseInt(r[0].split(" ")[0]),o=parseInt(i[12]),a=parseInt(i[13]),l=parseInt(i[14]),c=parseInt(i[15]),u=0,p=0;return e.all>0&&e.list[n]?(u=(o+l-e.list[n].utime-e.list[n].cutime)/(t-e.all)*100,p=(a+c-e.list[n].stime-e.list[n].cstime)/(t-e.all)*100):(u=(o+l)/t*100,p=(a+c)/t*100),{pid:n,utime:o,stime:a,cutime:l,cstime:c,cpuu:u,cpus:p}}else return{pid:0,utime:0,stime:0,cutime:0,cstime:0,cpuu:0,cpus:0}}else return{pid:0,utime:0,stime:0,cutime:0,cstime:0,cpuu:0,cpus:0}}function Yo(s,t,e){let r=0,i=0;return e.all>0&&e.list[s.pid]?(r=(s.utime-e.list[s.pid].utime)/(t-e.all)*100,i=(s.stime-e.list[s.pid].stime)/(t-e.all)*100):(r=s.utime/t*100,i=s.stime/t*100),{pid:s.pid,utime:s.utime,stime:s.stime,cpuu:r>0?r:0,cpus:i>0?i:0}}function Op(s){let t=[];function e(o){o=o||"";let a=o.split(" ")[0];if(a.substr(-1)===":"&&(a=a.substr(0,a.length-1)),a.substr(0,1)!=="["){let l=a.split("/");isNaN(parseInt(l[l.length-1]))?a=l[l.length-1]:a=l[0]}return a}function r(o){let a=0,l=0;function c(Z){a=l,t[Z]?l=o.substring(t[Z].to+a,1e4).indexOf(" "):l=1e4}c(0);let u=parseInt(o.substring(t[0].from+a,t[0].to+l));c(1);let p=parseInt(o.substring(t[1].from+a,t[1].to+l));c(2);let f=parseFloat(o.substring(t[2].from+a,t[2].to+l).replace(/,/g,"."));c(3);let d=parseFloat(o.substring(t[3].from+a,t[3].to+l).replace(/,/g,"."));c(4);let m=parseInt(o.substring(t[4].from+a,t[4].to+l));c(5);let g=parseInt(o.substring(t[5].from+a,t[5].to+l));c(6);let _=parseInt(o.substring(t[6].from+a,t[6].to+l));c(7);let h=parseInt(o.substring(t[7].from+a,t[7].to+l))||0;c(8);let y=on?xp(o.substring(t[8].from+a,t[8].to+l).trim()):wp(o.substring(t[8].from+a,t[8].to+l).trim());c(9);let S=o.substring(t[9].from+a,t[9].to+l).trim();S=S[0]==="R"?"running":S[0]==="S"?"sleeping":S[0]==="T"?"stopped":S[0]==="W"?"paging":S[0]==="X"?"dead":S[0]==="Z"?"zombie":S[0]==="D"||S[0]==="U"?"blocked":"unknown",c(10);let v=o.substring(t[10].from+a,t[10].to+l).trim();(v==="?"||v==="??")&&(v=""),c(11);let x=o.substring(t[11].from+a,t[11].to+l).trim();c(12);let N="",T="",J="",E=o.substring(t[12].from+a,t[12].to+l).trim();if(E.substr(E.length-1)==="]"&&(E=E.slice(0,-1)),E.substr(0,1)==="[")T=E.substring(1);else{let Z=E.indexOf("("),B=E.indexOf(")"),ae=E.indexOf("/"),fe=E.indexOf(":");if(Z<B&&Z<ae&&ae<B)T=E.split(" ")[0],T=T.replace(/:/g,"");else if(fe>0&&(ae===-1||ae>3))T=E.split(" ")[0],T=T.replace(/:/g,"");else{let _e=E.indexOf(" -"),X=E.indexOf(" /");_e=_e>=0?_e:1e4,X=X>=0?X:1e4;let Se=Math.min(_e,X),de=E.substr(0,Se),De=E.substr(Se),Pe=de.lastIndexOf("/");if(Pe>=0&&(N=de.substr(0,Pe),de=de.substr(Pe+1)),Se===1e4&&de.indexOf(" ")>-1){let ne=de.split(" ");Sp.existsSync(vp.join(N,ne[0]))?(T=ne.shift(),J=(ne.join(" ")+" "+De).trim()):(T=de.trim(),J=De.trim())}else T=de.trim(),J=De.trim()}}return{pid:u,parentPid:p,name:Qe?e(T):T,cpu:f,cpuu:0,cpus:0,mem:d,priority:m,memVsz:g,memRss:_,nice:h,started:y,state:S,tty:v,user:x,command:T,params:J,path:N}}function i(o){let a=[];if(o.length>1){let l=o[0];t=j.parseHead(l,8),o.shift(),o.forEach(function(c){c.trim()!==""&&a.push(r(c))})}return a}function n(o){function a(u){let p=("0"+(u.getMonth()+1).toString()).slice(-2),f=u.getFullYear().toString(),d=("0"+u.getDate().toString()).slice(-2),m=("0"+u.getHours().toString()).slice(-2),g=("0"+u.getMinutes().toString()).slice(-2),_=("0"+u.getSeconds().toString()).slice(-2);return f+"-"+p+"-"+d+" "+m+":"+g+":"+_}function l(u){let p="";if(u.indexOf("d")>=0){let f=u.split("d");p=a(new Date(Date.now()-(f[0]*24+f[1]*1)*60*60*1e3))}else if(u.indexOf("h")>=0){let f=u.split("h");p=a(new Date(Date.now()-(f[0]*60+f[1]*1)*60*1e3))}else if(u.indexOf(":")>=0){let f=u.split(":");p=a(new Date(Date.now()-(f.length>1?(f[0]*60+f[1])*1e3:f[0]*1e3)))}return p}let c=[];return o.forEach(function(u){if(u.trim()!==""){u=u.trim().replace(/ +/g," ").replace(/,+/g,".");let p=u.split(" "),f=p.slice(9).join(" "),d=parseFloat((1*parseInt(p[3])*1024/an.totalmem()).toFixed(1)),m=l(p[5]);c.push({pid:parseInt(p[0]),parentPid:parseInt(p[1]),name:e(f),cpu:0,cpuu:0,cpus:0,mem:d,priority:0,memVsz:parseInt(p[2]),memRss:parseInt(p[3]),nice:parseInt(p[4]),started:m,state:p[6]==="R"?"running":p[6]==="S"?"sleeping":p[6]==="T"?"stopped":p[6]==="W"?"paging":p[6]==="X"?"dead":p[6]==="Z"?"zombie":p[6]==="D"||p[6]==="U"?"blocked":"unknown",tty:p[7],user:p[8],command:f})}}),c}return new Promise(o=>{process.nextTick(()=>{let a={all:0,running:0,blocked:0,sleeping:0,unknown:0,list:[]},l="";if(he.ms&&Date.now()-he.ms>=500||he.ms===0)if(Qe||gr||yr||_r||ms||on)Qe&&(l="export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,etime:30,state:5,tty:15,user:20,command; unset LC_ALL"),(gr||yr||_r)&&(l="export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,etime,state,tty,user,command; unset LC_ALL"),ms&&(l="ps -axo pid,ppid,pcpu,pmem,pri,vsz=temp_title_1,rss=temp_title_2,nice,etime=temp_title_3,state,tty,user,command -r"),on&&(l="ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm"),hr(l,{maxBuffer:1024*2e4},function(c,u){!c&&u.toString().trim()?(a.list=i(u.toString().split(`
|
|
314
|
+
`)).slice(),a.all=a.list.length,a.running=a.list.filter(function(p){return p.state==="running"}).length,a.blocked=a.list.filter(function(p){return p.state==="blocked"}).length,a.sleeping=a.list.filter(function(p){return p.state==="sleeping"}).length,Qe?(l='cat /proc/stat | grep "cpu "',a.list.forEach(p=>{l+=";cat /proc/"+p.pid+"/stat"}),hr(l,{maxBuffer:1024*2e4},function(p,f){let d=f.toString().split(`
|
|
315
|
+
`),m=Jn(d.shift()),g={},_={};d.forEach(h=>{if(_=Qn(h,m,he),_.pid){let y=a.list.map(function(S){return S.pid}).indexOf(_.pid);y>=0&&(a.list[y].cpu=_.cpuu+_.cpus,a.list[y].cpuu=_.cpuu,a.list[y].cpus=_.cpus),g[_.pid]={cpuu:_.cpuu,cpus:_.cpus,utime:_.utime,stime:_.stime,cutime:_.cutime,cstime:_.cstime}}}),he.all=m,he.list=Object.assign({},g),he.ms=Date.now()-he.ms,he.result=Object.assign({},a),s&&s(a),o(a)})):(s&&s(a),o(a))):(l="ps -o pid,ppid,vsz,rss,nice,etime,stat,tty,user,comm",on&&(l="ps -o pid,ppid,vsz,rss,nice,etime,s,tty,user,comm"),hr(l,{maxBuffer:1024*2e4},function(p,f){if(p)s&&s(a),o(a);else{let d=f.toString().split(`
|
|
316
|
+
`);d.shift(),a.list=n(d).slice(),a.all=a.list.length,a.running=a.list.filter(function(m){return m.state==="running"}).length,a.blocked=a.list.filter(function(m){return m.state==="blocked"}).length,a.sleeping=a.list.filter(function(m){return m.state==="sleeping"}).length,s&&s(a),o(a)}}))});else if(Zn)try{j.powerShell('Get-CimInstance Win32_Process | select-Object ProcessId,ParentProcessId,ExecutionState,Caption,CommandLine,ExecutablePath,UserModeTime,KernelModeTime,WorkingSetSize,Priority,PageFileUsage, @{n="CreationDate";e={$_.CreationDate.ToString("yyyy-MM-dd HH:mm:ss")}} | fl').then((c,u)=>{if(!u){let p=c.split(/\n\s*\n/),f=[],d=[],m={},g=0,_=0;p.forEach(h=>{if(h.trim()!==""){let y=h.trim().split(`\r
|
|
317
|
+
`),S=parseInt(j.getValue(y,"ProcessId",":",!0),10),v=parseInt(j.getValue(y,"ParentProcessId",":",!0),10),x=j.getValue(y,"ExecutionState",":"),N=j.getValue(y,"Caption",":",!0),T=j.getValue(y,"CommandLine",":",!0),J=!1;y.forEach(fe=>{J&&fe.toLowerCase().startsWith(" ")?T+=" "+fe.trim():J=!1,fe.toLowerCase().startsWith("commandline")&&(J=!0)});let E=j.getValue(y,"ExecutablePath",":",!0),Z=parseInt(j.getValue(y,"UserModeTime",":",!0),10),B=parseInt(j.getValue(y,"KernelModeTime",":",!0),10),ae=parseInt(j.getValue(y,"WorkingSetSize",":",!0),10);g=g+Z,_=_+B,a.all++,x||a.unknown++,x==="3"&&a.running++,(x==="4"||x==="5")&&a.blocked++,d.push({pid:S,utime:Z,stime:B,cpu:0,cpuu:0,cpus:0}),f.push({pid:S,parentPid:v,name:N,cpu:0,cpuu:0,cpus:0,mem:ae/an.totalmem()*100,priority:parseInt(j.getValue(y,"Priority",":",!0),10),memVsz:parseInt(j.getValue(y,"PageFileUsage",":",!0),10),memRss:Math.floor(parseInt(j.getValue(y,"WorkingSetSize",":",!0),10)/1024),nice:0,started:j.getValue(y,"CreationDate",":",!0),state:x?$o[x]:$o[0],tty:"",user:"",command:T||N,path:E,params:""})}}),a.sleeping=a.all-a.running-a.blocked-a.unknown,a.list=f,d.forEach(h=>{let y=Yo(h,g+_,he),S=a.list.map(function(v){return v.pid}).indexOf(y.pid);S>=0&&(a.list[S].cpu=y.cpuu+y.cpus,a.list[S].cpuu=y.cpuu,a.list[S].cpus=y.cpus),m[y.pid]={cpuu:y.cpuu,cpus:y.cpus,utime:y.utime,stime:y.stime}}),he.all=g+_,he.all_utime=g,he.all_stime=_,he.list=Object.assign({},m),he.ms=Date.now()-he.ms,he.result=Object.assign({},a)}s&&s(a),o(a)})}catch{s&&s(a),o(a)}else s&&s(a),o(a);else s&&s(he.result),o(he.result)})})}ln.processes=Op;function Ip(s,t){return j.isFunction(s)&&!t&&(t=s,s=""),new Promise(e=>{process.nextTick(()=>{if(s=s||"",typeof s!="string")return t&&t([]),e([]);let r="";r.__proto__.toLowerCase=j.stringToLower,r.__proto__.replace=j.stringReplace,r.__proto__.trim=j.stringTrim;let i=j.sanitizeShellString(s),n=j.mathMin(i.length,2e3);for(let c=0;c<=n;c++)i[c]!==void 0&&(r=r+i[c]);r=r.trim().toLowerCase().replace(/, /g,"|").replace(/,+/g,"|"),r===""&&(r="*"),j.isPrototypePolluted()&&r!=="*"&&(r="------");let o=r.split("|"),a=[];if((j.isPrototypePolluted()?"":j.sanitizeShellString(s)||"*")&&o.length&&o[0]!=="------"){if(Zn)try{j.powerShell("Get-CimInstance Win32_Process | select ProcessId,Caption,UserModeTime,KernelModeTime,WorkingSetSize | fl").then((c,u)=>{if(!u){let p=c.split(/\n\s*\n/),f=[],d={},m=0,g=0;p.forEach(_=>{if(_.trim()!==""){let h=_.trim().split(`\r
|
|
318
|
+
`),y=parseInt(j.getValue(h,"ProcessId",":",!0),10),S=j.getValue(h,"Caption",":",!0),v=parseInt(j.getValue(h,"UserModeTime",":",!0),10),x=parseInt(j.getValue(h,"KernelModeTime",":",!0),10),N=parseInt(j.getValue(h,"WorkingSetSize",":",!0),10);m=m+v,g=g+x,f.push({pid:y,name:S,utime:v,stime:x,cpu:0,cpuu:0,cpus:0,mem:N});let T="",J=!1;if(o.forEach(function(E){S.toLowerCase().indexOf(E.toLowerCase())>=0&&!J&&(J=!0,T=E)}),r==="*"||J){let E=!1;a.forEach(function(Z){Z.proc.toLowerCase()===T.toLowerCase()&&(Z.pids.push(y),Z.mem+=N/an.totalmem()*100,E=!0)}),E||a.push({proc:T,pid:y,pids:[y],cpu:0,mem:N/an.totalmem()*100})}}}),r!=="*"&&o.filter(function(h){return f.filter(function(y){return y.name.toLowerCase().indexOf(h)>=0}).length===0}).forEach(function(h){a.push({proc:h,pid:null,pids:[],cpu:0,mem:0})}),f.forEach(_=>{let h=Yo(_,m+g,Ee),y=-1;for(let S=0;S<a.length;S++)(a[S].pid===h.pid||a[S].pids.indexOf(h.pid)>=0)&&(y=S);y>=0&&(a[y].cpu+=h.cpuu+h.cpus),d[h.pid]={cpuu:h.cpuu,cpus:h.cpus,utime:h.utime,stime:h.stime}}),Ee.all=m+g,Ee.all_utime=m,Ee.all_stime=g,Ee.list=Object.assign({},d),Ee.ms=Date.now()-Ee.ms,Ee.result=JSON.parse(JSON.stringify(a)),t&&t(a),e(a)}})}catch{t&&t(a),e(a)}if(ms||Qe||gr||yr||_r){let c=["-axo","pid,ppid,pcpu,pmem,comm"];j.execSafe("ps",c).then(u=>{if(u){let p=[],f=u.toString().split(`
|
|
319
|
+
`).filter(function(d){if(r==="*")return!0;if(d.toLowerCase().indexOf("grep")!==-1)return!1;let m=!1;return o.forEach(function(g){m=m||d.toLowerCase().indexOf(g.toLowerCase())>=0}),m});if(f.shift(),f.forEach(function(d){let m=d.trim().replace(/ +/g," ").split(" ");if(m.length>4){let g=m[4].indexOf("/")>=0?m[4].substring(0,m[4].indexOf("/")):m[4],_=Qe?g:m[4].substring(m[4].lastIndexOf("/")+1);p.push({name:_,pid:parseInt(m[0])||0,ppid:parseInt(m[1])||0,cpu:parseFloat(m[2].replace(",",".")),mem:parseFloat(m[3].replace(",","."))})}}),p.forEach(function(d){let m=-1,g=!1,_=d.name;for(let h=0;h<a.length;h++)d.name.toLowerCase().indexOf(a[h].proc.toLowerCase())>=0&&(m=h);o.forEach(function(h){d.name.toLowerCase().indexOf(h.toLowerCase())>=0&&!g&&(g=!0,_=h)}),(r==="*"||g)&&(m<0?_&&a.push({proc:_,pid:d.pid,pids:[d.pid],cpu:d.cpu,mem:d.mem}):(d.ppid<10&&(a[m].pid=d.pid),a[m].pids.push(d.pid),a[m].cpu+=d.cpu,a[m].mem+=d.mem))}),r!=="*"&&o.filter(function(m){return p.filter(function(g){return g.name.toLowerCase().indexOf(m)>=0}).length===0}).forEach(function(m){a.push({proc:m,pid:null,pids:[],cpu:0,mem:0})}),Qe){a.forEach(function(m){m.cpu=0});let d='cat /proc/stat | grep "cpu "';for(let m in a)for(let g in a[m].pids)d+=";cat /proc/"+a[m].pids[g]+"/stat";hr(d,{maxBuffer:1024*2e4},function(m,g){let _=g.toString().split(`
|
|
320
|
+
`),h=Jn(_.shift()),y={},S={};_.forEach(v=>{if(S=Qn(v,h,Ee),S.pid){let x=-1;for(let N in a)a[N].pids.indexOf(S.pid)>=0&&(x=N);x>=0&&(a[x].cpu+=S.cpuu+S.cpus),y[S.pid]={cpuu:S.cpuu,cpus:S.cpus,utime:S.utime,stime:S.stime,cutime:S.cutime,cstime:S.cstime}}}),a.forEach(function(v){v.cpu=Math.round(v.cpu*100)/100}),Ee.all=h,Ee.list=Object.assign({},y),Ee.ms=Date.now()-Ee.ms,Ee.result=Object.assign({},a),t&&t(a),e(a)})}else t&&t(a),e(a)}else t&&t(a),e(a)})}}})})}ln.processLoad=Ip});var Jo=le(Zo=>{"use strict";var Sr=require("child_process").exec,At=ce(),bt=process.platform,Lp=bt==="linux"||bt==="android",Ep=bt==="darwin",Pp=bt==="win32",Tp=bt==="freebsd",Vp=bt==="openbsd",Np=bt==="netbsd",Dp=bt==="sunos";function Ko(s,t){let e=[],r=[],i={},n=!0,o=[],a=[],l={},c=!0;return s.forEach(function(u){if(u==="---")c=!1;else{let p=u.replace(/ +/g," ").split(" ");c?r.push({user:p[0],tty:p[1],date:p[2],time:p[3],ip:p&&p.length>4?p[4].replace(/\(/g,"").replace(/\)/g,""):""}):n?(o=p,o.forEach(function(f){a.push(u.indexOf(f))}),n=!1):(i.user=u.substring(a[0],a[1]-1).trim(),i.tty=u.substring(a[1],a[2]-1).trim(),i.ip=u.substring(a[2],a[3]-1).replace(/\(/g,"").replace(/\)/g,"").trim(),i.command=u.substring(a[7],1e3).trim(),l=r.filter(function(f){return f.user.substring(0,8).trim()===i.user&&f.tty===i.tty}),l.length===1&&e.push({user:l[0].user,tty:l[0].tty,date:l[0].date,time:l[0].time,ip:l[0].ip,command:i.command}))}}),e.length===0&&t===2?r:e}function ei(s){let t=[],e=[],r={},i={},n=!0;return s.forEach(function(o){if(o==="---")n=!1;else{let a=o.replace(/ +/g," ").split(" ");n?e.push({user:a[0],tty:a[1],date:""+new Date().getFullYear()+"-"+("0"+("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC".indexOf(a[2].toUpperCase())/3+1)).slice(-2)+"-"+("0"+a[3]).slice(-2),time:a[4]}):(r.user=a[0],r.tty=a[1],r.ip=a[2]!=="-"?a[2]:"",r.command=a.slice(5,1e3).join(" "),i=e.filter(function(l){return l.user===r.user&&(l.tty.substring(3,1e3)===r.tty||l.tty===r.tty)}),i.length===1&&t.push({user:i[0].user,tty:i[0].tty,date:i[0].date,time:i[0].time,ip:r.ip,command:r.command}))}}),t}function Ap(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(Lp&&Sr('who --ips; echo "---"; w | tail -n +2',function(r,i){if(r)s&&s(e),t(e);else{let n=i.toString().split(`
|
|
321
|
+
`);e=Ko(n,1),e.length===0?Sr('who; echo "---"; w | tail -n +2',function(o,a){o||(n=a.toString().split(`
|
|
322
|
+
`),e=Ko(n,2)),s&&s(e),t(e)}):(s&&s(e),t(e))}}),(Tp||Vp||Np)&&Sr('who; echo "---"; w -ih',function(r,i){if(!r){let n=i.toString().split(`
|
|
323
|
+
`);e=ei(n)}s&&s(e),t(e)}),Dp&&Sr('who; echo "---"; w -h',function(r,i){if(!r){let n=i.toString().split(`
|
|
324
|
+
`);e=ei(n)}s&&s(e),t(e)}),Ep&&Sr('who; echo "---"; w -ih',function(r,i){if(!r){let n=i.toString().split(`
|
|
325
|
+
`);e=ei(n)}s&&s(e),t(e)}),Pp)try{let r=`Get-CimInstance Win32_LogonSession | select LogonId,@{n="StartTime";e={$_.StartTime.ToString("yyyy-MM-dd HH:mm:ss")}} | fl; echo '#-#-#-#';`;r+="Get-CimInstance Win32_LoggedOnUser | select antecedent,dependent | fl ; echo '#-#-#-#';",r+=`$process = (Get-CimInstance Win32_Process -Filter "name = 'explorer.exe'"); Invoke-CimMethod -InputObject $process[0] -MethodName GetOwner | select user, domain | fl; get-process -name explorer | select-object sessionid | fl; echo '#-#-#-#';`,r+="query user",At.powerShell(r).then(i=>{if(i){i=i.split("#-#-#-#");let n=bp((i[0]||"").split(/\n\s*\n/)),o=kp((i[1]||"").split(/\n\s*\n/)),a=Fp((i[3]||"").split(`\r
|
|
326
|
+
`)),l=Rp((i[2]||"").split(/\n\s*\n/),a);for(let c in o)({}).hasOwnProperty.call(o,c)&&(o[c].dateTime={}.hasOwnProperty.call(n,c)?n[c]:"");l.forEach(c=>{let u="";for(let p in o)({}).hasOwnProperty.call(o,p)&&o[p].user===c.user&&(!u||u<o[p].dateTime)&&(u=o[p].dateTime);e.push({user:c.user,tty:c.tty,date:`${u.substring(0,10)}`,time:`${u.substring(11,19)}`,ip:"",command:""})})}s&&s(e),t(e)})}catch{s&&s(e),t(e)}})})}function bp(s){let t={};return s.forEach(e=>{let r=e.split(`\r
|
|
327
|
+
`),i=At.getValue(r,"LogonId"),n=At.getValue(r,"starttime");i&&(t[i]=n)}),t}function Mp(s,t){s=s.toLowerCase(),t=t.toLowerCase();let e=0,r=s.length;t.length>r&&(r=t.length);for(let i=0;i<r;i++){let n=s[i]||"",o=t[i]||"";n===o&&e++}return r>10?e/r>.9:r>0?e/r>.8:!1}function Rp(s,t){let e=[];return s.forEach(r=>{let i=r.split(`\r
|
|
328
|
+
`),n=At.getValue(i,"domain",":",!0),o=At.getValue(i,"user",":",!0),a=At.getValue(i,"sessionid",":",!0);if(o){let l=t.filter(c=>Mp(c.user,o));e.push({domain:n,user:o,tty:l&&l[0]&&l[0].tty?l[0].tty:a})}}),e}function kp(s){let t={};return s.forEach(e=>{let r=e.split(`\r
|
|
329
|
+
`),n=At.getValue(r,"antecedent",":",!0).split("="),o=n.length>2?n[1].split(",")[0].replace(/"/g,"").trim():"",a=n.length>2?n[2].replace(/"/g,"").replace(/\)/g,"").trim():"";n=At.getValue(r,"dependent",":",!0).split("=");let c=n.length>1?n[1].replace(/"/g,"").replace(/\)/g,"").trim():"";c&&(t[c]={domain:a,user:o})}),t}function Fp(s){s=s.filter(i=>i);let t=[],e=s[0],r=[];if(e){let i=e[0]===" "?1:0;r.push(i-1);let n=0;for(let o=i+1;o<e.length;o++)e[o]===" "&&(e[o-1]===" "||e[o-1]===".")?n=o:n&&(r.push(n),n=0);for(let o=1;o<s.length;o++)if(s[o].trim()){let a=s[o].substring(r[0]+1,r[1]).trim()||"",l=s[o].substring(r[1]+1,r[2]-2).trim()||"";t.push({user:a,tty:l})}}return t}Zo.users=Ap});var ta=le(oi=>{"use strict";var we=ce(),Mt=process.platform,ti=Mt==="linux"||Mt==="android",si=Mt==="darwin",Qo=Mt==="win32",ri=Mt==="freebsd",ni=Mt==="openbsd",ii=Mt==="netbsd",ea=Mt==="sunos";function Bp(s,t){return new Promise(e=>{process.nextTick(()=>{let r={url:s,ok:!1,status:404,ms:null};if(typeof s!="string")return t&&t(r),e(r);let i="",n=we.sanitizeShellString(s,!0),o=we.mathMin(n.length,2e3);for(let a=0;a<=o;a++)if(n[a]!==void 0){n[a].__proto__.toLowerCase=we.stringToLower;let l=n[a].toLowerCase();l&&l[0]&&!l[1]&&l[0].length===1&&(i=i+l[0])}r.url=i;try{if(i&&!we.isPrototypePolluted()){if(i.__proto__.startsWith=we.stringStartWith,i.startsWith("file:")||i.startsWith("gopher:")||i.startsWith("telnet:")||i.startsWith("mailto:")||i.startsWith("news:")||i.startsWith("nntp:"))return t&&t(r),e(r);let a=Date.now();if(ti||ri||ni||ii||si||ea){let l=["-I","--connect-timeout","5","-m","5"];l.push(i),we.execSafe("curl",l).then(u=>{let p=u.split(`
|
|
330
|
+
`),f=p[0]&&p[0].indexOf(" ")>=0?parseInt(p[0].split(" ")[1],10):404;r.status=f||404,r.ok=f===200||f===301||f===302||f===304,r.ms=r.ok?Date.now()-a:null,t&&t(r),e(r)})}if(Qo){let l=i.startsWith("https:")?require("https"):require("http");try{l.get(i,c=>{let u=c.statusCode;r.status=u||404,r.ok=u===200||u===301||u===302||u===304,u!==200?(c.resume(),r.ms=r.ok?Date.now()-a:null,t&&t(r),e(r)):(c.on("data",()=>{}),c.on("end",()=>{r.ms=r.ok?Date.now()-a:null,t&&t(r),e(r)}))}).on("error",()=>{t&&t(r),e(r)})}catch{t&&t(r),e(r)}}}else t&&t(r),e(r)}catch{t&&t(r),e(r)}})})}oi.inetChecksite=Bp;function Wp(s,t){return we.isFunction(s)&&!t&&(t=s,s=""),s=s||"8.8.8.8",new Promise(e=>{process.nextTick(()=>{if(typeof s!="string")return t&&t(null),e(null);let r="",i=(we.isPrototypePolluted()?"8.8.8.8":we.sanitizeShellString(s,!0)).trim(),n=we.mathMin(i.length,2e3);for(let a=0;a<=n;a++)if(i[a]!==void 0){i[a].__proto__.toLowerCase=we.stringToLower;let l=i[a].toLowerCase();l&&l[0]&&!l[1]&&(r=r+l[0])}if(r.__proto__.startsWith=we.stringStartWith,r.startsWith("file:")||r.startsWith("gopher:")||r.startsWith("telnet:")||r.startsWith("mailto:")||r.startsWith("news:")||r.startsWith("nntp:"))return t&&t(null),e(null);let o;if((ti||ri||ni||ii||si)&&(ti&&(o=["-c","2","-w","3",r]),(ri||ni||ii)&&(o=["-c","2","-t","3",r]),si&&(o=["-c2","-t3",r]),we.execSafe("ping",o).then(a=>{let l=null;if(a){let u=a.split(`
|
|
331
|
+
`).filter(p=>p.indexOf("rtt")>=0||p.indexOf("round-trip")>=0||p.indexOf("avg")>=0).join(`
|
|
332
|
+
`).split("=");if(u.length>1){let p=u[1].split("/");p.length>1&&(l=parseFloat(p[1]))}}t&&t(l),e(l)})),ea){let a=["-s","-a",r,"56","2"],l="avg";we.execSafe("ping",a,{timeout:3e3}).then(c=>{let u=null;if(c){let f=c.split(`
|
|
333
|
+
`).filter(d=>d.indexOf(l)>=0).join(`
|
|
334
|
+
`).split("=");if(f.length>1){let d=f[1].split("/");d.length>1&&(u=parseFloat(d[1].replace(",",".")))}}t&&t(u),e(u)})}if(Qo){let a=null;try{let l=[r,"-n","1"];we.execSafe("ping",l,we.execOptsWin).then(c=>{if(c){let u=c.split(`\r
|
|
335
|
+
`);u.shift(),u.forEach(function(p){if((p.toLowerCase().match(/ms/g)||[]).length===3){let f=p.replace(/ +/g," ").split(" ");f.length>6&&(a=parseFloat(f[f.length-1]))}})}t&&t(a),e(a)})}catch{t&&t(a),e(a)}}})})}oi.inetLatency=Wp});var ra=le((lm,sa)=>{"use strict";var Rt=require("net"),Up=require("os").type()==="Windows_NT",kt=Up?"//./pipe/docker_engine":"/var/run/docker.sock",ai=class{getInfo(t){try{let e=Rt.createConnection({path:kt}),r="",i;e.on("connect",()=>{e.write(`GET http:/info HTTP/1.0\r
|
|
336
|
+
\r
|
|
337
|
+
`)}),e.on("data",n=>{r=r+n.toString()}),e.on("error",()=>{e=!1,t({})}),e.on("end",()=>{let n=r.indexOf(`\r
|
|
338
|
+
\r
|
|
339
|
+
`);r=r.substring(n+4),e=!1;try{i=JSON.parse(r),t(i)}catch{t({})}})}catch{t({})}}listImages(t,e){try{let r=Rt.createConnection({path:kt}),i="",n;r.on("connect",()=>{r.write("GET http:/images/json"+(t?"?all=1":"")+` HTTP/1.0\r
|
|
340
|
+
\r
|
|
341
|
+
`)}),r.on("data",o=>{i=i+o.toString()}),r.on("error",()=>{r=!1,e({})}),r.on("end",()=>{let o=i.indexOf(`\r
|
|
342
|
+
\r
|
|
343
|
+
`);i=i.substring(o+4),r=!1;try{n=JSON.parse(i),e(n)}catch{e({})}})}catch{e({})}}inspectImage(t,e){if(t=t||"",t)try{let r=Rt.createConnection({path:kt}),i="",n;r.on("connect",()=>{r.write("GET http:/images/"+t+`/json?stream=0 HTTP/1.0\r
|
|
344
|
+
\r
|
|
345
|
+
`)}),r.on("data",o=>{i=i+o.toString()}),r.on("error",()=>{r=!1,e({})}),r.on("end",()=>{let o=i.indexOf(`\r
|
|
346
|
+
\r
|
|
347
|
+
`);i=i.substring(o+4),r=!1;try{n=JSON.parse(i),e(n)}catch{e({})}})}catch{e({})}else e({})}listContainers(t,e){try{let r=Rt.createConnection({path:kt}),i="",n;r.on("connect",()=>{r.write("GET http:/containers/json"+(t?"?all=1":"")+` HTTP/1.0\r
|
|
348
|
+
\r
|
|
349
|
+
`)}),r.on("data",o=>{i=i+o.toString()}),r.on("error",()=>{r=!1,e({})}),r.on("end",()=>{let o=i.indexOf(`\r
|
|
350
|
+
\r
|
|
351
|
+
`);i=i.substring(o+4),r=!1;try{n=JSON.parse(i),e(n)}catch{e({})}})}catch{e({})}}getStats(t,e){if(t=t||"",t)try{let r=Rt.createConnection({path:kt}),i="",n;r.on("connect",()=>{r.write("GET http:/containers/"+t+`/stats?stream=0 HTTP/1.0\r
|
|
352
|
+
\r
|
|
353
|
+
`)}),r.on("data",o=>{i=i+o.toString()}),r.on("error",()=>{r=!1,e({})}),r.on("end",()=>{let o=i.indexOf(`\r
|
|
354
|
+
\r
|
|
355
|
+
`);i=i.substring(o+4),r=!1;try{n=JSON.parse(i),e(n)}catch{e({})}})}catch{e({})}else e({})}getInspect(t,e){if(t=t||"",t)try{let r=Rt.createConnection({path:kt}),i="",n;r.on("connect",()=>{r.write("GET http:/containers/"+t+`/json?stream=0 HTTP/1.0\r
|
|
356
|
+
\r
|
|
357
|
+
`)}),r.on("data",o=>{i=i+o.toString()}),r.on("error",()=>{r=!1,e({})}),r.on("end",()=>{let o=i.indexOf(`\r
|
|
358
|
+
\r
|
|
359
|
+
`);i=i.substring(o+4),r=!1;try{n=JSON.parse(i),e(n)}catch{e({})}})}catch{e({})}else e({})}getProcesses(t,e){if(t=t||"",t)try{let r=Rt.createConnection({path:kt}),i="",n;r.on("connect",()=>{r.write("GET http:/containers/"+t+`/top?ps_args=-opid,ppid,pgid,vsz,time,etime,nice,ruser,user,rgroup,group,stat,rss,args HTTP/1.0\r
|
|
360
|
+
\r
|
|
361
|
+
`)}),r.on("data",o=>{i=i+o.toString()}),r.on("error",()=>{r=!1,e({})}),r.on("end",()=>{let o=i.indexOf(`\r
|
|
362
|
+
\r
|
|
363
|
+
`);i=i.substring(o+4),r=!1;try{n=JSON.parse(i),e(n)}catch{e({})}})}catch{e({})}else e({})}listVolumes(t){try{let e=Rt.createConnection({path:kt}),r="",i;e.on("connect",()=>{e.write(`GET http:/volumes HTTP/1.0\r
|
|
364
|
+
\r
|
|
365
|
+
`)}),e.on("data",n=>{r=r+n.toString()}),e.on("error",()=>{e=!1,t({})}),e.on("end",()=>{let n=r.indexOf(`\r
|
|
366
|
+
\r
|
|
367
|
+
`);r=r.substring(n+4),e=!1;try{i=JSON.parse(r),t(i)}catch{t({})}})}catch{t({})}}};sa.exports=ai});var ia=le(Bt=>{"use strict";var pe=ce(),Ft=ra(),Gp=process.platform,jp=Gp==="win32",Gs={},oe,li=0;function zp(s){return new Promise(t=>{process.nextTick(()=>{oe||(oe=new Ft);let e={};oe.getInfo(r=>{e.id=r.ID,e.containers=r.Containers,e.containersRunning=r.ContainersRunning,e.containersPaused=r.ContainersPaused,e.containersStopped=r.ContainersStopped,e.images=r.Images,e.driver=r.Driver,e.memoryLimit=r.MemoryLimit,e.swapLimit=r.SwapLimit,e.kernelMemory=r.KernelMemory,e.cpuCfsPeriod=r.CpuCfsPeriod,e.cpuCfsQuota=r.CpuCfsQuota,e.cpuShares=r.CPUShares,e.cpuSet=r.CPUSet,e.ipv4Forwarding=r.IPv4Forwarding,e.bridgeNfIptables=r.BridgeNfIptables,e.bridgeNfIp6tables=r.BridgeNfIp6tables,e.debug=r.Debug,e.nfd=r.NFd,e.oomKillDisable=r.OomKillDisable,e.ngoroutines=r.NGoroutines,e.systemTime=r.SystemTime,e.loggingDriver=r.LoggingDriver,e.cgroupDriver=r.CgroupDriver,e.nEventsListener=r.NEventsListener,e.kernelVersion=r.KernelVersion,e.operatingSystem=r.OperatingSystem,e.osType=r.OSType,e.architecture=r.Architecture,e.ncpu=r.NCPU,e.memTotal=r.MemTotal,e.dockerRootDir=r.DockerRootDir,e.httpProxy=r.HttpProxy,e.httpsProxy=r.HttpsProxy,e.noProxy=r.NoProxy,e.name=r.Name,e.labels=r.Labels,e.experimentalBuild=r.ExperimentalBuild,e.serverVersion=r.ServerVersion,e.clusterStore=r.ClusterStore,e.clusterAdvertise=r.ClusterAdvertise,e.defaultRuntime=r.DefaultRuntime,e.liveRestoreEnabled=r.LiveRestoreEnabled,e.isolation=r.Isolation,e.initBinary=r.InitBinary,e.productLicense=r.ProductLicense,s&&s(e),t(e)})})})}Bt.dockerInfo=zp;function qp(s,t){pe.isFunction(s)&&!t&&(t=s,s=!1),typeof s=="string"&&s==="true"&&(s=!0),typeof s!="boolean"&&s!==void 0&&(s=!1),s=s||!1;let e=[];return new Promise(r=>{process.nextTick(()=>{oe||(oe=new Ft);let i=[];oe.listImages(s,n=>{let o={};try{o=n,o&&Object.prototype.toString.call(o)==="[object Array]"&&o.length>0?(o.forEach(function(a){a.Names&&Object.prototype.toString.call(a.Names)==="[object Array]"&&a.Names.length>0&&(a.Name=a.Names[0].replace(/^\/|\/$/g,"")),i.push(Hp(a.Id.trim(),a))}),i.length?Promise.all(i).then(a=>{t&&t(a),r(a)}):(t&&t(e),r(e))):(t&&t(e),r(e))}catch{t&&t(e),r(e)}})})})}function Hp(s,t){return new Promise(e=>{process.nextTick(()=>{if(s=s||"",typeof s!="string")return e();let r=(pe.isPrototypePolluted()?"":pe.sanitizeShellString(s,!0)).trim();r?(oe||(oe=new Ft),oe.inspectImage(r.trim(),i=>{try{e({id:t.Id,container:i.Container,comment:i.Comment,os:i.Os,architecture:i.Architecture,parent:i.Parent,dockerVersion:i.DockerVersion,size:i.Size,sharedSize:t.SharedSize,virtualSize:i.VirtualSize,author:i.Author,created:i.Created?Math.round(new Date(i.Created).getTime()/1e3):0,containerConfig:i.ContainerConfig?i.ContainerConfig:{},graphDriver:i.GraphDriver?i.GraphDriver:{},repoDigests:i.RepoDigests?i.RepoDigests:{},repoTags:i.RepoTags?i.RepoTags:{},config:i.Config?i.Config:{},rootFS:i.RootFS?i.RootFS:{}})}catch{e()}})):e()})})}Bt.dockerImages=qp;function ci(s,t){function e(i,n){return i.filter(a=>a.Id&&a.Id===n).length>0}pe.isFunction(s)&&!t&&(t=s,s=!1),typeof s=="string"&&s==="true"&&(s=!0),typeof s!="boolean"&&s!==void 0&&(s=!1),s=s||!1;let r=[];return new Promise(i=>{process.nextTick(()=>{oe||(oe=new Ft);let n=[];oe.listContainers(s,o=>{let a={};try{if(a=o,a&&Object.prototype.toString.call(a)==="[object Array]"&&a.length>0){for(let l in Gs)({}).hasOwnProperty.call(Gs,l)&&(e(a,l)||delete Gs[l]);a.forEach(function(l){l.Names&&Object.prototype.toString.call(l.Names)==="[object Array]"&&l.Names.length>0&&(l.Name=l.Names[0].replace(/^\/|\/$/g,"")),n.push($p(l.Id.trim(),l))}),n.length?Promise.all(n).then(l=>{t&&t(l),i(l)}):(t&&t(r),i(r))}else t&&t(r),i(r)}catch{for(let c in Gs)({}).hasOwnProperty.call(Gs,c)&&(e(a,c)||delete Gs[c]);t&&t(r),i(r)}})})})}function $p(s,t){return new Promise(e=>{process.nextTick(()=>{if(s=s||"",typeof s!="string")return e();let r=(pe.isPrototypePolluted()?"":pe.sanitizeShellString(s,!0)).trim();r?(oe||(oe=new Ft),oe.getInspect(r.trim(),i=>{try{e({id:t.Id,name:t.Name,image:t.Image,imageID:t.ImageID,command:t.Command,created:t.Created,started:i.State&&i.State.StartedAt?Math.round(new Date(i.State.StartedAt).getTime()/1e3):0,finished:i.State&&i.State.FinishedAt&&!i.State.FinishedAt.startsWith("0001-01-01")?Math.round(new Date(i.State.FinishedAt).getTime()/1e3):0,createdAt:i.Created?i.Created:"",startedAt:i.State&&i.State.StartedAt?i.State.StartedAt:"",finishedAt:i.State&&i.State.FinishedAt&&!i.State.FinishedAt.startsWith("0001-01-01")?i.State.FinishedAt:"",state:t.State,restartCount:i.RestartCount||0,platform:i.Platform||"",driver:i.Driver||"",ports:t.Ports,mounts:t.Mounts})}catch{e()}})):e()})})}Bt.dockerContainers=ci;function Yp(s,t){if(jp){let e=pe.nanoSeconds(),r=0;if(li>0){let i=e-li,n=s.cpu_usage.total_usage-t.cpu_usage.total_usage;i>0&&(r=100*n/i)}return li=e,r}else{let e=0,r=s.cpu_usage.total_usage-t.cpu_usage.total_usage,i=s.system_cpu_usage-t.system_cpu_usage;return i>0&&r>0&&(t.online_cpus?e=r/i*t.online_cpus*100:e=r/i*s.cpu_usage.percpu_usage.length*100),e}}function Xp(s){let t,e;for(let r in s){if(!{}.hasOwnProperty.call(s,r))continue;let i=s[r];t=+i.rx_bytes,e=+i.tx_bytes}return{rx:t,wx:e}}function Kp(s){let t={r:0,w:0};return s&&s.io_service_bytes_recursive&&Object.prototype.toString.call(s.io_service_bytes_recursive)==="[object Array]"&&s.io_service_bytes_recursive.length>0&&s.io_service_bytes_recursive.forEach(function(e){e.op&&e.op.toLowerCase()==="read"&&e.value&&(t.r+=e.value),e.op&&e.op.toLowerCase()==="write"&&e.value&&(t.w+=e.value)}),t}function ui(s,t){let e=[];return new Promise(r=>{process.nextTick(()=>{if(pe.isFunction(s)&&!t)t=s,e=["*"];else{if(s=s||"*",typeof s!="string")return t&&t([]),r([]);let o="";if(o.__proto__.toLowerCase=pe.stringToLower,o.__proto__.replace=pe.stringReplace,o.__proto__.trim=pe.stringTrim,o=s,o=o.trim(),o!=="*"){o="";let a=(pe.isPrototypePolluted()?"":pe.sanitizeShellString(s,!0)).trim(),l=pe.mathMin(a.length,2e3);for(let c=0;c<=l;c++)if(a[c]!==void 0){a[c].__proto__.toLowerCase=pe.stringToLower;let u=a[c].toLowerCase();u&&u[0]&&!u[1]&&(o=o+u[0])}}o=o.trim().toLowerCase().replace(/,+/g,"|"),e=o.split("|")}let i=[],n=[];if(e.length&&e[0].trim()==="*")e=[],ci().then(o=>{for(let a of o)e.push(a.id.substring(0,12));e.length?ui(e.join(",")).then(a=>{t&&t(a),r(a)}):(t&&t(i),r(i))});else{for(let o of e)n.push(Zp(o.trim()));n.length?Promise.all(n).then(o=>{t&&t(o),r(o)}):(t&&t(i),r(i))}})})}function Zp(s){s=s||"";let t={id:s,memUsage:0,memLimit:0,memPercent:0,cpuPercent:0,pids:0,netIO:{rx:0,wx:0},blockIO:{r:0,w:0},restartCount:0,cpuStats:{},precpuStats:{},memoryStats:{},networks:{}};return new Promise(e=>{process.nextTick(()=>{s?(oe||(oe=new Ft),oe.getInspect(s,r=>{try{oe.getStats(s,i=>{try{let n=i;n.message||(i.id&&(t.id=i.id),t.memUsage=n.memory_stats&&n.memory_stats.usage?n.memory_stats.usage:0,t.memLimit=n.memory_stats&&n.memory_stats.limit?n.memory_stats.limit:0,t.memPercent=n.memory_stats&&n.memory_stats.usage&&n.memory_stats.limit?n.memory_stats.usage/n.memory_stats.limit*100:0,t.cpuPercent=n.cpu_stats&&n.precpu_stats?Yp(n.cpu_stats,n.precpu_stats):0,t.pids=n.pids_stats&&n.pids_stats.current?n.pids_stats.current:0,t.restartCount=r.RestartCount?r.RestartCount:0,n.networks&&(t.netIO=Xp(n.networks)),n.blkio_stats&&(t.blockIO=Kp(n.blkio_stats)),t.cpuStats=n.cpu_stats?n.cpu_stats:{},t.precpuStats=n.precpu_stats?n.precpu_stats:{},t.memoryStats=n.memory_stats?n.memory_stats:{},t.networks=n.networks?n.networks:{})}catch{pe.noop()}e(t)})}catch{pe.noop()}})):e(t)})})}Bt.dockerContainerStats=ui;function na(s,t){let e=[];return new Promise(r=>{process.nextTick(()=>{if(s=s||"",typeof s!="string")return r(e);let i=(pe.isPrototypePolluted()?"":pe.sanitizeShellString(s,!0)).trim();i?(oe||(oe=new Ft),oe.getProcesses(i,n=>{try{if(n&&n.Titles&&n.Processes){let o=n.Titles.map(function(x){return x.toUpperCase()}),a=o.indexOf("PID"),l=o.indexOf("PPID"),c=o.indexOf("PGID"),u=o.indexOf("VSZ"),p=o.indexOf("TIME"),f=o.indexOf("ELAPSED"),d=o.indexOf("NI"),m=o.indexOf("RUSER"),g=o.indexOf("USER"),_=o.indexOf("RGROUP"),h=o.indexOf("GROUP"),y=o.indexOf("STAT"),S=o.indexOf("RSS"),v=o.indexOf("COMMAND");n.Processes.forEach(x=>{e.push({pidHost:a>=0?x[a]:"",ppid:l>=0?x[l]:"",pgid:c>=0?x[c]:"",user:g>=0?x[g]:"",ruser:m>=0?x[m]:"",group:h>=0?x[h]:"",rgroup:_>=0?x[_]:"",stat:y>=0?x[y]:"",time:p>=0?x[p]:"",elapsed:f>=0?x[f]:"",nice:d>=0?x[d]:"",rss:S>=0?x[S]:"",vsz:u>=0?x[u]:"",command:v>=0?x[v]:""})})}}catch{pe.noop()}t&&t(e),r(e)})):(t&&t(e),r(e))})})}Bt.dockerContainerProcesses=na;function Jp(s){let t=[];return new Promise(e=>{process.nextTick(()=>{oe||(oe=new Ft),oe.listVolumes(r=>{let i={};try{i=r,i&&i.Volumes&&Object.prototype.toString.call(i.Volumes)==="[object Array]"&&i.Volumes.length>0?(i.Volumes.forEach(function(n){t.push({name:n.Name,driver:n.Driver,labels:n.Labels,mountpoint:n.Mountpoint,options:n.Options,scope:n.Scope,created:n.CreatedAt?Math.round(new Date(n.CreatedAt).getTime()/1e3):0})}),s&&s(t),e(t)):(s&&s(t),e(t))}catch{s&&s(t),e(t)}})})})}Bt.dockerVolumes=Jp;function Qp(s){return new Promise(t=>{process.nextTick(()=>{ci(!0).then(e=>{if(e&&Object.prototype.toString.call(e)==="[object Array]"&&e.length>0){let r=e.length;e.forEach(function(i){ui(i.id).then(n=>{i.memUsage=n[0].memUsage,i.memLimit=n[0].memLimit,i.memPercent=n[0].memPercent,i.cpuPercent=n[0].cpuPercent,i.pids=n[0].pids,i.netIO=n[0].netIO,i.blockIO=n[0].blockIO,i.cpuStats=n[0].cpuStats,i.precpuStats=n[0].precpuStats,i.memoryStats=n[0].memoryStats,i.networks=n[0].networks,na(i.id).then(o=>{i.processes=o,r-=1,r===0&&(s&&s(e),t(e))})})})}else s&&s(e),t(e)})})})}Bt.dockerAll=Qp});var aa=le(oa=>{"use strict";var pi=require("os"),ef=require("child_process").exec,ee=ce();function tf(s){let t=[];return new Promise(e=>{process.nextTick(()=>{try{ef(ee.getVboxmanage()+" list vms --long",function(r,i){let n=(pi.EOL+i.toString()).split(pi.EOL+"Name:");n.shift(),n.forEach(o=>{let a=("Name:"+o).split(pi.EOL),l=ee.getValue(a,"State"),c=l.startsWith("running"),u=c?l.replace("running (since ","").replace(")","").trim():"",p=0;try{if(c){let m=new Date(u),g=m.getTimezoneOffset();p=Math.round((Date.now()-Date.parse(m))/1e3)+g*60}}catch{ee.noop()}let f=c?"":l.replace("powered off (since","").replace(")","").trim(),d=0;try{if(!c){let m=new Date(f),g=m.getTimezoneOffset();d=Math.round((Date.now()-Date.parse(m))/1e3)+g*60}}catch{ee.noop()}t.push({id:ee.getValue(a,"UUID"),name:ee.getValue(a,"Name"),running:c,started:u,runningSince:p,stopped:f,stoppedSince:d,guestOS:ee.getValue(a,"Guest OS"),hardwareUUID:ee.getValue(a,"Hardware UUID"),memory:parseInt(ee.getValue(a,"Memory size"," "),10),vram:parseInt(ee.getValue(a,"VRAM size"),10),cpus:parseInt(ee.getValue(a,"Number of CPUs"),10),cpuExepCap:ee.getValue(a,"CPU exec cap"),cpuProfile:ee.getValue(a,"CPUProfile"),chipset:ee.getValue(a,"Chipset"),firmware:ee.getValue(a,"Firmware"),pageFusion:ee.getValue(a,"Page Fusion")==="enabled",configFile:ee.getValue(a,"Config file"),snapshotFolder:ee.getValue(a,"Snapshot folder"),logFolder:ee.getValue(a,"Log folder"),hpet:ee.getValue(a,"HPET")==="enabled",pae:ee.getValue(a,"PAE")==="enabled",longMode:ee.getValue(a,"Long Mode")==="enabled",tripleFaultReset:ee.getValue(a,"Triple Fault Reset")==="enabled",apic:ee.getValue(a,"APIC")==="enabled",x2Apic:ee.getValue(a,"X2APIC")==="enabled",acpi:ee.getValue(a,"ACPI")==="enabled",ioApic:ee.getValue(a,"IOAPIC")==="enabled",biosApicMode:ee.getValue(a,"BIOS APIC mode"),bootMenuMode:ee.getValue(a,"Boot menu mode"),bootDevice1:ee.getValue(a,"Boot Device 1"),bootDevice2:ee.getValue(a,"Boot Device 2"),bootDevice3:ee.getValue(a,"Boot Device 3"),bootDevice4:ee.getValue(a,"Boot Device 4"),timeOffset:ee.getValue(a,"Time offset"),rtc:ee.getValue(a,"RTC")})}),s&&s(t),e(t)})}catch{s&&s(t),e(t)}})})}oa.vboxInfo=tf});var pa=le(ua=>{"use strict";var fi=require("child_process").exec,ye=ce(),Wt=process.platform,la=Wt==="linux"||Wt==="android",sf=Wt==="darwin",rf=Wt==="win32",nf=Wt==="freebsd",of=Wt==="openbsd",af=Wt==="netbsd",lf=Wt==="sunos",ca={1:"Other",2:"Unknown",3:"Idle",4:"Printing",5:"Warmup",6:"Stopped Printing",7:"Offline"};function cf(s){let t={};if(s&&s.length&&s[0].indexOf(" CUPS v")>0){let e=s[0].split(" CUPS v");t.cupsVersion=e[1]}return t}function uf(s){let t={},e=ye.getValue(s,"PrinterId"," ");return t.id=e?parseInt(e,10):null,t.name=ye.getValue(s,"Info"," "),t.model=s.length>0&&s[0]?s[0].split(" ")[0]:"",t.uri=ye.getValue(s,"DeviceURI"," "),t.uuid=ye.getValue(s,"UUID"," "),t.status=ye.getValue(s,"State"," "),t.local=ye.getValue(s,"Location"," ").toLowerCase().startsWith("local"),t.default=null,t.shared=ye.getValue(s,"Shared"," ").toLowerCase().startsWith("yes"),t}function pf(s,t){let e={};return e.id=t,e.name=ye.getValue(s,"Description",":",!0),e.model=s.length>0&&s[0]?s[0].split(" ")[0]:"",e.uri=null,e.uuid=null,e.status=s.length>0&&s[0]?s[0].indexOf(" idle")>0?"idle":s[0].indexOf(" printing")>0?"printing":"unknown":null,e.local=ye.getValue(s,"Location",":",!0).toLowerCase().startsWith("local"),e.default=null,e.shared=ye.getValue(s,"Shared"," ").toLowerCase().startsWith("yes"),e}function ff(s,t){let e={},r=s.uri.split("/");return e.id=t,e.name=s._name,e.model=r.length?r[r.length-1]:"",e.uri=s.uri,e.uuid=null,e.status=s.status,e.local=s.printserver==="local",e.default=s.default==="yes",e.shared=s.shared==="yes",e}function df(s,t){let e={},r=parseInt(ye.getValue(s,"PrinterStatus",":"),10);return e.id=t,e.name=ye.getValue(s,"name",":"),e.model=ye.getValue(s,"DriverName",":"),e.uri=null,e.uuid=null,e.status=ca[r]?ca[r]:null,e.local=ye.getValue(s,"Local",":").toUpperCase()==="TRUE",e.default=ye.getValue(s,"Default",":").toUpperCase()==="TRUE",e.shared=ye.getValue(s,"Shared",":").toUpperCase()==="TRUE",e}function mf(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(la||nf||of||af){let r="cat /etc/cups/printers.conf 2>/dev/null";fi(r,function(i,n){if(!i){let o=n.toString().split("<Printer "),a=cf(o[0]);for(let l=1;l<o.length;l++){let c=uf(o[l].split(`
|
|
368
|
+
`));c.name&&(c.engine="CUPS",c.engineVersion=a.cupsVersion,e.push(c))}}e.length===0&&la?(r="export LC_ALL=C; lpstat -lp 2>/dev/null; unset LC_ALL",fi(r,function(o,a){let l=(`
|
|
369
|
+
`+a.toString()).split(`
|
|
370
|
+
printer `);for(let c=1;c<l.length;c++){let u=pf(l[c].split(`
|
|
371
|
+
`),c);e.push(u)}}),s&&s(e),t(e)):(s&&s(e),t(e))})}sf&&fi("system_profiler SPPrintersDataType -json",function(i,n){if(!i)try{let o=JSON.parse(n.toString());if(o.SPPrintersDataType&&o.SPPrintersDataType.length)for(let a=0;a<o.SPPrintersDataType.length;a++){let l=ff(o.SPPrintersDataType[a],a);e.push(l)}}catch{ye.noop()}s&&s(e),t(e)}),rf&&ye.powerShell("Get-CimInstance Win32_Printer | select PrinterStatus,Name,DriverName,Local,Default,Shared | fl").then((r,i)=>{if(!i){let n=r.toString().split(/\n\s*\n/);for(let o=0;o<n.length;o++){let a=df(n[o].split(`
|
|
372
|
+
`),o);(a.name||a.model)&&e.push(a)}}s&&s(e),t(e)}),lf&&t(null)})})}ua.printer=mf});var ma=le(da=>{"use strict";var fa=require("child_process").exec,Ue=ce(),Ut=process.platform,hf=Ut==="linux"||Ut==="android",gf=Ut==="darwin",yf=Ut==="win32",_f=Ut==="freebsd",Sf=Ut==="openbsd",vf=Ut==="netbsd",xf=Ut==="sunos";function wf(s,t){let e=s,r=(t+" "+s).toLowerCase();return r.indexOf("camera")>=0?e="Camera":r.indexOf("hub")>=0?e="Hub":r.indexOf("keybrd")>=0||r.indexOf("keyboard")>=0?e="Keyboard":r.indexOf("mouse")>=0?e="Mouse":r.indexOf("stora")>=0?e="Storage":r.indexOf("microp")>=0?e="Microphone":(r.indexOf("headset")>=0||r.indexOf("audio")>=0)&&(e="Audio"),e}function Cf(s){let t={},e=s.split(`
|
|
373
|
+
`);if(e&&e.length&&e[0].indexOf("Device")>=0){let y=e[0].split(" ");t.bus=parseInt(y[0],10),y[2]?t.deviceId=parseInt(y[2],10):t.deviceId=null}else t.bus=null,t.deviceId=null;let r=Ue.getValue(e,"idVendor"," ",!0).trim(),i=r.split(" ");i.shift();let n=i.join(" "),o=Ue.getValue(e,"idProduct"," ",!0).trim(),a=o.split(" ");a.shift();let l=a.join(" "),u=Ue.getValue(e,"bInterfaceClass"," ",!0).trim().split(" ");u.shift();let p=u.join(" "),d=Ue.getValue(e,"iManufacturer"," ",!0).trim().split(" ");d.shift();let m=d.join(" "),_=Ue.getValue(e,"iSerial"," ",!0).trim().split(" ");_.shift();let h=_.join(" ");return t.id=(r.startsWith("0x")?r.split(" ")[0].substr(2,10):"")+":"+(o.startsWith("0x")?o.split(" ")[0].substr(2,10):""),t.name=l,t.type=wf(p,l),t.removable=null,t.vendor=n,t.manufacturer=m,t.maxPower=Ue.getValue(e,"MaxPower"," ",!0),t.serialNumber=h,t}function Of(s){let t="";return s.indexOf("camera")>=0?t="Camera":s.indexOf("touch bar")>=0?t="Touch Bar":s.indexOf("controller")>=0?t="Controller":s.indexOf("headset")>=0?t="Audio":s.indexOf("keyboard")>=0?t="Keyboard":s.indexOf("trackpad")>=0?t="Trackpad":s.indexOf("sensor")>=0?t="Sensor":s.indexOf("bthusb")>=0||s.indexOf("bth")>=0||s.indexOf("rfcomm")>=0?t="Bluetooth":s.indexOf("usbhub")>=0||s.indexOf(" hub")>=0?t="Hub":s.indexOf("mouse")>=0?t="Mouse":s.indexOf("microp")>=0?t="Microphone":s.indexOf("removable")>=0&&(t="Storage"),t}function If(s,t){let e={};e.id=t,s=s.replace(/ \|/g,""),s=s.trim();let r=s.split(`
|
|
374
|
+
`);r.shift();try{for(let o=0;o<r.length;o++){r[o]=r[o].trim(),r[o]=r[o].replace(/=/g,":"),r[o]!=="{"&&r[o]!=="}"&&r[o+1]&&r[o+1].trim()!=="}"&&(r[o]=r[o]+","),r[o]=r[o].replace(":Yes,",':"Yes",'),r[o]=r[o].replace(": Yes,",': "Yes",'),r[o]=r[o].replace(": Yes",': "Yes"'),r[o]=r[o].replace(":No,",':"No",'),r[o]=r[o].replace(": No,",': "No",'),r[o]=r[o].replace(": No",': "No"'),r[o]=r[o].replace("((","").replace("))","");let a=/<(\w+)>/.exec(r[o]);if(a){let l=a[0];r[o]=r[o].replace(l,`"${l}"`)}}let i=JSON.parse(r.join(`
|
|
375
|
+
`)),n=(i["Built-In"]?i["Built-In"].toLowerCase()!=="yes":!0)&&(i["non-removable"]?i["non-removable"].toLowerCase()==="no":!0);return e.bus=null,e.deviceId=null,e.id=i["USB Address"]||null,e.name=i.kUSBProductString||i["USB Product Name"]||null,e.type=Of((i.kUSBProductString||i["USB Product Name"]||"").toLowerCase()+(n?" removable":"")),e.removable=i["non-removable"]?i["non-removable"].toLowerCase()||!1:!0,e.vendor=i.kUSBVendorString||i["USB Vendor Name"]||null,e.manufacturer=i.kUSBVendorString||i["USB Vendor Name"]||null,e.maxPower=null,e.serialNumber=i.kUSBSerialNumberString||null,e.name?e:null}catch{return null}}function Lf(s,t){let e="";return t.indexOf("storage")>=0||t.indexOf("speicher")>=0?e="Storage":s.indexOf("usbhub")>=0?e="Hub":s.indexOf("storage")>=0?e="Storage":s.indexOf("usbcontroller")>=0?e="Controller":s.indexOf("keyboard")>=0?e="Keyboard":s.indexOf("pointing")>=0?e="Mouse":s.indexOf("microp")>=0?e="Microphone":s.indexOf("disk")>=0&&(e="Storage"),e}function Ef(s,t){let e=Lf(Ue.getValue(s,"CreationClassName",":").toLowerCase(),Ue.getValue(s,"name",":").toLowerCase());if(e){let r={};return r.bus=null,r.deviceId=Ue.getValue(s,"deviceid",":"),r.id=t,r.name=Ue.getValue(s,"name",":"),r.type=e,r.removable=null,r.vendor=null,r.manufacturer=Ue.getValue(s,"Manufacturer",":"),r.maxPower=null,r.serialNumber=null,r}else return null}function Pf(s){return new Promise(t=>{process.nextTick(()=>{let e=[];hf&&fa("export LC_ALL=C; lsusb -v 2>/dev/null; unset LC_ALL",{maxBuffer:1024*1024*128},function(i,n){if(!i){let o=(`
|
|
376
|
+
|
|
377
|
+
`+n.toString()).split(`
|
|
378
|
+
|
|
379
|
+
Bus `);for(let a=1;a<o.length;a++){let l=Cf(o[a]);e.push(l)}}s&&s(e),t(e)}),gf&&fa("ioreg -p IOUSB -c AppleUSBRootHubDevice -w0 -l",{maxBuffer:1024*1024*128},function(i,n){if(!i){let o=n.toString().split(" +-o ");for(let a=1;a<o.length;a++){let l=If(o[a]);l&&e.push(l)}s&&s(e),t(e)}s&&s(e),t(e)}),yf&&Ue.powerShell('Get-CimInstance CIM_LogicalDevice | where { $_.Description -match "USB"} | select Name,CreationClassName,DeviceId,Manufacturer | fl').then((r,i)=>{if(!i){let n=r.toString().split(/\n\s*\n/);for(let o=0;o<n.length;o++){let a=Ef(n[o].split(`
|
|
380
|
+
`),o);a&&e.filter(l=>l.deviceId===a.deviceId).length===0&&e.push(a)}}s&&s(e),t(e)}),(xf||_f||Sf||vf)&&t(null)})})}da.usb=Pf});var ya=le(ga=>{"use strict";var ha=require("child_process").exec,Tf=require("child_process").execSync,Ie=ce(),Gt=process.platform,Vf=Gt==="linux"||Gt==="android",Nf=Gt==="darwin",Df=Gt==="win32",Af=Gt==="freebsd",bf=Gt==="openbsd",Mf=Gt==="netbsd",Rf=Gt==="sunos";function di(s,t,e){s=s.toLowerCase();let r="";return s.indexOf("input")>=0&&(r="Microphone"),s.indexOf("display audio")>=0&&(r="Speaker"),s.indexOf("speak")>=0&&(r="Speaker"),s.indexOf("laut")>=0&&(r="Speaker"),s.indexOf("loud")>=0&&(r="Speaker"),s.indexOf("head")>=0&&(r="Headset"),s.indexOf("mic")>=0&&(r="Microphone"),s.indexOf("mikr")>=0&&(r="Microphone"),s.indexOf("phone")>=0&&(r="Phone"),s.indexOf("controll")>=0&&(r="Controller"),s.indexOf("line o")>=0&&(r="Line Out"),s.indexOf("digital o")>=0&&(r="Digital Out"),s.indexOf("smart sound technology")>=0&&(r="Digital Signal Processor"),s.indexOf("high definition audio")>=0&&(r="Sound Driver"),!r&&e?r="Speaker":!r&&t&&(r="Microphone"),r}function kf(){let s="lspci -v 2>/dev/null",t=[];try{return Tf(s,Ie.execOptsLinux).toString().split(`
|
|
381
|
+
|
|
382
|
+
`).forEach(r=>{let i=r.split(`
|
|
383
|
+
`);if(i&&i.length&&i[0].toLowerCase().indexOf("audio")>=0){let n={};n.slotId=i[0].split(" ")[0],n.driver=Ie.getValue(i,"Kernel driver in use",":",!0)||Ie.getValue(i,"Kernel modules",":",!0),t.push(n)}}),t}catch{return t}}function Ff(s,t){let e={},r=Ie.getValue(s,"Slot"),i=t.filter(function(n){return n.slotId===r});return e.id=r,e.name=Ie.getValue(s,"SDevice"),e.manufacturer=Ie.getValue(s,"SVendor"),e.revision=Ie.getValue(s,"Rev"),e.driver=i&&i.length===1&&i[0].driver?i[0].driver:"",e.default=null,e.channel="PCIe",e.type=di(e.name,null,null),e.in=null,e.out=null,e.status="online",e}function Bf(s){let t="";return s.indexOf("builtin")>=0&&(t="Built-In"),s.indexOf("extern")>=0&&(t="Audio-Jack"),s.indexOf("hdmi")>=0&&(t="HDMI"),s.indexOf("displayport")>=0&&(t="Display-Port"),s.indexOf("usb")>=0&&(t="USB"),s.indexOf("pci")>=0&&(t="PCIe"),t}function Wf(s,t){let e={},r=((s.coreaudio_device_transport||"")+" "+(s._name||"")).toLowerCase();return e.id=t,e.name=s._name,e.manufacturer=s.coreaudio_device_manufacturer,e.revision=null,e.driver=null,e.default=!!s.coreaudio_default_audio_input_device||!!s.coreaudio_default_audio_output_device,e.channel=Bf(r),e.type=di(e.name,!!s.coreaudio_device_input,!!s.coreaudio_device_output),e.in=!!s.coreaudio_device_input,e.out=!!s.coreaudio_device_output,e.status="online",e}function Uf(s){let t={},e=Ie.getValue(s,"StatusInfo",":");return t.id=Ie.getValue(s,"DeviceID",":"),t.name=Ie.getValue(s,"name",":"),t.manufacturer=Ie.getValue(s,"manufacturer",":"),t.revision=null,t.driver=null,t.default=null,t.channel=null,t.type=di(t.name,null,null),t.in=null,t.out=null,t.status=e,t}function Gf(s){return new Promise(t=>{process.nextTick(()=>{let e=[];(Vf||Af||bf||Mf)&&ha("lspci -vmm 2>/dev/null",function(i,n){if(!i){let o=kf();n.toString().split(`
|
|
384
|
+
|
|
385
|
+
`).forEach(l=>{let c=l.split(`
|
|
386
|
+
`);if(Ie.getValue(c,"class",":",!0).toLowerCase().indexOf("audio")>=0){let u=Ff(c,o);e.push(u)}})}s&&s(e),t(e)}),Nf&&ha("system_profiler SPAudioDataType -json",function(i,n){if(!i)try{let o=JSON.parse(n.toString());if(o.SPAudioDataType&&o.SPAudioDataType.length&&o.SPAudioDataType[0]&&o.SPAudioDataType[0]._items&&o.SPAudioDataType[0]._items.length)for(let a=0;a<o.SPAudioDataType[0]._items.length;a++){let l=Wf(o.SPAudioDataType[0]._items[a],a);e.push(l)}}catch{Ie.noop()}s&&s(e),t(e)}),Df&&Ie.powerShell("Get-CimInstance Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl").then((r,i)=>{i||r.toString().split(/\n\s*\n/).forEach(o=>{let a=o.split(`
|
|
387
|
+
`);Ie.getValue(a,"name",":")&&e.push(Uf(a))}),s&&s(e),t(e)}),Rf&&t(null)})})}ga.audio=Gf});var Sa=le(_a=>{"use strict";var jf=require("child_process").exec,zf=require("child_process").execSync,qf=require("path"),at=ce(),Hf=require("fs"),jt=process.platform,$f=jt==="linux"||jt==="android",Yf=jt==="darwin",Xf=jt==="win32",Kf=jt==="freebsd",Zf=jt==="openbsd",Jf=jt==="netbsd",Qf=jt==="sunos";function hi(s){let t="";return s.indexOf("keyboard")>=0&&(t="Keyboard"),s.indexOf("mouse")>=0&&(t="Mouse"),s.indexOf("trackpad")>=0&&(t="Trackpad"),s.indexOf("speaker")>=0&&(t="Speaker"),s.indexOf("headset")>=0&&(t="Headset"),s.indexOf("phone")>=0&&(t="Phone"),s.indexOf("macbook")>=0&&(t="Computer"),s.indexOf("imac")>=0&&(t="Computer"),s.indexOf("ipad")>=0&&(t="Tablet"),s.indexOf("watch")>=0&&(t="Watch"),s.indexOf("headphone")>=0&&(t="Headset"),t}function ed(s){let t=s.split(" ")[0];return s=s.toLowerCase(),s.indexOf("apple")>=0&&(t="Apple"),s.indexOf("ipad")>=0&&(t="Apple"),s.indexOf("imac")>=0&&(t="Apple"),s.indexOf("iphone")>=0&&(t="Apple"),s.indexOf("magic mouse")>=0&&(t="Apple"),s.indexOf("magic track")>=0&&(t="Apple"),s.indexOf("macbook")>=0&&(t="Apple"),t}function td(s,t,e){let r={};return r.device=null,r.name=at.getValue(s,"name","="),r.manufacturer=null,r.macDevice=t,r.macHost=e,r.batteryPercent=null,r.type=hi(r.name.toLowerCase()),r.connected=!1,r}function mi(s,t){let e={},r=((s.device_minorClassOfDevice_string||s.device_majorClassOfDevice_string||s.device_minorType||"")+(s.device_name||"")).toLowerCase();return e.device=s.device_services||"",e.name=s.device_name||"",e.manufacturer=s.device_manufacturer||ed(s.device_name||"")||"",e.macDevice=(s.device_addr||s.device_address||"").toLowerCase().replace(/-/g,":"),e.macHost=t,e.batteryPercent=s.device_batteryPercent||null,e.type=hi(r),e.connected=s.device_isconnected==="attrib_Yes"||!1,e}function sd(s){let t={};return t.device=null,t.name=at.getValue(s,"name",":"),t.manufacturer=at.getValue(s,"manufacturer",":"),t.macDevice=null,t.macHost=null,t.batteryPercent=null,t.type=hi(t.name.toLowerCase()),t.connected=null,t}function rd(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if($f){at.getFilesInPath("/var/lib/bluetooth/").forEach(i=>{let n=qf.basename(i),o=i.split("/"),a=o.length>=6?o[o.length-2]:null,l=o.length>=7?o[o.length-3]:null;if(n==="info"){let c=Hf.readFileSync(i,{encoding:"utf8"}).split(`
|
|
388
|
+
`);e.push(td(c,a,l))}});try{let i=zf("hcitool con",at.execOptsLinux).toString().toLowerCase();for(let n=0;n<e.length;n++)e[n].macDevice&&e[n].macDevice.length>10&&i.indexOf(e[n].macDevice.toLowerCase())>=0&&(e[n].connected=!0)}catch{at.noop()}s&&s(e),t(e)}Yf&&jf("system_profiler SPBluetoothDataType -json",function(i,n){if(!i)try{let o=JSON.parse(n.toString());if(o.SPBluetoothDataType&&o.SPBluetoothDataType.length&&o.SPBluetoothDataType[0]&&o.SPBluetoothDataType[0].device_title&&o.SPBluetoothDataType[0].device_title.length){let a=null;o.SPBluetoothDataType[0].local_device_title&&o.SPBluetoothDataType[0].local_device_title.general_address&&(a=o.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g,":")),o.SPBluetoothDataType[0].device_title.forEach(l=>{let c=l,u=Object.keys(c);if(u&&u.length===1){let p=c[u[0]];p.device_name=u[0];let f=mi(p,a);e.push(f)}})}if(o.SPBluetoothDataType&&o.SPBluetoothDataType.length&&o.SPBluetoothDataType[0]&&o.SPBluetoothDataType[0].device_connected&&o.SPBluetoothDataType[0].device_connected.length){let a=o.SPBluetoothDataType[0].controller_properties&&o.SPBluetoothDataType[0].controller_properties.controller_address?o.SPBluetoothDataType[0].controller_properties.controller_address.toLowerCase().replace(/-/g,":"):null;o.SPBluetoothDataType[0].device_connected.forEach(l=>{let c=l,u=Object.keys(c);if(u&&u.length===1){let p=c[u[0]];p.device_name=u[0],p.device_isconnected="attrib_Yes";let f=mi(p,a);e.push(f)}})}if(o.SPBluetoothDataType&&o.SPBluetoothDataType.length&&o.SPBluetoothDataType[0]&&o.SPBluetoothDataType[0].device_not_connected&&o.SPBluetoothDataType[0].device_not_connected.length){let a=o.SPBluetoothDataType[0].controller_properties&&o.SPBluetoothDataType[0].controller_properties.controller_address?o.SPBluetoothDataType[0].controller_properties.controller_address.toLowerCase().replace(/-/g,":"):null;o.SPBluetoothDataType[0].device_not_connected.forEach(l=>{let c=l,u=Object.keys(c);if(u&&u.length===1){let p=c[u[0]];p.device_name=u[0],p.device_isconnected="attrib_No";let f=mi(p,a);e.push(f)}})}}catch{at.noop()}s&&s(e),t(e)}),Xf&&at.powerShell("Get-CimInstance Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl").then((r,i)=>{i||r.toString().split(/\n\s*\n/).forEach(o=>{at.getValue(o.split(`
|
|
389
|
+
`),"PNPClass",":")==="Bluetooth"&&e.push(sd(o.split(`
|
|
390
|
+
`)))}),s&&s(e),t(e)}),(Kf||Jf||Zf||Qf)&&t(null)})})}_a.bluetoothDevices=rd});var Ea=le(R=>{"use strict";var nd=Fi().version,hs=ce(),zt=eo(),lt=so(),Ge=lo(),un=So(),va=wo(),xa=Eo(),tt=Do(),ct=Wo(),pn=Ho(),Cr=Xo(),wa=Jo(),gi=ta(),gs=ia(),id=aa(),od=pa(),ad=ma(),ld=ya(),cd=Sa(),Or=process.platform,cn=Or==="win32",vr=Or==="freebsd",xr=Or==="openbsd",wr=Or==="netbsd",et=Or==="sunos";cn&&hs.getCodepage();function Ca(){return nd}function Oa(s){return new Promise(t=>{process.nextTick(()=>{let e={};e.version=Ca(),Promise.all([zt.system(),zt.bios(),zt.baseboard(),zt.chassis(),lt.osInfo(),lt.uuid(),lt.versions(),Ge.cpu(),Ge.cpuFlags(),xa.graphics(),ct.networkInterfaces(),un.memLayout(),tt.diskLayout()]).then(r=>{e.system=r[0],e.bios=r[1],e.baseboard=r[2],e.chassis=r[3],e.os=r[4],e.uuid=r[5],e.versions=r[6],e.cpu=r[7],e.cpu.flags=r[8],e.graphics=r[9],e.net=r[10],e.memLayout=r[11],e.diskLayout=r[12],s&&s(e),t(e)})})})}function Ia(s,t,e){return hs.isFunction(t)&&(e=t,t=""),hs.isFunction(s)&&(e=s,s=""),new Promise(r=>{process.nextTick(()=>{t=t||ct.getDefaultNetworkInterface(),s=s||"";let i=function(){let o=15;return cn&&(o=13),(vr||xr||wr)&&(o=11),et&&(o=6),function(){--o===0&&(e&&e(n),r(n))}}(),n={};n.time=lt.time(),n.node=process.versions.node,n.v8=process.versions.v8,Ge.cpuCurrentSpeed().then(o=>{n.cpuCurrentSpeed=o,i()}),wa.users().then(o=>{n.users=o,i()}),Cr.processes().then(o=>{n.processes=o,i()}),Ge.currentLoad().then(o=>{n.currentLoad=o,i()}),et||Ge.cpuTemperature().then(o=>{n.temp=o,i()}),!xr&&!vr&&!wr&&!et&&ct.networkStats(t).then(o=>{n.networkStats=o,i()}),et||ct.networkConnections().then(o=>{n.networkConnections=o,i()}),un.mem().then(o=>{n.mem=o,i()}),et||va().then(o=>{n.battery=o,i()}),et||Cr.services(s).then(o=>{n.services=o,i()}),et||tt.fsSize().then(o=>{n.fsSize=o,i()}),!cn&&!xr&&!vr&&!wr&&!et&&tt.fsStats().then(o=>{n.fsStats=o,i()}),!cn&&!xr&&!vr&&!wr&&!et&&tt.disksIO().then(o=>{n.disksIO=o,i()}),!xr&&!vr&&!wr&&!et&&pn.wifiNetworks().then(o=>{n.wifiNetworks=o,i()}),gi.inetLatency().then(o=>{n.inetLatency=o,i()})})})}function ud(s,t,e){return new Promise(r=>{process.nextTick(()=>{let i={};t&&hs.isFunction(t)&&!e&&(e=t,t=""),s&&hs.isFunction(s)&&!t&&!e&&(e=s,s="",t=""),Oa().then(n=>{i=n,Ia(s,t).then(o=>{for(let a in o)({}).hasOwnProperty.call(o,a)&&(i[a]=o[a]);e&&e(i),r(i)})})})})}function La(s,t){return new Promise(e=>{process.nextTick(()=>{let r=Object.keys(s).filter(i=>({}).hasOwnProperty.call(R,i)).map(i=>{let n=s[i].substring(s[i].lastIndexOf("(")+1,s[i].lastIndexOf(")")),o=i.indexOf(")")>=0?i.split(")")[1].trim():i;return o=i.indexOf("|")>=0?i.split("|")[0].trim():o,n?R[o](n):R[o]("")});Promise.all(r).then(i=>{let n={},o=0;for(let a in s)if({}.hasOwnProperty.call(s,a)&&{}.hasOwnProperty.call(R,a)&&i.length>o){if(s[a]==="*"||s[a]==="all")n[a]=i[o];else{let l=s[a],c="",u=[];if(l.indexOf(")")>=0&&(l=l.split(")")[1].trim()),l.indexOf("|")>=0&&(c=l.split("|")[1].trim(),u=c.split(":"),l=l.split("|")[0].trim()),l=l.replace(/,/g," ").replace(/ +/g," ").split(" "),i[o])if(Array.isArray(i[o])){let p=[];i[o].forEach(f=>{let d={};if(l.length===1&&(l[0]==="*"||l[0]==="all")?d=f:l.forEach(m=>{({}).hasOwnProperty.call(f,m)&&(d[m]=f[m])}),c&&u.length===2){if({}.hasOwnProperty.call(d,u[0].trim())){let m=d[u[0].trim()];typeof m=="number"?m===parseFloat(u[1].trim())&&p.push(d):typeof m=="string"&&m.toLowerCase()===u[1].trim().toLowerCase()&&p.push(d)}}else p.push(d)}),n[a]=p}else{let p={};l.forEach(f=>{({}).hasOwnProperty.call(i[o],f)&&(p[f]=i[o][f])}),n[a]=p}else n[a]={}}o++}t&&t(n),e(n)})})})}function pd(s,t,e){let r=null;return setInterval(()=>{La(s).then(n=>{JSON.stringify(r)!==JSON.stringify(n)&&(r=Object.assign({},n),e(n))})},t)}R.version=Ca;R.system=zt.system;R.bios=zt.bios;R.baseboard=zt.baseboard;R.chassis=zt.chassis;R.time=lt.time;R.osInfo=lt.osInfo;R.versions=lt.versions;R.shell=lt.shell;R.uuid=lt.uuid;R.cpu=Ge.cpu;R.cpuFlags=Ge.cpuFlags;R.cpuCache=Ge.cpuCache;R.cpuCurrentSpeed=Ge.cpuCurrentSpeed;R.cpuTemperature=Ge.cpuTemperature;R.currentLoad=Ge.currentLoad;R.fullLoad=Ge.fullLoad;R.mem=un.mem;R.memLayout=un.memLayout;R.battery=va;R.graphics=xa.graphics;R.fsSize=tt.fsSize;R.fsOpenFiles=tt.fsOpenFiles;R.blockDevices=tt.blockDevices;R.fsStats=tt.fsStats;R.disksIO=tt.disksIO;R.diskLayout=tt.diskLayout;R.networkInterfaceDefault=ct.networkInterfaceDefault;R.networkGatewayDefault=ct.networkGatewayDefault;R.networkInterfaces=ct.networkInterfaces;R.networkStats=ct.networkStats;R.networkConnections=ct.networkConnections;R.wifiNetworks=pn.wifiNetworks;R.wifiInterfaces=pn.wifiInterfaces;R.wifiConnections=pn.wifiConnections;R.services=Cr.services;R.processes=Cr.processes;R.processLoad=Cr.processLoad;R.users=wa.users;R.inetChecksite=gi.inetChecksite;R.inetLatency=gi.inetLatency;R.dockerInfo=gs.dockerInfo;R.dockerImages=gs.dockerImages;R.dockerContainers=gs.dockerContainers;R.dockerContainerStats=gs.dockerContainerStats;R.dockerContainerProcesses=gs.dockerContainerProcesses;R.dockerVolumes=gs.dockerVolumes;R.dockerAll=gs.dockerAll;R.vboxInfo=id.vboxInfo;R.printer=od.printer;R.usb=ad.usb;R.audio=ld.audio;R.bluetoothDevices=cd.bluetoothDevices;R.getStaticData=Oa;R.getDynamicData=Ia;R.getAllData=ud;R.get=La;R.observe=pd;R.powerShellStart=hs.powerShellStart;R.powerShellRelease=hs.powerShellRelease});var Ta=le((_m,fd)=>{fd.exports={name:"dotenv",version:"16.4.7",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var Aa=le((Sm,ut)=>{var yi=require("fs"),_i=require("path"),dd=require("os"),md=require("crypto"),hd=Ta(),Si=hd.version,gd=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function yd(s){let t={},e=s.toString();e=e.replace(/\r\n?/mg,`
|
|
391
|
+
`);let r;for(;(r=gd.exec(e))!=null;){let i=r[1],n=r[2]||"";n=n.trim();let o=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(n=n.replace(/\\n/g,`
|
|
392
|
+
`),n=n.replace(/\\r/g,"\r")),t[i]=n}return t}function _d(s){let t=Da(s),e=ge.configDotenv({path:t});if(!e.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw o.code="MISSING_DATA",o}let r=Na(s).split(","),i=r.length,n;for(let o=0;o<i;o++)try{let a=r[o].trim(),l=xd(e,a);n=ge.decrypt(l.ciphertext,l.key);break}catch(a){if(o+1>=i)throw a}return ge.parse(n)}function Sd(s){console.log(`[dotenv@${Si}][INFO] ${s}`)}function vd(s){console.log(`[dotenv@${Si}][WARN] ${s}`)}function dn(s){console.log(`[dotenv@${Si}][DEBUG] ${s}`)}function Na(s){return s&&s.DOTENV_KEY&&s.DOTENV_KEY.length>0?s.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function xd(s,t){let e;try{e=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let r=e.password;if(!r){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=e.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let n=`DOTENV_VAULT_${i.toUpperCase()}`,o=s.parsed[n];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${n} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:r}}function Da(s){let t=null;if(s&&s.path&&s.path.length>0)if(Array.isArray(s.path))for(let e of s.path)yi.existsSync(e)&&(t=e.endsWith(".vault")?e:`${e}.vault`);else t=s.path.endsWith(".vault")?s.path:`${s.path}.vault`;else t=_i.resolve(process.cwd(),".env.vault");return yi.existsSync(t)?t:null}function Va(s){return s[0]==="~"?_i.join(dd.homedir(),s.slice(1)):s}function wd(s){Sd("Loading env from encrypted .env.vault");let t=ge._parseVault(s),e=process.env;return s&&s.processEnv!=null&&(e=s.processEnv),ge.populate(e,t,s),{parsed:t}}function Cd(s){let t=_i.resolve(process.cwd(),".env"),e="utf8",r=!!(s&&s.debug);s&&s.encoding?e=s.encoding:r&&dn("No encoding is specified. UTF-8 is used by default");let i=[t];if(s&&s.path)if(!Array.isArray(s.path))i=[Va(s.path)];else{i=[];for(let l of s.path)i.push(Va(l))}let n,o={};for(let l of i)try{let c=ge.parse(yi.readFileSync(l,{encoding:e}));ge.populate(o,c,s)}catch(c){r&&dn(`Failed to load ${l} ${c.message}`),n=c}let a=process.env;return s&&s.processEnv!=null&&(a=s.processEnv),ge.populate(a,o,s),n?{parsed:o,error:n}:{parsed:o}}function Od(s){if(Na(s).length===0)return ge.configDotenv(s);let t=Da(s);return t?ge._configVault(s):(vd(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),ge.configDotenv(s))}function Id(s,t){let e=Buffer.from(t.slice(-64),"hex"),r=Buffer.from(s,"base64"),i=r.subarray(0,12),n=r.subarray(-16);r=r.subarray(12,-16);try{let o=md.createDecipheriv("aes-256-gcm",e,i);return o.setAuthTag(n),`${o.update(r)}${o.final()}`}catch(o){let a=o instanceof RangeError,l=o.message==="Invalid key length",c=o.message==="Unsupported state or unable to authenticate data";if(a||l){let u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(c){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw o}}function Ld(s,t,e={}){let r=!!(e&&e.debug),i=!!(e&&e.override);if(typeof t!="object"){let n=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw n.code="OBJECT_REQUIRED",n}for(let n of Object.keys(t))Object.prototype.hasOwnProperty.call(s,n)?(i===!0&&(s[n]=t[n]),r&&dn(i===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):s[n]=t[n]}var ge={configDotenv:Cd,_configVault:wd,_parseVault:_d,config:Od,decrypt:Id,parse:yd,populate:Ld};ut.exports.configDotenv=ge.configDotenv;ut.exports._configVault=ge._configVault;ut.exports._parseVault=ge._parseVault;ut.exports.config=ge.config;ut.exports.decrypt=ge.decrypt;ut.exports.parse=ge.parse;ut.exports.populate=ge.populate;ut.exports=ge});var Dd={};ja(Dd,{generatePreviewUrl:()=>Nd});module.exports=za(Dd);var te;(function(s){s.assertEqual=i=>i;function t(i){}s.assertIs=t;function e(i){throw new Error}s.assertNever=e,s.arrayToEnum=i=>{let n={};for(let o of i)n[o]=o;return n},s.getValidEnumValues=i=>{let n=s.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of n)o[a]=i[a];return s.objectValues(o)},s.objectValues=i=>s.objectKeys(i).map(function(n){return i[n]}),s.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let n=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&n.push(o);return n},s.find=(i,n)=>{for(let o of i)if(n(o))return o},s.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,n=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}s.joinValues=r,s.jsonStringifyReplacer=(i,n)=>typeof n=="bigint"?n.toString():n})(te||(te={}));var gn;(function(s){s.mergeShapes=(t,e)=>({...t,...e})})(gn||(gn={}));var M=te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pt=s=>{switch(typeof s){case"undefined":return M.undefined;case"string":return M.string;case"number":return isNaN(s)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(s)?M.array:s===null?M.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?M.promise:typeof Map<"u"&&s instanceof Map?M.map:typeof Set<"u"&&s instanceof Set?M.set:typeof Date<"u"&&s instanceof Date?M.date:M.object;default:return M.unknown}},L=te.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),qa=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:"),Te=class s extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){let e=t||function(n){return n.message},r={_errors:[]},i=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(e(o));else{let a=r,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(t){if(!(t instanceof s))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,te.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=e=>e.message){let e={},r=[];for(let i of this.issues)i.path.length>0?(e[i.path[0]]=e[i.path[0]]||[],e[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:e}}get formErrors(){return this.flatten()}};Te.create=s=>new Te(s);var vs=(s,t)=>{let e;switch(s.code){case L.invalid_type:s.received===M.undefined?e="Required":e=`Expected ${s.expected}, received ${s.received}`;break;case L.invalid_literal:e=`Invalid literal value, expected ${JSON.stringify(s.expected,te.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:e=`Unrecognized key(s) in object: ${te.joinValues(s.keys,", ")}`;break;case L.invalid_union:e="Invalid input";break;case L.invalid_union_discriminator:e=`Invalid discriminator value. Expected ${te.joinValues(s.options)}`;break;case L.invalid_enum_value:e=`Invalid enum value. Expected ${te.joinValues(s.options)}, received '${s.received}'`;break;case L.invalid_arguments:e="Invalid function arguments";break;case L.invalid_return_type:e="Invalid function return type";break;case L.invalid_date:e="Invalid date";break;case L.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(e=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(e=`${e} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?e=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?e=`Invalid input: must end with "${s.validation.endsWith}"`:te.assertNever(s.validation):s.validation!=="regex"?e=`Invalid ${s.validation}`:e="Invalid";break;case L.too_small:s.type==="array"?e=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?e=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?e=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?e=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:e="Invalid input";break;case L.too_big:s.type==="array"?e=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?e=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?e=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?e=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?e=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:e="Invalid input";break;case L.custom:e="Invalid input";break;case L.invalid_intersection_types:e="Intersection results could not be merged";break;case L.not_multiple_of:e=`Number must be a multiple of ${s.multipleOf}`;break;case L.not_finite:e="Number must be finite";break;default:e=t.defaultError,te.assertNever(s)}return{message:e}},Oi=vs;function Ha(s){Oi=s}function Lr(){return Oi}var Er=s=>{let{data:t,path:e,errorMaps:r,issueData:i}=s,n=[...e,...i.path||[]],o={...i,path:n};if(i.message!==void 0)return{...i,path:n,message:i.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(o,{data:t,defaultError:a}).message;return{...i,path:n,message:a}},$a=[];function A(s,t){let e=Lr(),r=Er({issueData:t,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,e,e===vs?void 0:vs].filter(i=>!!i)});s.common.issues.push(r)}var ve=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,e){let r=[];for(let i of e){if(i.status==="aborted")return q;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,e){let r=[];for(let i of e){let n=await i.key,o=await i.value;r.push({key:n,value:o})}return s.mergeObjectSync(t,r)}static mergeObjectSync(t,e){let r={};for(let i of e){let{key:n,value:o}=i;if(n.status==="aborted"||o.status==="aborted")return q;n.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),n.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[n.value]=o.value)}return{status:t.value,value:r}}},q=Object.freeze({status:"aborted"}),Ss=s=>({status:"dirty",value:s}),Ce=s=>({status:"valid",value:s}),yn=s=>s.status==="aborted",_n=s=>s.status==="dirty",Hs=s=>s.status==="valid",$s=s=>typeof Promise<"u"&&s instanceof Promise;function Pr(s,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!r:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(s):r?r.value:t.get(s)}function Ii(s,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!i:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(s,e):i?i.value=e:t.set(s,e),e}var k;(function(s){s.errToObj=t=>typeof t=="string"?{message:t}:t||{},s.toString=t=>typeof t=="string"?t:t?.message})(k||(k={}));var zs,qs,be=class{constructor(t,e,r,i){this._cachedPath=[],this.parent=t,this.data=e,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},wi=(s,t)=>{if(Hs(t))return{success:!0,data:t.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let e=new Te(s.common.issues);return this._error=e,this._error}}};function $(s){if(!s)return{};let{errorMap:t,invalid_type_error:e,required_error:r,description:i}=s;if(t&&(e||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{var l,c;let{message:u}=s;return o.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??e)!==null&&c!==void 0?c:a.defaultError}},description:i}}var Y=class{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return pt(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:pt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ve,ctx:{common:t.parent.common,data:t.data,parsedType:pt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if($s(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let r=this.safeParse(t,e);if(r.success)return r.data;throw r.error}safeParse(t,e){var r;let i={common:{issues:[],async:(r=e?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pt(t)},n=this._parseSync({data:t,path:i.path,parent:i});return wi(i,n)}async parseAsync(t,e){let r=await this.safeParseAsync(t,e);if(r.success)return r.data;throw r.error}async safeParseAsync(t,e){let r={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pt(t)},i=this._parse({data:t,path:r.path,parent:r}),n=await($s(i)?i:Promise.resolve(i));return wi(r,n)}refine(t,e){let r=i=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(i):e;return this._refinement((i,n)=>{let o=t(i),a=()=>n.addIssue({code:L.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,e){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof e=="function"?e(r,i):e),!1))}_refinement(t){return new Ve({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Ae.create(this,this._def)}nullable(){return Xe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nt.create(this,this._def)}promise(){return mt.create(this,this._def)}or(t){return Zt.create([this,t],this._def)}and(t){return Jt.create(this,t,this._def)}transform(t){return new Ve({...$(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new rs({...$(this._def),innerType:this,defaultValue:e,typeName:z.ZodDefault})}brand(){return new Ys({typeName:z.ZodBranded,type:this,...$(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new ns({...$(this._def),innerType:this,catchValue:e,typeName:z.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return Xs.create(this,t)}readonly(){return is.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ya=/^c[^\s-]{8,}$/i,Xa=/^[0-9a-z]+$/,Ka=/^[0-9A-HJKMNP-TV-Z]{26}$/,Za=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ja=/^[a-z0-9_-]{21}$/i,Qa=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,el=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",hn,sl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rl=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,nl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Li="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",il=new RegExp(`^${Li}$`);function Ei(s){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return s.precision?t=`${t}\\.\\d{${s.precision}}`:s.precision==null&&(t=`${t}(\\.\\d+)?`),t}function ol(s){return new RegExp(`^${Ei(s)}$`)}function Pi(s){let t=`${Li}T${Ei(s)}`,e=[];return e.push(s.local?"Z?":"Z"),s.offset&&e.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${e.join("|")})`,new RegExp(`^${t}$`)}function al(s,t){return!!((t==="v4"||!t)&&sl.test(s)||(t==="v6"||!t)&&rl.test(s))}var ft=class s extends Y{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==M.string){let n=this._getOrReturnCtx(t);return A(n,{code:L.invalid_type,expected:M.string,received:n.parsedType}),q}let r=new ve,i;for(let n of this._def.checks)if(n.kind==="min")t.data.length<n.value&&(i=this._getOrReturnCtx(t,i),A(i,{code:L.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="max")t.data.length>n.value&&(i=this._getOrReturnCtx(t,i),A(i,{code:L.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){let o=t.data.length>n.value,a=t.data.length<n.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?A(i,{code:L.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):a&&A(i,{code:L.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind==="email")el.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"email",code:L.invalid_string,message:n.message}),r.dirty());else if(n.kind==="emoji")hn||(hn=new RegExp(tl,"u")),hn.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"emoji",code:L.invalid_string,message:n.message}),r.dirty());else if(n.kind==="uuid")Za.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"uuid",code:L.invalid_string,message:n.message}),r.dirty());else if(n.kind==="nanoid")Ja.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"nanoid",code:L.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid")Ya.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"cuid",code:L.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid2")Xa.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"cuid2",code:L.invalid_string,message:n.message}),r.dirty());else if(n.kind==="ulid")Ka.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"ulid",code:L.invalid_string,message:n.message}),r.dirty());else if(n.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),A(i,{validation:"url",code:L.invalid_string,message:n.message}),r.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"regex",code:L.invalid_string,message:n.message}),r.dirty())):n.kind==="trim"?t.data=t.data.trim():n.kind==="includes"?t.data.includes(n.value,n.position)||(i=this._getOrReturnCtx(t,i),A(i,{code:L.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind==="toLowerCase"?t.data=t.data.toLowerCase():n.kind==="toUpperCase"?t.data=t.data.toUpperCase():n.kind==="startsWith"?t.data.startsWith(n.value)||(i=this._getOrReturnCtx(t,i),A(i,{code:L.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind==="endsWith"?t.data.endsWith(n.value)||(i=this._getOrReturnCtx(t,i),A(i,{code:L.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind==="datetime"?Pi(n).test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{code:L.invalid_string,validation:"datetime",message:n.message}),r.dirty()):n.kind==="date"?il.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{code:L.invalid_string,validation:"date",message:n.message}),r.dirty()):n.kind==="time"?ol(n).test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{code:L.invalid_string,validation:"time",message:n.message}),r.dirty()):n.kind==="duration"?Qa.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"duration",code:L.invalid_string,message:n.message}),r.dirty()):n.kind==="ip"?al(t.data,n.version)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"ip",code:L.invalid_string,message:n.message}),r.dirty()):n.kind==="base64"?nl.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"base64",code:L.invalid_string,message:n.message}),r.dirty()):te.assertNever(n);return{status:r.value,value:t.data}}_regex(t,e,r){return this.refinement(i=>t.test(i),{validation:e,code:L.invalid_string,...k.errToObj(r)})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...k.errToObj(t)})}url(t){return this._addCheck({kind:"url",...k.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...k.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...k.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...k.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...k.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...k.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...k.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...k.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...k.errToObj(t)})}datetime(t){var e,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(e=t?.offset)!==null&&e!==void 0?e:!1,local:(r=t?.local)!==null&&r!==void 0?r:!1,...k.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...k.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...k.errToObj(t)})}regex(t,e){return this._addCheck({kind:"regex",regex:t,...k.errToObj(e)})}includes(t,e){return this._addCheck({kind:"includes",value:t,position:e?.position,...k.errToObj(e?.message)})}startsWith(t,e){return this._addCheck({kind:"startsWith",value:t,...k.errToObj(e)})}endsWith(t,e){return this._addCheck({kind:"endsWith",value:t,...k.errToObj(e)})}min(t,e){return this._addCheck({kind:"min",value:t,...k.errToObj(e)})}max(t,e){return this._addCheck({kind:"max",value:t,...k.errToObj(e)})}length(t,e){return this._addCheck({kind:"length",value:t,...k.errToObj(e)})}nonempty(t){return this.min(1,k.errToObj(t))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(let e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t}get maxLength(){let t=null;for(let e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t}};ft.create=s=>{var t;return new ft({checks:[],typeName:z.ZodString,coerce:(t=s?.coerce)!==null&&t!==void 0?t:!1,...$(s)})};function ll(s,t){let e=(s.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=e>r?e:r,n=parseInt(s.toFixed(i).replace(".","")),o=parseInt(t.toFixed(i).replace(".",""));return n%o/Math.pow(10,i)}var qt=class s extends Y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==M.number){let n=this._getOrReturnCtx(t);return A(n,{code:L.invalid_type,expected:M.number,received:n.parsedType}),q}let r,i=new ve;for(let n of this._def.checks)n.kind==="int"?te.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),A(r,{code:L.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()):n.kind==="min"?(n.inclusive?t.data<n.value:t.data<=n.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:L.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?t.data>n.value:t.data>=n.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:L.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="multipleOf"?ll(t.data,n.value)!==0&&(r=this._getOrReturnCtx(t,r),A(r,{code:L.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):n.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),A(r,{code:L.not_finite,message:n.message}),i.dirty()):te.assertNever(n);return{status:i.value,value:t.data}}gte(t,e){return this.setLimit("min",t,!0,k.toString(e))}gt(t,e){return this.setLimit("min",t,!1,k.toString(e))}lte(t,e){return this.setLimit("max",t,!0,k.toString(e))}lt(t,e){return this.setLimit("max",t,!1,k.toString(e))}setLimit(t,e,r,i){return new s({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:k.toString(i)}]})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:k.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:k.toString(e)})}finite(t){return this._addCheck({kind:"finite",message:k.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k.toString(t)})}get minValue(){let t=null;for(let e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t}get maxValue(){let t=null;for(let e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&te.isInteger(t.value))}get isFinite(){let t=null,e=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(e===null||r.value>e)&&(e=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(e)&&Number.isFinite(t)}};qt.create=s=>new qt({checks:[],typeName:z.ZodNumber,coerce:s?.coerce||!1,...$(s)});var Ht=class s extends Y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==M.bigint){let n=this._getOrReturnCtx(t);return A(n,{code:L.invalid_type,expected:M.bigint,received:n.parsedType}),q}let r,i=new ve;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?t.data<n.value:t.data<=n.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:L.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?t.data>n.value:t.data>=n.value)&&(r=this._getOrReturnCtx(t,r),A(r,{code:L.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="multipleOf"?t.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),A(r,{code:L.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):te.assertNever(n);return{status:i.value,value:t.data}}gte(t,e){return this.setLimit("min",t,!0,k.toString(e))}gt(t,e){return this.setLimit("min",t,!1,k.toString(e))}lte(t,e){return this.setLimit("max",t,!0,k.toString(e))}lt(t,e){return this.setLimit("max",t,!1,k.toString(e))}setLimit(t,e,r,i){return new s({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:k.toString(i)}]})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:k.toString(e)})}get minValue(){let t=null;for(let e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t}get maxValue(){let t=null;for(let e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t}};Ht.create=s=>{var t;return new Ht({checks:[],typeName:z.ZodBigInt,coerce:(t=s?.coerce)!==null&&t!==void 0?t:!1,...$(s)})};var $t=class extends Y{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==M.boolean){let r=this._getOrReturnCtx(t);return A(r,{code:L.invalid_type,expected:M.boolean,received:r.parsedType}),q}return Ce(t.data)}};$t.create=s=>new $t({typeName:z.ZodBoolean,coerce:s?.coerce||!1,...$(s)});var Yt=class s extends Y{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==M.date){let n=this._getOrReturnCtx(t);return A(n,{code:L.invalid_type,expected:M.date,received:n.parsedType}),q}if(isNaN(t.data.getTime())){let n=this._getOrReturnCtx(t);return A(n,{code:L.invalid_date}),q}let r=new ve,i;for(let n of this._def.checks)n.kind==="min"?t.data.getTime()<n.value&&(i=this._getOrReturnCtx(t,i),A(i,{code:L.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):n.kind==="max"?t.data.getTime()>n.value&&(i=this._getOrReturnCtx(t,i),A(i,{code:L.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):te.assertNever(n);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}min(t,e){return this._addCheck({kind:"min",value:t.getTime(),message:k.toString(e)})}max(t,e){return this._addCheck({kind:"max",value:t.getTime(),message:k.toString(e)})}get minDate(){let t=null;for(let e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t!=null?new Date(t):null}};Yt.create=s=>new Yt({checks:[],coerce:s?.coerce||!1,typeName:z.ZodDate,...$(s)});var xs=class extends Y{_parse(t){if(this._getType(t)!==M.symbol){let r=this._getOrReturnCtx(t);return A(r,{code:L.invalid_type,expected:M.symbol,received:r.parsedType}),q}return Ce(t.data)}};xs.create=s=>new xs({typeName:z.ZodSymbol,...$(s)});var Xt=class extends Y{_parse(t){if(this._getType(t)!==M.undefined){let r=this._getOrReturnCtx(t);return A(r,{code:L.invalid_type,expected:M.undefined,received:r.parsedType}),q}return Ce(t.data)}};Xt.create=s=>new Xt({typeName:z.ZodUndefined,...$(s)});var Kt=class extends Y{_parse(t){if(this._getType(t)!==M.null){let r=this._getOrReturnCtx(t);return A(r,{code:L.invalid_type,expected:M.null,received:r.parsedType}),q}return Ce(t.data)}};Kt.create=s=>new Kt({typeName:z.ZodNull,...$(s)});var dt=class extends Y{constructor(){super(...arguments),this._any=!0}_parse(t){return Ce(t.data)}};dt.create=s=>new dt({typeName:z.ZodAny,...$(s)});var rt=class extends Y{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ce(t.data)}};rt.create=s=>new rt({typeName:z.ZodUnknown,...$(s)});var je=class extends Y{_parse(t){let e=this._getOrReturnCtx(t);return A(e,{code:L.invalid_type,expected:M.never,received:e.parsedType}),q}};je.create=s=>new je({typeName:z.ZodNever,...$(s)});var ws=class extends Y{_parse(t){if(this._getType(t)!==M.undefined){let r=this._getOrReturnCtx(t);return A(r,{code:L.invalid_type,expected:M.void,received:r.parsedType}),q}return Ce(t.data)}};ws.create=s=>new ws({typeName:z.ZodVoid,...$(s)});var nt=class s extends Y{_parse(t){let{ctx:e,status:r}=this._processInputParams(t),i=this._def;if(e.parsedType!==M.array)return A(e,{code:L.invalid_type,expected:M.array,received:e.parsedType}),q;if(i.exactLength!==null){let o=e.data.length>i.exactLength.value,a=e.data.length<i.exactLength.value;(o||a)&&(A(e,{code:o?L.too_big:L.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&e.data.length<i.minLength.value&&(A(e,{code:L.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&e.data.length>i.maxLength.value&&(A(e,{code:L.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),e.common.async)return Promise.all([...e.data].map((o,a)=>i.type._parseAsync(new be(e,o,e.path,a)))).then(o=>ve.mergeArray(r,o));let n=[...e.data].map((o,a)=>i.type._parseSync(new be(e,o,e.path,a)));return ve.mergeArray(r,n)}get element(){return this._def.type}min(t,e){return new s({...this._def,minLength:{value:t,message:k.toString(e)}})}max(t,e){return new s({...this._def,maxLength:{value:t,message:k.toString(e)}})}length(t,e){return new s({...this._def,exactLength:{value:t,message:k.toString(e)}})}nonempty(t){return this.min(1,t)}};nt.create=(s,t)=>new nt({type:s,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...$(t)});function _s(s){if(s instanceof Le){let t={};for(let e in s.shape){let r=s.shape[e];t[e]=Ae.create(_s(r))}return new Le({...s._def,shape:()=>t})}else return s instanceof nt?new nt({...s._def,type:_s(s.element)}):s instanceof Ae?Ae.create(_s(s.unwrap())):s instanceof Xe?Xe.create(_s(s.unwrap())):s instanceof Ye?Ye.create(s.items.map(t=>_s(t))):s}var Le=class s extends Y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),e=te.objectKeys(t);return this._cached={shape:t,keys:e}}_parse(t){if(this._getType(t)!==M.object){let c=this._getOrReturnCtx(t);return A(c,{code:L.invalid_type,expected:M.object,received:c.parsedType}),q}let{status:r,ctx:i}=this._processInputParams(t),{shape:n,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof je&&this._def.unknownKeys==="strip"))for(let c in i.data)o.includes(c)||a.push(c);let l=[];for(let c of o){let u=n[c],p=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new be(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof je){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(A(i,{code:L.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let p=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new be(i,p,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,f=await u.value;c.push({key:p,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>ve.mergeObjectSync(r,c)):ve.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return k.errToObj,new s({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(e,r)=>{var i,n,o,a;let l=(o=(n=(i=this._def).errorMap)===null||n===void 0?void 0:n.call(i,e,r).message)!==null&&o!==void 0?o:r.defaultError;return e.code==="unrecognized_keys"?{message:(a=k.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(t){return new s({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new s({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:z.ZodObject})}setKey(t,e){return this.augment({[t]:e})}catchall(t){return new s({...this._def,catchall:t})}pick(t){let e={};return te.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(e[r]=this.shape[r])}),new s({...this._def,shape:()=>e})}omit(t){let e={};return te.objectKeys(this.shape).forEach(r=>{t[r]||(e[r]=this.shape[r])}),new s({...this._def,shape:()=>e})}deepPartial(){return _s(this)}partial(t){let e={};return te.objectKeys(this.shape).forEach(r=>{let i=this.shape[r];t&&!t[r]?e[r]=i:e[r]=i.optional()}),new s({...this._def,shape:()=>e})}required(t){let e={};return te.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])e[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof Ae;)n=n._def.innerType;e[r]=n}}),new s({...this._def,shape:()=>e})}keyof(){return Ti(te.objectKeys(this.shape))}};Le.create=(s,t)=>new Le({shape:()=>s,unknownKeys:"strip",catchall:je.create(),typeName:z.ZodObject,...$(t)});Le.strictCreate=(s,t)=>new Le({shape:()=>s,unknownKeys:"strict",catchall:je.create(),typeName:z.ZodObject,...$(t)});Le.lazycreate=(s,t)=>new Le({shape:s,unknownKeys:"strip",catchall:je.create(),typeName:z.ZodObject,...$(t)});var Zt=class extends Y{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.options;function i(n){for(let a of n)if(a.result.status==="valid")return a.result;for(let a of n)if(a.result.status==="dirty")return e.common.issues.push(...a.ctx.common.issues),a.result;let o=n.map(a=>new Te(a.ctx.common.issues));return A(e,{code:L.invalid_union,unionErrors:o}),q}if(e.common.async)return Promise.all(r.map(async n=>{let o={...e,common:{...e.common,issues:[]},parent:null};return{result:await n._parseAsync({data:e.data,path:e.path,parent:o}),ctx:o}})).then(i);{let n,o=[];for(let l of r){let c={...e,common:{...e.common,issues:[]},parent:null},u=l._parseSync({data:e.data,path:e.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!n&&(n={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(n)return e.common.issues.push(...n.ctx.common.issues),n.result;let a=o.map(l=>new Te(l));return A(e,{code:L.invalid_union,unionErrors:a}),q}}get options(){return this._def.options}};Zt.create=(s,t)=>new Zt({options:s,typeName:z.ZodUnion,...$(t)});var st=s=>s instanceof Qt?st(s.schema):s instanceof Ve?st(s.innerType()):s instanceof es?[s.value]:s instanceof ts?s.options:s instanceof ss?te.objectValues(s.enum):s instanceof rs?st(s._def.innerType):s instanceof Xt?[void 0]:s instanceof Kt?[null]:s instanceof Ae?[void 0,...st(s.unwrap())]:s instanceof Xe?[null,...st(s.unwrap())]:s instanceof Ys||s instanceof is?st(s.unwrap()):s instanceof ns?st(s._def.innerType):[],Tr=class s extends Y{_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==M.object)return A(e,{code:L.invalid_type,expected:M.object,received:e.parsedType}),q;let r=this.discriminator,i=e.data[r],n=this.optionsMap.get(i);return n?e.common.async?n._parseAsync({data:e.data,path:e.path,parent:e}):n._parseSync({data:e.data,path:e.path,parent:e}):(A(e,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,e,r){let i=new Map;for(let n of e){let o=st(n.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,n)}}return new s({typeName:z.ZodDiscriminatedUnion,discriminator:t,options:e,optionsMap:i,...$(r)})}};function Sn(s,t){let e=pt(s),r=pt(t);if(s===t)return{valid:!0,data:s};if(e===M.object&&r===M.object){let i=te.objectKeys(t),n=te.objectKeys(s).filter(a=>i.indexOf(a)!==-1),o={...s,...t};for(let a of n){let l=Sn(s[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(e===M.array&&r===M.array){if(s.length!==t.length)return{valid:!1};let i=[];for(let n=0;n<s.length;n++){let o=s[n],a=t[n],l=Sn(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return e===M.date&&r===M.date&&+s==+t?{valid:!0,data:s}:{valid:!1}}var Jt=class extends Y{_parse(t){let{status:e,ctx:r}=this._processInputParams(t),i=(n,o)=>{if(yn(n)||yn(o))return q;let a=Sn(n.value,o.value);return a.valid?((_n(n)||_n(o))&&e.dirty(),{status:e.value,value:a.data}):(A(r,{code:L.invalid_intersection_types}),q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,o])=>i(n,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Jt.create=(s,t,e)=>new Jt({left:s,right:t,typeName:z.ZodIntersection,...$(e)});var Ye=class s extends Y{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.array)return A(r,{code:L.invalid_type,expected:M.array,received:r.parsedType}),q;if(r.data.length<this._def.items.length)return A(r,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),q;!this._def.rest&&r.data.length>this._def.items.length&&(A(r,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e.dirty());let n=[...r.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new be(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(n).then(o=>ve.mergeArray(e,o)):ve.mergeArray(e,n)}get items(){return this._def.items}rest(t){return new s({...this._def,rest:t})}};Ye.create=(s,t)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ye({items:s,typeName:z.ZodTuple,rest:null,...$(t)})};var Vr=class s extends Y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.object)return A(r,{code:L.invalid_type,expected:M.object,received:r.parsedType}),q;let i=[],n=this._def.keyType,o=this._def.valueType;for(let a in r.data)i.push({key:n._parse(new be(r,a,r.path,a)),value:o._parse(new be(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?ve.mergeObjectAsync(e,i):ve.mergeObjectSync(e,i)}get element(){return this._def.valueType}static create(t,e,r){return e instanceof Y?new s({keyType:t,valueType:e,typeName:z.ZodRecord,...$(r)}):new s({keyType:ft.create(),valueType:t,typeName:z.ZodRecord,...$(e)})}},Cs=class extends Y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.map)return A(r,{code:L.invalid_type,expected:M.map,received:r.parsedType}),q;let i=this._def.keyType,n=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new be(r,a,r.path,[c,"key"])),value:n._parse(new be(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return q;(c.status==="dirty"||u.status==="dirty")&&e.dirty(),a.set(c.value,u.value)}return{status:e.value,value:a}})}else{let a=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return q;(c.status==="dirty"||u.status==="dirty")&&e.dirty(),a.set(c.value,u.value)}return{status:e.value,value:a}}}};Cs.create=(s,t,e)=>new Cs({valueType:t,keyType:s,typeName:z.ZodMap,...$(e)});var Os=class s extends Y{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.set)return A(r,{code:L.invalid_type,expected:M.set,received:r.parsedType}),q;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(A(r,{code:L.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),e.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(A(r,{code:L.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),e.dirty());let n=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return q;u.status==="dirty"&&e.dirty(),c.add(u.value)}return{status:e.value,value:c}}let a=[...r.data.values()].map((l,c)=>n._parse(new be(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,e){return new s({...this._def,minSize:{value:t,message:k.toString(e)}})}max(t,e){return new s({...this._def,maxSize:{value:t,message:k.toString(e)}})}size(t,e){return this.min(t,e).max(t,e)}nonempty(t){return this.min(1,t)}};Os.create=(s,t)=>new Os({valueType:s,minSize:null,maxSize:null,typeName:z.ZodSet,...$(t)});var Nr=class s extends Y{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==M.function)return A(e,{code:L.invalid_type,expected:M.function,received:e.parsedType}),q;function r(a,l){return Er({data:a,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Lr(),vs].filter(c=>!!c),issueData:{code:L.invalid_arguments,argumentsError:l}})}function i(a,l){return Er({data:a,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Lr(),vs].filter(c=>!!c),issueData:{code:L.invalid_return_type,returnTypeError:l}})}let n={errorMap:e.common.contextualErrorMap},o=e.data;if(this._def.returns instanceof mt){let a=this;return Ce(async function(...l){let c=new Te([]),u=await a._def.args.parseAsync(l,n).catch(d=>{throw c.addIssue(r(l,d)),c}),p=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(p,n).catch(d=>{throw c.addIssue(i(p,d)),c})})}else{let a=this;return Ce(function(...l){let c=a._def.args.safeParse(l,n);if(!c.success)throw new Te([r(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(u,n);if(!p.success)throw new Te([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new s({...this._def,args:Ye.create(t).rest(rt.create())})}returns(t){return new s({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,e,r){return new s({args:t||Ye.create([]).rest(rt.create()),returns:e||rt.create(),typeName:z.ZodFunction,...$(r)})}},Qt=class extends Y{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};Qt.create=(s,t)=>new Qt({getter:s,typeName:z.ZodLazy,...$(t)});var es=class extends Y{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return A(e,{received:e.data,code:L.invalid_literal,expected:this._def.value}),q}return{status:"valid",value:t.data}}get value(){return this._def.value}};es.create=(s,t)=>new es({value:s,typeName:z.ZodLiteral,...$(t)});function Ti(s,t){return new ts({values:s,typeName:z.ZodEnum,...$(t)})}var ts=class s extends Y{constructor(){super(...arguments),zs.set(this,void 0)}_parse(t){if(typeof t.data!="string"){let e=this._getOrReturnCtx(t),r=this._def.values;return A(e,{expected:te.joinValues(r),received:e.parsedType,code:L.invalid_type}),q}if(Pr(this,zs,"f")||Ii(this,zs,new Set(this._def.values),"f"),!Pr(this,zs,"f").has(t.data)){let e=this._getOrReturnCtx(t),r=this._def.values;return A(e,{received:e.data,code:L.invalid_enum_value,options:r}),q}return Ce(t.data)}get options(){return this._def.values}get enum(){let t={};for(let e of this._def.values)t[e]=e;return t}get Values(){let t={};for(let e of this._def.values)t[e]=e;return t}get Enum(){let t={};for(let e of this._def.values)t[e]=e;return t}extract(t,e=this._def){return s.create(t,{...this._def,...e})}exclude(t,e=this._def){return s.create(this.options.filter(r=>!t.includes(r)),{...this._def,...e})}};zs=new WeakMap;ts.create=Ti;var ss=class extends Y{constructor(){super(...arguments),qs.set(this,void 0)}_parse(t){let e=te.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==M.string&&r.parsedType!==M.number){let i=te.objectValues(e);return A(r,{expected:te.joinValues(i),received:r.parsedType,code:L.invalid_type}),q}if(Pr(this,qs,"f")||Ii(this,qs,new Set(te.getValidEnumValues(this._def.values)),"f"),!Pr(this,qs,"f").has(t.data)){let i=te.objectValues(e);return A(r,{received:r.data,code:L.invalid_enum_value,options:i}),q}return Ce(t.data)}get enum(){return this._def.values}};qs=new WeakMap;ss.create=(s,t)=>new ss({values:s,typeName:z.ZodNativeEnum,...$(t)});var mt=class extends Y{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==M.promise&&e.common.async===!1)return A(e,{code:L.invalid_type,expected:M.promise,received:e.parsedType}),q;let r=e.parsedType===M.promise?e.data:Promise.resolve(e.data);return Ce(r.then(i=>this._def.type.parseAsync(i,{path:e.path,errorMap:e.common.contextualErrorMap})))}};mt.create=(s,t)=>new mt({type:s,typeName:z.ZodPromise,...$(t)});var Ve=class extends Y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:r}=this._processInputParams(t),i=this._def.effect||null,n={addIssue:o=>{A(r,o),o.fatal?e.abort():e.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),i.type==="preprocess"){let o=i.transform(r.data,n);if(r.common.async)return Promise.resolve(o).then(async a=>{if(e.value==="aborted")return q;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?q:l.status==="dirty"||e.value==="dirty"?Ss(l.value):l});{if(e.value==="aborted")return q;let a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?q:a.status==="dirty"||e.value==="dirty"?Ss(a.value):a}}if(i.type==="refinement"){let o=a=>{let l=i.refinement(a,n);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?q:(a.status==="dirty"&&e.dirty(),o(a.value),{status:e.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?q:(a.status==="dirty"&&e.dirty(),o(a.value).then(()=>({status:e.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Hs(o))return o;let a=i.transform(o.value,n);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Hs(o)?Promise.resolve(i.transform(o.value,n)).then(a=>({status:e.value,value:a})):o);te.assertNever(i)}};Ve.create=(s,t,e)=>new Ve({schema:s,typeName:z.ZodEffects,effect:t,...$(e)});Ve.createWithPreprocess=(s,t,e)=>new Ve({schema:t,effect:{type:"preprocess",transform:s},typeName:z.ZodEffects,...$(e)});var Ae=class extends Y{_parse(t){return this._getType(t)===M.undefined?Ce(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ae.create=(s,t)=>new Ae({innerType:s,typeName:z.ZodOptional,...$(t)});var Xe=class extends Y{_parse(t){return this._getType(t)===M.null?Ce(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Xe.create=(s,t)=>new Xe({innerType:s,typeName:z.ZodNullable,...$(t)});var rs=class extends Y{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return e.parsedType===M.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};rs.create=(s,t)=>new rs({innerType:s,typeName:z.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...$(t)});var ns=class extends Y{_parse(t){let{ctx:e}=this._processInputParams(t),r={...e,common:{...e.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return $s(i)?i.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Te(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Te(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ns.create=(s,t)=>new ns({innerType:s,typeName:z.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...$(t)});var Is=class extends Y{_parse(t){if(this._getType(t)!==M.nan){let r=this._getOrReturnCtx(t);return A(r,{code:L.invalid_type,expected:M.nan,received:r.parsedType}),q}return{status:"valid",value:t.data}}};Is.create=s=>new Is({typeName:z.ZodNaN,...$(s)});var cl=Symbol("zod_brand"),Ys=class extends Y{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}},Xs=class s extends Y{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?q:n.status==="dirty"?(e.dirty(),Ss(n.value)):this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?q:i.status==="dirty"?(e.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,e){return new s({in:t,out:e,typeName:z.ZodPipeline})}},is=class extends Y{_parse(t){let e=this._def.innerType._parse(t),r=i=>(Hs(i)&&(i.value=Object.freeze(i.value)),i);return $s(e)?e.then(i=>r(i)):r(e)}unwrap(){return this._def.innerType}};is.create=(s,t)=>new is({innerType:s,typeName:z.ZodReadonly,...$(t)});function Vi(s,t={},e){return s?dt.create().superRefine((r,i)=>{var n,o;if(!s(r)){let a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(o=(n=a.fatal)!==null&&n!==void 0?n:e)!==null&&o!==void 0?o:!0,c=typeof a=="string"?{message:a}:a;i.addIssue({code:"custom",...c,fatal:l})}}):dt.create()}var ul={object:Le.lazycreate},z;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(z||(z={}));var pl=(s,t={message:`Input not instance of ${s.name}`})=>Vi(e=>e instanceof s,t),Ni=ft.create,Di=qt.create,fl=Is.create,dl=Ht.create,Ai=$t.create,ml=Yt.create,hl=xs.create,gl=Xt.create,yl=Kt.create,_l=dt.create,Sl=rt.create,vl=je.create,xl=ws.create,wl=nt.create,Ks=Le.create,Cl=Le.strictCreate,Ol=Zt.create,Il=Tr.create,Ll=Jt.create,El=Ye.create,Pl=Vr.create,Tl=Cs.create,Vl=Os.create,Nl=Nr.create,Dl=Qt.create,Al=es.create,bl=ts.create,Ml=ss.create,Rl=mt.create,Ci=Ve.create,kl=Ae.create,Fl=Xe.create,Bl=Ve.createWithPreprocess,Wl=Xs.create,Ul=()=>Ni().optional(),Gl=()=>Di().optional(),jl=()=>Ai().optional(),zl={string:s=>ft.create({...s,coerce:!0}),number:s=>qt.create({...s,coerce:!0}),boolean:s=>$t.create({...s,coerce:!0}),bigint:s=>Ht.create({...s,coerce:!0}),date:s=>Yt.create({...s,coerce:!0})},ql=q,Zs=Object.freeze({__proto__:null,defaultErrorMap:vs,setErrorMap:Ha,getErrorMap:Lr,makeIssue:Er,EMPTY_PATH:$a,addIssueToContext:A,ParseStatus:ve,INVALID:q,DIRTY:Ss,OK:Ce,isAborted:yn,isDirty:_n,isValid:Hs,isAsync:$s,get util(){return te},get objectUtil(){return gn},ZodParsedType:M,getParsedType:pt,ZodType:Y,datetimeRegex:Pi,ZodString:ft,ZodNumber:qt,ZodBigInt:Ht,ZodBoolean:$t,ZodDate:Yt,ZodSymbol:xs,ZodUndefined:Xt,ZodNull:Kt,ZodAny:dt,ZodUnknown:rt,ZodNever:je,ZodVoid:ws,ZodArray:nt,ZodObject:Le,ZodUnion:Zt,ZodDiscriminatedUnion:Tr,ZodIntersection:Jt,ZodTuple:Ye,ZodRecord:Vr,ZodMap:Cs,ZodSet:Os,ZodFunction:Nr,ZodLazy:Qt,ZodLiteral:es,ZodEnum:ts,ZodNativeEnum:ss,ZodPromise:mt,ZodEffects:Ve,ZodTransformer:Ve,ZodOptional:Ae,ZodNullable:Xe,ZodDefault:rs,ZodCatch:ns,ZodNaN:Is,BRAND:cl,ZodBranded:Ys,ZodPipeline:Xs,ZodReadonly:is,custom:Vi,Schema:Y,ZodSchema:Y,late:ul,get ZodFirstPartyTypeKind(){return z},coerce:zl,any:_l,array:wl,bigint:dl,boolean:Ai,date:ml,discriminatedUnion:Il,effect:Ci,enum:bl,function:Nl,instanceof:pl,intersection:Ll,lazy:Dl,literal:Al,map:Tl,nan:fl,nativeEnum:Ml,never:vl,null:yl,nullable:Fl,number:Di,object:Ks,oboolean:jl,onumber:Gl,optional:kl,ostring:Ul,pipeline:Wl,preprocess:Bl,promise:Rl,record:Pl,set:Vl,strictObject:Cl,string:Ni,symbol:hl,transformer:Ci,tuple:El,undefined:gl,union:Ol,unknown:Sl,void:xl,NEVER:ql,ZodIssueCode:L,quotelessJson:qa,ZodError:Te});function bi(s){let t=s.runtimeEnvStrict??s.runtimeEnv??process.env;if(s.emptyStringAsUndefined??!1)for(let[N,T]of Object.entries(t))T===""&&delete t[N];if(!!s.skipValidation)return t;let i=typeof s.client=="object"?s.client:{},n=typeof s.server=="object"?s.server:{},o=typeof s.shared=="object"?s.shared:{},a=Ks(i),l=Ks(n),c=Ks(o),u=s.isServer??(typeof window>"u"||"Deno"in window),p=a.merge(c),f=l.merge(c).merge(a),d=u?f.safeParse(t):p.safeParse(t),m=s.onValidationError??(N=>{throw console.error("\u274C Invalid environment variables:",N.flatten().fieldErrors),new Error("Invalid environment variables")}),g=s.onInvalidAccess??(N=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(d.success===!1)return m(d.error);let _=N=>s.clientPrefix?!N.startsWith(s.clientPrefix)&&!(N in c.shape):!0,h=N=>u||!_(N),y=N=>N==="__esModule"||N==="$$typeof",S=(s.extends??[]).reduce((N,T)=>Object.assign(N,T),{}),v=Object.assign(d.data,S);return new Proxy(v,{get(N,T){if(typeof T=="string"&&!y(T))return h(T)?Reflect.get(N,T):g(T)}})}var Ls=(o=>(o.PROD_CN="prod-cn",o.PROD="prod",o.STAGING="staging",o.STAGING_CN="staging-cn",o.DEV="dev",o.LOCAL="local",o))(Ls||{}),Mi=({fallback:s="prod"})=>{let t=process.env.ENV;if(!t)return s;let e=t.toLowerCase().trim();return Object.values(Ls).includes(e)?e:s};var Hl=s=>{switch(s){case"local":return{CONNECT_API_BASE_URL:"http://localhost:3000/rest",CANVA_ENV_URL:"http://localhost:3000",CANVA_CLI_CLIENT_ID:"FAKE_CLIENT_ID",FLAVOR:"local"};case"dev":return{CONNECT_API_BASE_URL:"https://api.canva-dev.com/rest",CANVA_ENV_URL:"https://www.canva-dev.com",CANVA_CLI_CLIENT_ID:"OC-AZFEJKOjQYw3",FLAVOR:"dev"};case"staging-cn":return{CONNECT_API_BASE_URL:"https://api.canva-staging.cn/rest",CANVA_ENV_URL:"https://www.canva-staging.cn",CANVA_CLI_CLIENT_ID:"OC-AZNlOhtxI_Zb",FLAVOR:"staging-cn"};case"staging":return{CONNECT_API_BASE_URL:"https://api.canva-staging.com/rest",CANVA_ENV_URL:"https://www.canva-staging.com",CANVA_CLI_CLIENT_ID:"OC-AZH-EOTpT8Ib",FLAVOR:"staging"};case"prod-cn":return{CONNECT_API_BASE_URL:"https://api.canva.cn/rest",CANVA_ENV_URL:"https://www.canva.cn",CANVA_CLI_CLIENT_ID:"OC-AZN2AS1hKtVM",FLAVOR:"prod-cn"};case"prod":default:return{CONNECT_API_BASE_URL:"https://api.canva.com/rest",CANVA_ENV_URL:"https://www.canva.com",CANVA_CLI_CLIENT_ID:"OC-AZICxlGo2biD",FLAVOR:"prod"}}},Ri=({fallback:s="prod"})=>bi({server:{FLAVOR:Zs.enum(["prod","prod-cn","staging","staging-cn","dev","local"]).default(s),CONNECT_API_BASE_URL:Zs.string().url(),CANVA_ENV_URL:Zs.string().url(),CANVA_CLI_CLIENT_ID:Zs.enum(["OC-AZICxlGo2biD","OC-AZN2AS1hKtVM","OC-AZH-EOTpT8Ib","OC-AZNlOhtxI_Zb","OC-AZFEJKOjQYw3","FAKE_CLIENT_ID"]).default("OC-AZICxlGo2biD")},runtimeEnv:Hl(Mi({fallback:s})),emptyStringAsUndefined:!0});var Dr=class{constructor(t,e,r=!1){this.storageService=t;this.env=e;this.debug=r}generatePreviewResult=async t=>{let e=t;if(!e){let i=await this.getAppId();if(!i.success)return i;e=i.data}return{success:!0,data:this.constructPreviewUrl(e)}};async getAppId(){try{let t=await this.storageService.getAppIdFromEnvFile();if(!t.success)return t;let e=t.data;if(e==="YOUR_APP_ID_HERE"){let r="CANVA_APP_ID is set to the default placeholder value. Please update it in the .env file.";return this.debug&&console.error(r),{success:!1,code:"MISSING_FIELD",message:r}}return{success:!0,data:e}}catch(t){let e=`Unknown Error reading CANVA_APP_ID from .env file: ${t instanceof Error?t.message:String(t)}`;return this.debug&&console.error(e),{success:!1,code:"ENV_READ_ERROR",message:e}}}constructPreviewUrl(t){let e=this.encodeUiState({appId:t}),r=this.env.CANVA_ENV_URL,i=new URL("/login/",r),n=new URL("/design",r);return n.searchParams.append("create",""),n.searchParams.append("width","800"),n.searchParams.append("height","600"),n.searchParams.append("units","px"),n.searchParams.append("ui",e),i.searchParams.append("redirect",n.pathname+n.search),i.toString()}encodeUiState(t){let e={E:{"A?":"N",S:t.appId,g:!0}},r=JSON.stringify(e);return btoa(r).replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")}};var js=ys(require("crypto"),1),Pa=ys(Ea(),1);var fn=class{KEY_DERIVATION_ITERATIONS=1e5;KEY_LENGTH=32;async generateMachineId(){let t=await Pa.default.uuid();return`${t.os}::${t.hardware}`}deriveKeyFromMachineId(t,e){return js.default.pbkdf2Sync(t,e,this.KEY_DERIVATION_ITERATIONS,this.KEY_LENGTH,"sha256")}async encrypt(t){try{let e=await this.generateMachineId(),r=js.default.randomBytes(16),i=this.deriveKeyFromMachineId(e,r),n=js.default.randomBytes(12),o=js.default.createCipheriv("aes-256-gcm",i,n),a=o.update(t,"utf8","hex");a+=o.final("hex");let l={iv:n.toString("hex"),authTag:o.getAuthTag().toString("hex"),cipherText:a,salt:r.toString("hex")};return{success:!0,data:[l.iv,l.authTag,l.cipherText,l.salt].join(":")}}catch(e){return{success:!1,code:"ENCRYPTION_ERROR",message:`Encryption failed: ${e instanceof Error?e.message:String(e)}`}}}async decrypt(t){try{let e=await this.generateMachineId(),r=t.split(":");if(r.length!==4)return{success:!1,code:"INVALID_ENCRYPTED_DATA_FORMAT",message:"Invalid encrypted data format."};let[i,n,o,a]=r;if(!i||!n||!o||!a)return{success:!1,code:"INVALID_ENCRYPTED_DATA_FORMAT",message:"Missing required components for decryption."};let l=Buffer.from(i,"hex"),c=Buffer.from(n,"hex"),u=Buffer.from(a,"hex"),p=this.deriveKeyFromMachineId(e,u),f=js.default.createDecipheriv("aes-256-gcm",p,l);f.setAuthTag(c);let d=f.update(o,"hex","utf8");return d+=f.final("utf8"),{success:!0,data:d}}catch(e){return{success:!1,code:"DECRYPTION_ERROR",message:`Decryption failed: ${e instanceof Error?e.message:String(e)}`}}}};var ba=ys(require("fs/promises"),1),Ma=ys(require("os"),1),Ra=ys(require("path"),1),ka=ys(Aa(),1);var mn=class{constructor(t,e=ba.default,r=Ra.default,i=Ma.default.homedir(),n=!1){this.encryptionService=t;this.fileSystem=e;this.pathModule=r;this.debug=n;this.filePath=this.pathModule.join(i,".canva-cli","credentials")}tokenKey="tokenData";flavorKey="flavor";filePath;isNodeError(t){return t instanceof Error&&typeof t.code=="string"}async ensureDirectoryExists(t){try{await this.fileSystem.mkdir(t,{recursive:!0})}catch(e){let r=e instanceof Error?e.message:String(e);throw new Error(`Failed to create directory ${t}: ${r}`)}}async readJsonFromFile(){try{let t=await this.fileSystem.readFile(this.filePath,"utf-8");return JSON.parse(t)}catch(t){let e=t instanceof Error?t.message:String(t);throw new Error(`Failed to read the file at ${this.filePath}: ${e}`)}}async writeJsonToFile(t){try{await this.fileSystem.writeFile(this.filePath,JSON.stringify(t,null,2),"utf-8")}catch(e){let r=e instanceof Error?e.message:String(e);throw new Error(`Failed to write the file at ${this.filePath}: ${r}`)}try{await this.fileSystem.chmod(this.filePath,384)}catch(e){let r=e instanceof Error?e.message:String(e);throw new Error(`Failed to set permissions on the file at ${this.filePath}: ${r}`)}}async saveTokenData({tokenData:t,flavor:e}){let r=await this.encryptionService.encrypt(JSON.stringify(t));if(!r.success)return{success:!1,code:"ENCRYPTION_ERROR",message:`Failed to encrypt token data: ${r.message}`};let i={tokenData:r.data,flavor:e};try{let n=this.pathModule.dirname(this.filePath);return await this.ensureDirectoryExists(n),await this.writeJsonToFile(i),{success:!0,data:void 0}}catch(n){let o=n instanceof Error?n.message:String(n);return{success:!1,code:"API_FAILURE",message:`Failed to save token data to file: ${o}`}}}async getTokenData(){try{let t=await this.readJsonFromFile();if(t[this.tokenKey]){let e=await this.encryptionService.decrypt(t[this.tokenKey]);return e.success?{success:!0,data:JSON.parse(e.data)}:e}else return{success:!1,code:"NO_TOKEN",message:"Token data not found in credentials file."}}catch(t){let e=t instanceof Error?t.message:String(t);return{success:!1,code:"NO_TOKEN",message:`Failed to read the token file: ${e}`}}}async getFlavor(){try{let e=(await this.readJsonFromFile())[this.flavorKey];if(e&&typeof e=="string"&&Object.values(Ls).includes(e))return e}catch{return"prod"}return"prod"}async deleteToken(){try{if((await this.readJsonFromFile())[this.tokenKey])try{await this.fileSystem.access(this.filePath),await this.fileSystem.unlink(this.filePath)}catch(e){if(this.isNodeError(e)&&e.code==="ENOENT")return;let r=e instanceof Error?e.message:String(e);throw new Error(`Failed to delete the token data file: ${r}`)}else throw new Error("Token file does not exist or token data not found.")}catch(t){let e=t instanceof Error?t.message:String(t);throw new Error(`Failed to delete the token data file: ${e}`)}}async getAppIdFromEnvFile(){try{let t=this.pathModule.resolve(process.cwd(),".env");try{await this.fileSystem.access(t)}catch{let n="No .env file found, ensure you are in your intended app's directory.";return this.debug&&console.error(n),{success:!1,code:"FILE_NOT_FOUND",message:n}}let e=await this.fileSystem.readFile(t,"utf-8"),i=ka.parse(e).CANVA_APP_ID;if(!i){let n="CANVA_APP_ID not found in .env file";return this.debug&&console.error(n),{success:!1,code:"MISSING_FIELD",message:n}}return{success:!0,data:i}}catch(t){let e=`Unknown Error reading CANVA_APP_ID from .env file: ${t instanceof Error?t.message:String(t)}`;return this.debug&&console.error(e),{success:!1,code:"ENV_READ_ERROR",message:e}}}};var Ed=Ri({fallback:"prod"}),Pd=new fn,Td=new mn(Pd),Vd=new Dr(Td,Ed),Nd=()=>Vd.generatePreviewResult();0&&(module.exports={generatePreviewUrl});
|