@canva/cli 0.0.1-beta.15 → 0.0.1-beta.17
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/cli.js +450 -454
- package/lib/cjs/index.cjs +318 -322
- package/lib/esm/index.mjs +388 -0
- package/package.json +2 -2
- package/templates/base/eslint.config.mjs +2 -2
- package/templates/base/package.json +4 -4
- package/templates/base/scripts/start/app_runner.ts +1 -1
- package/templates/{dam/webpack.config.cjs → base/webpack.config.ts} +33 -43
- package/templates/common/conf/{eslint-general.mjs → eslint_general.mjs} +8 -0
- package/templates/dam/eslint.config.mjs +2 -2
- package/templates/dam/package.json +15 -14
- package/templates/dam/scripts/start/app_runner.ts +1 -1
- package/templates/{gen_ai/webpack.config.cjs → dam/webpack.config.ts} +33 -43
- package/templates/gen_ai/eslint.config.mjs +2 -2
- package/templates/gen_ai/package.json +18 -15
- package/templates/gen_ai/scripts/start/app_runner.ts +1 -1
- package/templates/{base/webpack.config.cjs → gen_ai/webpack.config.ts} +33 -43
- package/templates/hello_world/eslint.config.mjs +2 -2
- package/templates/hello_world/package.json +15 -14
- package/templates/hello_world/scripts/start/app_runner.ts +1 -1
- package/templates/hello_world/src/tests/__snapshots__/app.tests.tsx.snap +3 -3
- package/templates/hello_world/{webpack.config.cjs → webpack.config.ts} +33 -43
- package/lib/esm/index.esm +0 -392
- /package/templates/base/scripts/{copy-env.ts → copy_env.ts} +0 -0
- /package/templates/common/conf/{eslint-i18n.mjs → eslint_i18n.mjs} +0 -0
- /package/templates/dam/scripts/{copy-env.ts → copy_env.ts} +0 -0
- /package/templates/gen_ai/scripts/{copy-env.ts → copy_env.ts} +0 -0
- /package/templates/hello_world/scripts/{copy-env.ts → copy_env.ts} +0 -0
package/lib/esm/index.esm
DELETED
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 Canva Inc. All Rights Reserved.
|
|
2
|
-
var Ma=Object.create;var vi=Object.defineProperty;var Ra=Object.getOwnPropertyDescriptor;var ka=Object.getOwnPropertyNames;var Fa=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty;var R=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var ce=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports);var Wa=(s,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ka(t))!Ba.call(s,i)&&i!==e&&vi(s,i,{get:()=>t[i],enumerable:!(r=Ra(t,i))||r.enumerable});return s};var xi=(s,t,e)=>(e=s!=null?Ma(Fa(s)):{},Wa(t||!s||!s.__esModule?vi(e,"default",{value:s,enumerable:!0}):e,s));var Fi=ce((qd,jl)=>{jl.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 ue=ce(G=>{"use strict";var yt=R("os"),Ze=R("fs"),zl=R("path"),In=R("child_process").spawn,ql=R("child_process").exec,Ps=R("child_process").execSync,Ln=R("util"),cs=process.platform,En=cs==="linux"||cs==="android",Gi=cs==="darwin",Pn=cs==="win32",ji=cs==="freebsd",zi=cs==="openbsd",qi=cs==="netbsd",Sn=0,as="",qe="",gt=null,_t=null,Hi=process.env.WINDIR||"C:\\Windows",he,Es="",Zs=[],Tn=!1,Bi="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",xn="--###START###--",Wi="--ERROR--",Dr="--###ENDCMD###--",wn="--##ID##--",Js={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 Hl(s){let t=parseInt(s,10);return isNaN(t)&&(t=0),t}function $l(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 Cn=new String().replace,On=new String().toLowerCase,Yi=new String().toString,Xi=new String().substr,Yl=new String().trim,Xl=new String().startsWith,Ki=Math.min;function Kl(s){return s&&{}.toString.call(s)==="[object Function]"}function Zl(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 Jl(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 Ql(){return Sn===0&&(Sn=yt.cpus().length),Sn}function ls(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 ec(s,t){return t=t||16,s.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],t))})}function tc(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 sc(s,t){t=t||"",s=s.toUpperCase();let e=0,r=0,i=tc(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 rc(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=sc(o,i)}return e}function nc(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 ic(s,t,e){for(let r=0;r<s.length;r++)if(s[r][t]===e)return r;return-1}function Zi(){if(yt.type()==="Windows_NT"&&!as&&(as=Hi+"\\system32\\wbem\\wmic.exe",!Ze.existsSync(as)))try{let s=Ps("WHERE WMIC",Js).toString().split(`\r
|
|
3
|
-
`);s&&s.length?as=s[0]:as="wmic"}catch{as="wmic"}return as}function oc(s){return new Promise(t=>{process.nextTick(()=>{try{Ji(Zi()+" "+s).then(e=>{t(e,"")})}catch(e){t("",e)}})})}function ac(){return Pn?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"}function vn(s){let t="",e,r="";if(s.indexOf(xn)>=0){e=s.split(xn);let n=e[1].split(wn);t=n[0],n.length>1&&(s=n.slice(1).join(wn))}s.indexOf(Dr)>=0&&(e=s.split(Dr),r=e[0]);let i=-1;for(let n=0;n<Zs.length;n++)Zs[n].id===t&&(i=n,Zs[n].callback(r));i>=0&&Zs.splice(i,1)}function lc(){he||(he=In("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"})}),he&&he.pid&&(Tn=!0,he.stdout.on("data",function(s){Es=Es+s.toString("utf8"),s.indexOf(Dr)>=0&&(vn(Es),Es="")}),he.stderr.on("data",function(){vn(Es+Wi)}),he.on("error",function(){vn(Es+Wi)}),he.on("close",function(){he&&he.kill()})))}function cc(){try{he&&(he.stdin.write("exit"+yt.EOL),he.stdin.end(),Tn=!1)}catch{he&&he.kill()}he=null}function Ji(s){if(Tn){let t=Math.random().toString(36).substring(2,12);return new Promise(e=>{process.nextTick(()=>{function r(i){e(i)}Zs.push({id:t,cmd:s,callback:r,start:new Date});try{he&&he.pid&&he.stdin.write(Bi+"echo "+xn+t+wn+"; "+yt.EOL+s+yt.EOL+"echo "+Dr+yt.EOL)}catch{e("")}})})}else{let t="";return new Promise(e=>{process.nextTick(()=>{try{let r=In("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+yt.EOL),r.stdin.write("exit"+yt.EOL),r.stdin.end()}catch{r.kill(),e(t)}}else e(t)}catch{e(t)}})})}}function uc(s,t,e){let r="";return e=e||{},new Promise(i=>{process.nextTick(()=>{try{let n=In(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 pc(){if(Pn){if(!qe)try{let e=Ps("chcp",Js).toString().split(`\r
|
|
4
|
-
`)[0].split(":");qe=e.length>1?e[1].replace(".","").trim():""}catch{qe="437"}return qe}if(En||Gi||ji||zi||qi){if(!qe)try{let e=Ps("echo $LANG",Ln.execOptsLinux).toString().split(`\r
|
|
5
|
-
`)[0].split(".");qe=e.length>1?e[1].trim():"",qe||(qe="UTF-8")}catch{qe="UTF-8"}return qe}}function fc(){if(gt!==null)return gt;if(gt=!1,Pn)try{let s=Ps("WHERE smartctl 2>nul",Js).toString().split(`\r
|
|
6
|
-
`);s&&s.length?gt=s[0].indexOf(":\\")>=0:gt=!1}catch{gt=!1}if(En||Gi||ji||zi||qi)try{gt=Ps("which smartctl 2>/dev/null",$i).toString().split(`\r
|
|
7
|
-
`).length>0}catch{Ln.noop()}return gt}function dc(){let s=["BCM2708","BCM2709","BCM2710","BCM2711","BCM2712","BCM2835","BCM2836","BCM2837","BCM2837B0"],t=[];if(_t!==null)t=_t;else try{t=Ze.readFileSync("/proc/cpuinfo",{encoding:"utf8"}).toString().split(`
|
|
8
|
-
`),_t=t}catch{return!1}let e=ls(t,"hardware");return e&&s.indexOf(e)>-1}function mc(){let s=[];try{s=Ze.readFileSync("/etc/os-release",{encoding:"utf8"}).toString().split(`
|
|
9
|
-
`)}catch{return!1}let t=ls(s,"id","=");return t&&t.indexOf("raspbian")>-1}function hc(s,t,e){e||(e=t,t=Js);let r="chcp 65001 > nul && cmd /C "+s+" && chcp "+qe+" > nul";ql(r,t,function(i,n){e(i,n)})}function gc(){let s=Ze.existsSync("/Library/Developer/CommandLineTools/usr/bin/"),t=Ze.existsSync("/Applications/Xcode.app/Contents/Developer/Tools"),e=Ze.existsSync("/Library/Developer/Xcode/");return s||e||t}function yc(){let s=process.hrtime();return!Array.isArray(s)||s.length!==2?0:+s[0]*1e9+ +s[1]}function _c(s,t){t=t||"";let e=[];return s.forEach(r=>{r.startsWith(t)&&e.indexOf(r)===-1&&e.push(r)}),e.length}function Sc(s,t){t=t||"";let e=[];return s.forEach(r=>{r.startsWith(t)&&e.push(r)}),e.length}function vc(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 xc(){let s="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",t=!0,e="";e.__proto__.replace=Cn,e.__proto__.toLowerCase=On,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=Cn;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=On;let p=l?l[c]:"",f=u.toLowerCase();t=t&&f[0]===p&&f[0]&&!f[1]}}return!t}function wc(s){return("00000000"+parseInt(s,16).toString(2)).substr(-8)}function Cc(s){let t=Ze.lstatSync,e=Ze.readdirSync,r=zl.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 Ze.existsSync(s)?l(s):[]}function Qi(s){_t===null&&(_t=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=ls(s,"revision",":",!0),o=ls(s,"model:",":",!0),a=ls(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"+ls(s,"revision",":",!0).toLowerCase()).substr(-8),u=parseInt(wc(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 Oc(){let s=null;if(_t!==null)s=_t;else try{s=Ze.readFileSync("/proc/cpuinfo",{encoding:"utf8"}).toString().split(`
|
|
11
|
-
`),_t=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 Ic(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 Lc(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 Ec(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 Pc(){let s="";if(En)try{s=Ps("uname -v",Ln.execOptsLinux).toString()}catch{s=""}return s}function Tc(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 Vc(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 Nc(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 Dc(){}G.toInt=Hl;G.splitByNumber=$l;G.execOptsWin=Js;G.execOptsLinux=$i;G.getCodepage=pc;G.execWin=hc;G.isFunction=Kl;G.unique=Zl;G.sortByKey=Jl;G.cores=Ql;G.getValue=ls;G.decodeEscapeSequence=ec;G.parseDateTime=rc;G.parseHead=nc;G.findObjectByKey=ic;G.getWmic=Zi;G.wmic=oc;G.darwinXcodeExists=gc;G.getVboxmanage=ac;G.powerShell=Ji;G.powerShellStart=lc;G.powerShellRelease=cc;G.execSafe=uc;G.nanoSeconds=yc;G.countUniqueLines=_c;G.countLines=Sc;G.noop=Dc;G.isRaspberry=dc;G.isRaspbian=mc;G.sanitizeShellString=vc;G.isPrototypePolluted=xc;G.decodePiCpuinfo=Qi;G.getRpiGpu=Oc;G.promiseAll=Ic;G.promisify=Lc;G.promisifySave=Ec;G.smartMonToolsInstalled=fc;G.linuxVersion=Pc;G.plistParser=Tc;G.plistReader=Vc;G.stringReplace=Cn;G.stringToLower=On;G.stringToString=Yi;G.stringSubstr=Xi;G.stringTrim=Yl;G.stringStartWith=Xl;G.mathMin=Ki;G.WINDIR=Hi;G.getFilesInPath=Cc;G.semverCompare=Nc});var eo=ce(sr=>{"use strict";var br=R("fs"),us=R("os"),w=ue(),Vs=R("child_process").exec,Ts=R("child_process").execSync,Ar=w.promisify(R("child_process").exec),St=process.platform,Mr=St==="linux"||St==="android",Rr=St==="darwin",kr=St==="win32",Qs=St==="freebsd",er=St==="openbsd",tr=St==="netbsd",Fr=St==="sunos";function Ac(s){return new Promise(t=>{process.nextTick(()=>{let e={manufacturer:"",model:"Computer",version:"",serial:"-",uuid:"-",sku:"-",virtual:!1};if((Mr||Qs||er||tr)&&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&&(us.release().toLowerCase().indexOf("microsoft")>=0||us.release().toLowerCase().endsWith("wsl2"))){let a=parseFloat(us.release().toLowerCase());e.virtual=!0,e.manufacturer="Microsoft",e.model="WSL",e.version=a<4.19?"1":"2"}if((Qs||er||tr)&&!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()}(br.existsSync("/.dockerenv")||br.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===""?br.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))}),Rr&&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)}),Fr&&(s&&s(e),t(e)),kr)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)}})})}sr.system=Ac;function ne(s){let t=s.toLowerCase();return t.indexOf("o.e.m.")===-1&&t.indexOf("default string")===-1&&t!=="default"&&s||""}function bc(s){return new Promise(t=>{process.nextTick(()=>{let e={vendor:"",version:"",releaseDate:"",revision:""},r="";if((Mr||Qs||er||tr)&&(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)})),Rr&&(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)})),Fr&&(e.vendor="Sun Microsystems",s&&s(e),t(e)),kr)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=ne(w.getValue(o,"serialnumber",":"))}s&&s(e),t(e)})}catch{s&&s(e),t(e)}})})}sr.bios=bc;function Mc(s){return new Promise(t=>{process.nextTick(()=>{let e={manufacturer:"",model:"",version:"",serial:"-",assetTag:"-",memMax:null,memSlots:null},r="";if(Mr||Qs||er||tr){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(Ar(r)),i.push(Ar("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=ne(w.getValue(o,"Manufacturer")),e.model=ne(w.getValue(o,"Product Name")),e.version=ne(w.getValue(o,"Version")),e.serial=ne(w.getValue(o,"Serial Number")),e.assetTag=ne(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=ne(e.manufacturer?e.manufacturer:w.getValue(o,"board_vendor")),e.model=ne(e.model?e.model:w.getValue(o,"board_name")),e.version=ne(e.version?e.version:w.getValue(o,"board_version")),e.serial=ne(e.serial?e.serial:w.getValue(o,"board_serial")),e.assetTag=ne(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=br.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=us.totalmem(),e.memSlots=0}s&&s(e),t(e)})}if(Rr){let i=[];i.push(Ar("ioreg -c IOPlatformExpertDevice -d 2")),i.push(Ar("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,us.arch()==="arm64"&&(e.memSlots=0,e.memMax=us.totalmem()),s&&s(e),t(e)})}if(Fr&&(s&&s(e),t(e)),kr)try{let i=[],n=parseInt(us.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=ne(w.getValue(l,"manufacturer",":")),e.model=ne(w.getValue(l,"model",":")),e.model||(e.model=ne(w.getValue(l,"product",":"))),e.version=ne(w.getValue(l,"version",":")),e.serial=ne(w.getValue(l,"serialnumber",":")),e.assetTag=ne(w.getValue(l,"partnumber",":")),e.assetTag||(e.assetTag=ne(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)}})})}sr.baseboard=Mc;function Rc(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 kc(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((Mr||Qs||er||tr)&&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=ne(w.getValue(a,"chassis_vendor"));let l=parseInt(w.getValue(a,"chassis_type").replace(/\D/g,""));r.type=ne(l&&!isNaN(l)&&l<t.length?t[l-1]:""),r.version=ne(w.getValue(a,"chassis_version")),r.serial=ne(w.getValue(a,"chassis_serial")),r.assetTag=ne(w.getValue(a,"chassis_asset_tag")),s&&s(r),e(r)}),Rr&&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=Rc(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)}),Fr&&(s&&s(r),e(r)),kr)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=ne(w.getValue(o,"manufacturer",":")),r.model=ne(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=ne(w.getValue(o,"version",":")),r.serial=ne(w.getValue(o,"serialnumber",":")),r.assetTag=ne(w.getValue(o,"partnumber",":")),r.assetTag||(r.assetTag=ne(w.getValue(o,"SMBIOSAssetTag",":"))),r.sku=ne(w.getValue(o,"sku",":"))}s&&s(r),e(r)})}catch{s&&s(r),e(r)}})})}sr.chassis=kc});var so=ce(Ns=>{"use strict";var Je=R("os"),Re=R("fs"),B=ue(),j=R("child_process").exec,nr=R("child_process").execSync,$e=process.platform,ir=$e==="linux"||$e==="android",He=$e==="darwin",ke=$e==="win32",Vn=$e==="freebsd",Nn=$e==="openbsd",Dn=$e==="netbsd",Fc=$e==="sunos";function Bc(){let s=new Date().toString().split(" ");return{current:Date.now(),uptime:Je.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=Bc;function rr(s){s=s||"",s=s.toLowerCase();let t=$e;return ke?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":ir&&s&&(t=s.toLowerCase().trim().replace(/\s+/g,"-")),t}function Wc(){let s=Je.hostname;if(ir||He)try{let t=nr("hostnamectl --json short 2>/dev/null",B.execOptsLinux);s=JSON.parse(t.toString()).StaticHostname}catch{try{s=nr("hostname -f 2>/dev/null",B.execOptsLinux).toString().split(Je.EOL)[0]}catch{B.noop()}}if(Vn||Nn||Dn)try{s=nr("hostname 2>/dev/null").toString().split(Je.EOL)[0]}catch{B.noop()}if(ke)try{s=nr("echo %COMPUTERNAME%.%USERDNSDOMAIN%",B.execOptsWin).toString().replace(".%USERDNSDOMAIN%","").split(Je.EOL)[0]}catch{B.noop()}return s}function Uc(s){return new Promise(t=>{process.nextTick(()=>{let e={platform:$e==="win32"?"Windows":$e,distro:"unknown",release:"unknown",codename:"",kernel:Je.release(),arch:Je.arch(),hostname:Je.hostname(),fqdn:Wc(),codepage:"",logofile:"",serial:"",build:"",servicepack:"",uefi:!1};if(ir&&j("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=rr(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=B.getCodepage(),e.build=(n.BUILD_ID||"").replace(/"/g,"").trim(),Gc().then(u=>{e.uefi=u,to().then(p=>{e.serial=p.os,s&&s(e),t(e)})})}),(Vn||Nn||Dn)&&j("sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml",function(r,i){let n=i.toString().split(`
|
|
49
|
-
`),o=B.getValue(n,"kern.ostype"),a=rr(o),l=B.getValue(n,"kern.osrelease").split("-")[0],c=B.getValue(n,"kern.uuid"),u=B.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=B.getCodepage(),e.uefi=f||null,s&&s(e),t(e)}),He&&j("sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid",function(r,i){let n=i.toString().split(`
|
|
50
|
-
`);e.serial=B.getValue(n,"kern.uuid"),e.distro=B.getValue(n,"ProductName"),e.release=(B.getValue(n,"ProductVersion",":",!0,!0)+" "+B.getValue(n,"ProductVersionExtra",":",!0,!0)).trim(),e.build=B.getValue(n,"BuildVersion"),e.logofile=rr(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=B.getCodepage(),s&&s(e),t(e)}),Fc&&(e.release=e.kernel,j("uname -o",function(r,i){let n=i.toString().split(`
|
|
51
|
-
`);e.distro=n[0],e.logofile=rr(e.distro),s&&s(e),t(e)})),ke){e.logofile=rr(),e.release=e.kernel;try{let r=[];r.push(B.powerShell("Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl")),r.push(B.powerShell("(Get-CimInstance Win32_ComputerSystem).HypervisorPresent")),r.push(B.powerShell("Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession")),B.promiseAll(r).then(i=>{let n=i.results[0]?i.results[0].toString().split(`\r
|
|
52
|
-
`):[""];e.distro=B.getValue(n,"Caption",":").trim(),e.serial=B.getValue(n,"SerialNumber",":").trim(),e.build=B.getValue(n,"BuildNumber",":").trim(),e.servicepack=B.getValue(n,"ServicePackMajorVersion",":").trim()+"."+B.getValue(n,"ServicePackMinorVersion",":").trim(),e.codepage=B.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,jc().then(l=>{e.uefi=l,s&&s(e),t(e)})})}catch{s&&s(e),t(e)}}})})}Ns.osInfo=Uc;function Gc(){return new Promise(s=>{process.nextTick(()=>{Re.stat("/sys/firmware/efi",function(t){if(t)j('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 jc(){return new Promise(s=>{process.nextTick(()=>{try{j('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"',B.execOptsWin,function(t,e){if(t)j("echo %firmware_type%",B.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 zc(s,t){let e={kernel:Je.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(B.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,j("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")&&j("npm -v",function(c,u){c||(n.versions.npm=u.toString().split(`
|
|
56
|
-
`)[0]),a()}),{}.hasOwnProperty.call(n.versions,"pm2")&&(l="pm2",ke&&(l+=".cmd"),j(`${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")&&j("yarn --version",function(c,u){c||(n.versions.yarn=u.toString().split(`
|
|
58
|
-
`)[0]),a()}),{}.hasOwnProperty.call(n.versions,"gulp")&&(l="gulp",ke&&(l+=".cmd"),j(`${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",ke&&(l+=".cmd"),j(`${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",ke&&(l+=".cmd"),j(`${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(He){let c=Re.existsSync("/usr/local/Cellar/git")||Re.existsSync("/opt/homebrew/bin/git");B.darwinXcodeExists()||c?j("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 j("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")&&j("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")&&j("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")&&j("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")&&j("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")&&j("redis-server --version",function(c,u){if(!c){let f=(u.toString().split(`
|
|
68
|
-
`)[0]||"").split(" ");n.versions.redis=B.getValue(f,"v","=",!0)}a()}),{}.hasOwnProperty.call(n.versions,"docker")&&j("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")&&j("postconf -d | grep mail_version",function(c,u){if(!c){let p=u.toString().split(`
|
|
70
|
-
`)||[];n.versions.postfix=B.getValue(p,"mail_version","=",!0)}a()}),{}.hasOwnProperty.call(n.versions,"mongodb")&&j("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")&&(ir?j("locate bin/postgres",function(c,u){if(c)j("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?j(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()}}):ke?B.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=B.getValue(f,"caption",":",!0).toLowerCase();if(d.indexOf("postgresql")>-1){let m=d.split(" server ");m.length>1&&(n.versions.postgresql=m[1])}}}),a()}):j("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")&&j("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(He)try{let u=nr("sw_vers").toString().split(`
|
|
78
|
-
`),p=B.getValue(u,"ProductVersion",":"),f=Re.existsSync("/usr/local/Cellar/python"),d=Re.existsSync("/opt/homebrew/bin/python");B.darwinXcodeExists()&&B.semverCompare("12.0.1",p)<0||f||d?j(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 j("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(He){let c=Re.existsSync("/usr/local/Cellar/python3")||Re.existsSync("/opt/homebrew/bin/python3");B.darwinXcodeExists()||c?j("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 j("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(He){let c=Re.existsSync("/usr/local/Cellar/pip")||Re.existsSync("/opt/homebrew/bin/pip");B.darwinXcodeExists()||c?j("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 j("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(He){let c=Re.existsSync("/usr/local/Cellar/pip3")||Re.existsSync("/opt/homebrew/bin/pip3");B.darwinXcodeExists()||c?j("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 j("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")&&(He?j("/usr/libexec/java_home -V 2>&1",function(c,u){!c&&u.toString().toLowerCase().indexOf("no java runtime")===-1?j("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()}):j("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")&&(He&&B.darwinXcodeExists()||!He?j("gcc -dumpversion",function(c,u){c||(n.versions.gcc=u.toString().split(`
|
|
89
|
-
`)[0].trim()||""),n.versions.gcc.indexOf(".")>-1?a():j("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")&&j(B.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")&&j("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")&&j("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")&&j("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")&&(ke?B.powerShell("$PSVersionTable").then(c=>{let u=c.toString().split(`
|
|
95
|
-
`).map(p=>p.replace(/ +/g," ").replace(/ +/g,":"));n.versions.powershell=B.getValue(u,"psversion"),a()}):a()),{}.hasOwnProperty.call(n.versions,"dotnet")&&(ke?B.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=zc;function qc(s){return new Promise(t=>{process.nextTick(()=>{if(ke)t("cmd");else{let e="";j("echo $SHELL",function(r,i){r||(e=i.toString().split(`
|
|
97
|
-
`)[0]),s&&s(e),t(e)})}})})}Ns.shell=qc;function Hc(){let s=[];try{let t=Je.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:Hc()},r;if(He&&j("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{B.noop()}s&&s(e),t(e)}),ir&&j(`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=B.getValue(a,"os").toLowerCase(),e.hardware=B.getValue(a,"hardware").toLowerCase(),!e.hardware){let l=Re.readFileSync("/proc/cpuinfo",{encoding:"utf8"}).toString().split(`
|
|
101
|
-
`),c=B.getValue(l,"serial");e.hardware=c||""}s&&s(e),t(e)}),(Vn||Nn||Dn)&&j("sysctl -i kern.hostid kern.hostuuid",function(i,n){let o=n.toString().split(`
|
|
102
|
-
`);e.os=B.getValue(o,"kern.hostid",":").toLowerCase(),e.hardware=B.getValue(o,"kern.hostuuid",":").toLowerCase(),e.os.indexOf("unknown")>=0&&(e.os=""),e.hardware.indexOf("unknown")>=0&&(e.hardware=""),s&&s(e),t(e)}),ke){let i="%windir%\\System32";process.arch==="ia32"&&Object.prototype.hasOwnProperty.call(process.env,"PROCESSOR_ARCHITEW6432")&&(i="%windir%\\sysnative\\cmd.exe /c %windir%\\System32"),B.powerShell("Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl").then(n=>{let o=n.split(`\r
|
|
103
|
-
`);e.hardware=B.getValue(o,"uuid",":").toLowerCase(),j(`${i}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`,B.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=ce(xt=>{"use strict";var Ye=R("os"),Ie=R("child_process").exec,Fn=R("child_process").execSync,Wr=R("fs"),P=ue(),vt=process.platform,or=vt==="linux"||vt==="android",Ur=vt==="darwin",Gr=vt==="win32",jr=vt==="freebsd",zr=vt==="openbsd",qr=vt==="netbsd",Hr=vt==="sunos",Ds=0,Z={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=[],An=0,bn={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 $c(s){let t="";for(let e in no)no[e].split(" ").forEach(i=>{s.indexOf(i)>=0&&(t=e)});return t}function Rn(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 Br(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=Rn(s.brand);let t=s.brand.split(" ");return t.shift(),s.brand=t.join(" "),s}function Mn(s){let t="0";for(let e in bn)if({}.hasOwnProperty.call(bn,e)){let r=e.split("|"),i=0;r.forEach(n=>{s.indexOf(n)>-1&&i++}),i===r.length&&(t=bn[e])}return parseFloat(t)}function Yc(){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,Ur&&Ie("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=Br(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(Ye.arch()==="arm64"){e.socket="SOC";try{let m=Fn("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)})}),or){let i="",n=[];Ye.cpus()[0]&&Ye.cpus()[0].model&&(i=Ye.cpus()[0].model),Ie('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=Mn(e.brand)),e.speed===0){let g=kn();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=Br(e),e.vendor=Rn(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=Wr.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=[];Ie('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(jr||zr||qr){let i="",n=[];Ye.cpus()[0]&&Ye.cpus()[0].model&&(i=Ye.cpus()[0].model),Ie("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=Mn(e.brand)),e.speed===0){let d=kn();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=Br(e),e.vendor=Rn(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(Hr&&s(e),Gr)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=Br(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=Mn(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=$c(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 Xc(s){return new Promise(t=>{process.nextTick(()=>{Yc().then(e=>{s&&s(e),t(e)})})})}xt.cpu=Xc;function kn(){let s=Ye.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 Kc(s){return new Promise(t=>{process.nextTick(()=>{let e=kn();if(e.avg===0&&Ds!==0){let r=parseFloat(Ds);e={min:r,max:r,avg:r,cores:[]}}s&&s(e),t(e)})})}xt.cpuCurrentSpeed=Kc;function Zc(s){return new Promise(t=>{process.nextTick(()=>{let e={main:null,cores:[],max:null,socket:[],chipset:null};if(or){try{let n=Fn('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{Ie(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}Ie("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}}Wr.stat("/sys/class/thermal/thermal_zone0/temp",function(p){p===null?Wr.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)}):Ie("/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((jr||zr||qr)&&Ie("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)}),Ur){let r=null;try{r=R("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(Hr&&(s&&s(e),t(e)),Gr)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)}})})}xt.cpuTemperature=Zc;function io(s){return new Promise(t=>{process.nextTick(()=>{let e="";if(Gr)try{Ie('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(or)try{Ie("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)):Wr.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)}(jr||zr||qr)&&Ie("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)}),Ur&&Ie("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)}),Hr&&(s&&s(e),t(e))})})}xt.cpuFlags=io;function oo(s){return new Promise(t=>{process.nextTick(()=>{let e={l1d:null,l1i:null,l2:null,l3:null};if(or)try{Ie("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((jr||zr||qr)&&Ie("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)}),Ur&&Ie("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)}),Hr&&(s&&s(e),t(e)),Gr)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}xt.cpuCache=oo;function Jc(){return new Promise(s=>{process.nextTick(()=>{let t=Ye.loadavg().map(function(n){return n/P.cores()}),e=parseFloat(Math.max.apply(Math,t).toFixed(2)),r={};if(Date.now()-Z.ms>=200){Z.ms=Date.now();let n=Ye.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(An=n&&n.length?n.length:0,or)try{let h=Fn("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<An;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,Q=C&&C[h]&&C[h].idle?C[h].idle:0,E=C&&C[h]&&C[h].irq?C[h].irq:0,J=C&&C[h]&&C[h].steal?C[h].steal:0,W=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-Q,C[h].loadIrq=C[h].irq-E,C[h].loadSteal=C[h].steal-J,C[h].loadGuest=C[h].guest-W,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-Z.tick;r={avgLoad:e,currentLoad:(g-Z.load)/_*100,currentLoadUser:(o-Z.user)/_*100,currentLoadSystem:(a-Z.system)/_*100,currentLoadNice:(l-Z.nice)/_*100,currentLoadIdle:(u-Z.idle)/_*100,currentLoadIrq:(c-Z.irq)/_*100,currentLoadSteal:(p-Z.steal)/_*100,currentLoadGuest:(f-Z.guest)/_*100,rawCurrentLoad:g-Z.load,rawCurrentLoadUser:o-Z.user,rawCurrentLoadSystem:a-Z.system,rawCurrentLoadNice:l-Z.nice,rawCurrentLoadIdle:u-Z.idle,rawCurrentLoadIrq:c-Z.irq,rawCurrentLoadSteal:p-Z.steal,rawCurrentLoadGuest:f-Z.guest,cpus:d},Z={user:o,nice:l,system:a,idle:u,irq:c,steal:p,guest:f,tick:m,load:g,ms:Z.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<An;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:Z.currentLoad,currentLoadUser:Z.currentLoadUser,currentLoadSystem:Z.currentLoadSystem,currentLoadNice:Z.currentLoadNice,currentLoadIdle:Z.currentLoadIdle,currentLoadIrq:Z.currentLoadIrq,currentLoadSteal:Z.currentLoadSteal,currentLoadGuest:Z.currentLoadGuest,rawCurrentLoad:Z.rawCurrentLoad,rawCurrentLoadUser:Z.rawCurrentLoadUser,rawCurrentLoadSystem:Z.rawCurrentLoadSystem,rawCurrentLoadNice:Z.rawCurrentLoadNice,rawCurrentLoadIdle:Z.rawCurrentLoadIdle,rawCurrentLoadIrq:Z.rawCurrentLoadIrq,rawCurrentLoadSteal:Z.rawCurrentLoadSteal,rawCurrentLoadGuest:Z.rawCurrentLoadGuest,cpus:n}}s(r)})})}function Qc(s){return new Promise(t=>{process.nextTick(()=>{Jc().then(e=>{s&&s(e),t(e)})})})}xt.currentLoad=Qc;function eu(){return new Promise(s=>{process.nextTick(()=>{let t=Ye.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 tu(s){return new Promise(t=>{process.nextTick(()=>{eu().then(e=>{s&&s(e),t(e)})})})}xt.fullLoad=tu});var So=ce(Bn=>{"use strict";var Qe=R("os"),ar=R("child_process").exec,$r=R("child_process").execSync,V=ue(),su=R("fs"),wt=process.platform,po=wt==="linux"||wt==="android",fo=wt==="darwin",mo=wt==="win32",ho=wt==="freebsd",go=wt==="openbsd",yo=wt==="netbsd",_o=wt==="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 ru(s){return new Promise(t=>{process.nextTick(()=>{let e={total:Qe.totalmem(),free:Qe.freemem(),used:Qe.totalmem()-Qe.freemem(),active:Qe.totalmem()-Qe.freemem(),available:Qe.freemem(),buffers:0,cached:0,slab:0,buffcache:0,swaptotal:0,swapused:0,swapfree:0,writeback:null,dirty:null};if(po)try{su.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:Qe.totalmem(),e.free=parseInt(V.getValue(n,"memfree"),10),e.free=e.free?e.free*1024:Qe.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{ar("/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($r("sysctl -n vm.pagesize").toString())||r}catch{V.noop()}try{ar('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}ar("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)}}})})}Bn.mem=ru;function nu(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)&&ar('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:Qe.totalmem(),bank:"",type:"",ecc:null,clockSpeed:0,formFactor:"",partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null});try{let a=$r("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=$r("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=$r("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&&ar("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)}}})})}Bn.memLayout=nu});var wo=ce((Zd,xo)=>{"use strict";var vo=R("child_process").exec,As=R("fs"),$=ue(),Ct=process.platform,iu=Ct==="linux"||Ct==="android",ou=Ct==="darwin",au=Ct==="win32",lu=Ct==="freebsd",cu=Ct==="openbsd",uu=Ct==="netbsd",pu=Ct==="sunos";function fu(s,t,e){let r={},i=$.getValue(s,"BatteryStatus",":").trim();if(i>=0){let n=i?parseInt(i):0;r.status=n,r.hasBattery=!0,r.maxCapacity=e||parseInt($.getValue(s,"DesignCapacity",":")||0),r.designedCapacity=parseInt($.getValue(s,"DesignCapacity",":")||t),r.voltage=parseInt($.getValue(s,"DesignVoltage",":")||0)/1e3,r.capacityUnit="mWh",r.percent=parseInt($.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=$.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(iu){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=$.getValue(l,"POWER_SUPPLY_STATUS","=").toLowerCase()==="charging",e.acConnected=i||e.isCharging,e.voltage=parseInt("0"+$.getValue(l,"POWER_SUPPLY_VOLTAGE_NOW","="),10)/1e6,e.capacityUnit=e.voltage?"mWh":"mAh",e.cycleCount=parseInt("0"+$.getValue(l,"POWER_SUPPLY_CYCLE_COUNT","="),10),e.maxCapacity=Math.round(parseInt("0"+$.getValue(l,"POWER_SUPPLY_CHARGE_FULL","=",!0,!0),10)/1e3*(e.voltage||1));let c=parseInt("0"+$.getValue(l,"POWER_SUPPLY_VOLTAGE_MIN_DESIGN","="),10)/1e6;e.designedCapacity=Math.round(parseInt("0"+$.getValue(l,"POWER_SUPPLY_CHARGE_FULL_DESIGN","=",!0,!0),10)/1e3*(c||e.voltage||1)),e.currentCapacity=Math.round(parseInt("0"+$.getValue(l,"POWER_SUPPLY_CHARGE_NOW","="),10)/1e3*(e.voltage||1)),e.maxCapacity||(e.maxCapacity=parseInt("0"+$.getValue(l,"POWER_SUPPLY_ENERGY_FULL","=",!0,!0),10)/1e3,e.designedCapacity=parseInt("0"+$.getValue(l,"POWER_SUPPLY_ENERGY_FULL_DESIGN","=",!0,!0),10)/1e3|e.maxCapacity,e.currentCapacity=parseInt("0"+$.getValue(l,"POWER_SUPPLY_ENERGY_NOW","="),10)/1e3);let u=$.getValue(l,"POWER_SUPPLY_CAPACITY","="),p=parseInt("0"+$.getValue(l,"POWER_SUPPLY_ENERGY_NOW","="),10),f=parseInt("0"+$.getValue(l,"POWER_SUPPLY_POWER_NOW","="),10),d=parseInt("0"+$.getValue(l,"POWER_SUPPLY_CURRENT_NOW","="),10),m=parseInt("0"+$.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=$.getValue(l,"POWER_SUPPLY_TECHNOLOGY","="),e.model=$.getValue(l,"POWER_SUPPLY_MODEL_NAME","="),e.manufacturer=$.getValue(l,"POWER_SUPPLY_MANUFACTURER","="),e.serial=$.getValue(l,"POWER_SUPPLY_SERIAL_NUMBER","="),s&&s(e),t(e)}}):(s&&s(e),t(e))}if((lu||cu||uu)&&vo("sysctl -i hw.acpi.battery hw.acpi.acline",function(r,i){let n=i.toString().split(`
|
|
146
|
-
`),o=parseInt("0"+$.getValue(n,"hw.acpi.battery.units"),10),a=parseInt("0"+$.getValue(n,"hw.acpi.battery.life"),10);e.hasBattery=o>0,e.cycleCount=null,e.isCharging=$.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)}),ou&&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"+$.getValue(n,"cyclecount","="),10),e.voltage=parseInt("0"+$.getValue(n,"voltage","="),10)/1e3,e.capacityUnit=e.voltage?"mWh":"mAh",e.maxCapacity=Math.round(parseInt("0"+$.getValue(n,"applerawmaxcapacity","="),10)*(e.voltage||1)),e.currentCapacity=Math.round(parseInt("0"+$.getValue(n,"applerawcurrentcapacity","="),10)*(e.voltage||1)),e.designedCapacity=Math.round(parseInt("0"+$.getValue(n,"DesignCapacity","="),10)*(e.voltage||1)),e.manufacturer="Apple",e.serial=$.getValue(n,"BatterySerialNumber","=");let o=null,l=$.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=$.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"+$.getValue(n,"TimeRemaining","="),10)))}s&&s(e),t(e)}),pu&&(s&&s(e),t(e)),au)try{let r=[];r.push($.powerShell("Get-CimInstance Win32_Battery | select BatteryStatus, DesignCapacity, DesignVoltage, EstimatedChargeRemaining, DeviceID | fl")),r.push($.powerShell("(Get-WmiObject -Class BatteryStaticData -Namespace ROOT/WMI).DesignedCapacity")),r.push($.powerShell("(Get-CimInstance -Class BatteryFullChargedCapacity -Namespace ROOT/WMI).FullChargedCapacity")),$.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]?$.toInt(l[f]):0,g=c&&c.length>=f+1&&c[f]?$.toInt(c[f]):0,_=fu(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=ce(Lo=>{"use strict";var Yr=R("fs"),bs=R("child_process").exec,Wn=R("child_process").execSync,b=ue(),Ot=process.platform,lr="",Xr=Ot==="linux"||Ot==="android",du=Ot==="darwin",Co=Ot==="win32",mu=Ot==="freebsd",hu=Ot==="openbsd",gu=Ot==="netbsd",yu=Ot==="sunos",cr=0,ur=0,Kr=0,Zr=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 _u(s){return{610:"Apple","1e6d":"LG","10ac":"DELL","4dd9":"Sony","38a3":"NEC"}[s]||""}function Su(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 vu(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 xu(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=vu(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"]||Su((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"),Q=S.spdisplays_depth||"",E=S["_spdisplays_display-serial-number"]||S["_spdisplays_display-serial-number2"]||null;d.displays.push({vendor:_u(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:Q==="CGSThirtyBitColor"?30:Q==="CGSThirtytwoBitColor"?32:Q==="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{_=Wn('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 Q=y.search(/\[[0-9a-f]{4}:[0-9a-f]{4}]|$/),E=y.substr(x,Q-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 J=S.split(m.model)[0].trim();J&&(m.subVendor=J)}}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(lr)return lr;if(Co)try{let f=b.WINDIR+"\\System32\\DriverStore\\FileRepository",m=Yr.readdirSync(f).filter(g=>Yr.readdirSync([f,g].join("/")).includes("nvidia-smi.exe")).reduce((g,_)=>{let h=Yr.statSync([f,g,"nvidia-smi.exe"].join("/")),y=Yr.statSync([f,_,"nvidia-smi.exe"].join("/"));return h.ctimeMs>y.ctimeMs?g:_});m&&(lr=[f,m,"nvidia-smi.exe"].join("/"))}catch{b.noop()}else Xr&&(lr="nvidia-smi");return lr}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"+(Xr?" 2>/dev/null":"");Xr&&(f.stdio=["pipe","pipe","ignore"]);try{return Wn(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(du&&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{_=Wn('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)}),Xr&&(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,J){if(!E){let W=J.toString().split(`
|
|
157
|
-
`);d.displays=c(W,T)}s&&s(d),f(d)})})})})),(mu||hu||gu)&&(s&&s(null),f(null)),yu&&(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(J=>{let W=(E.subDeviceId||"").toLowerCase(),le=J.subDeviceId.split("x"),de=le.length>1?le[1].toLowerCase():le[0].toLowerCase(),Se=Math.abs(W.length-de.length);if(W.length>de.length)for(let K=0;K<Se;K++)de="0"+de;else if(W.length<de.length)for(let K=0;K<Se;K++)W="0"+W;return W===de})||{}):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/),Q=[];T.forEach(E=>{let J=E.split("|");J.length===5&&Q.push({vendor:J[0],code:J[1],model:J[2],serial:J[3],instanceId:J[4]})}),d.displays=p(x,v,S,N,Q),d.displays.length===1&&(cr&&(d.displays[0].resolutionX=cr,d.displays[0].currentResX||(d.displays[0].currentResX=cr)),ur&&(d.displays[0].resolutionY=ur,d.displays[0].currentResY===0&&(d.displays[0].currentResY=ur)),Kr&&(d.displays[0].pixelDepth=Kr)),d.displays=d.displays.map(E=>(Zr&&!E.currentRefreshRate&&(E.currentRefreshRate=Zr),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}),cr=b.toInt(b.getValue(h,"CurrentHorizontalResolution",":"))||cr,ur=b.toInt(b.getValue(h,"CurrentVerticalResolution",":"))||ur,Zr=b.toInt(b.getValue(h,"CurrentRefreshRate",":"))||Zr,Kr=b.toInt(b.getValue(h,"CurrentBitsPerPixel",":"))||Kr}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 Q=f[T].split(`
|
|
161
|
-
`),E=d[T].split(`
|
|
162
|
-
`),J=g[T].split(`
|
|
163
|
-
`),W=b.getValue(Q,"BitsPerPixel"),le=b.getValue(Q,"Bounds").replace("{","").replace("}","").replace(/=/g,":").split(","),de=b.getValue(Q,"Primary"),Se=b.getValue(E,"MaxHorizontalImageSize"),K=b.getValue(E,"MaxVerticalImageSize"),ve=b.getValue(E,"InstanceName").toLowerCase(),me=b.getValue(J,"VideoOutputTechnology"),Ae=b.getValue(Q,"DeviceName"),Te="",ie="";_.forEach(oe=>{oe.instanceId.toLowerCase().startsWith(ve)&&y.startsWith("(")&&S.startsWith("PnP")&&(Te=oe.vendor,ie=oe.model)}),h.push({vendor:ve.startsWith(v)&&Te===""?y:Te,model:ve.startsWith(v)&&ie===""?S:ie,deviceName:Ae,main:de.toLowerCase()==="true",builtin:me==="2147483648",connection:me&&Oo[me]?Oo[me]:"",resolutionX:b.toInt(b.getValue(le,"Width",":")),resolutionY:b.toInt(b.getValue(le,"Height",":")),sizeX:Se?parseInt(Se,10):null,sizeY:K?parseInt(K,10):null,pixelDepth:W,currentResX:b.toInt(b.getValue(le,"Width",":")),currentResY:b.toInt(b.getValue(le,"Height",":")),positionX:b.toInt(b.getValue(le,"X",":")),positionY:b.toInt(b.getValue(le,"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=xu});var Do=ce(ps=>{"use strict";var O=ue(),Po=R("fs"),we=R("child_process").exec,It=R("child_process").execSync,wu=O.promisifySave(R("child_process").exec),Et=process.platform,Fe=Et==="linux"||Et==="android",Lt=Et==="darwin",Ms=Et==="win32",Be=Et==="freebsd",We=Et==="openbsd",Ue=Et==="netbsd",Rs=Et==="sunos",re={},U={};function Cu(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||!Lt&&!n(u[1])))){let p=u[0],f=Fe||Be||We||Ue?u[1]:i(u[0]),d=parseInt(Fe||Be||We||Ue?u[2]:u[1])*1024,m=parseInt(Fe||Be||We||Ue?u[3]:u[2])*1024,g=parseInt(Fe||Be||We||Ue?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,Fe||Be||We||Ue?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(Fe||Be||We||Ue||Lt){let u="";if(e=[],r={},Lt){u="df -kP";try{e=It("diskutil list").toString().split(`
|
|
165
|
-
`).filter(p=>!p.startsWith("/")&&p.indexOf(":")>0),It("mount").toString().split(`
|
|
166
|
-
`).filter(p=>p.startsWith("/")).forEach(p=>{r[p.split(" ")[0]]=p.toLowerCase().indexOf("read-only")===-1})}catch{O.noop()}}if(Fe)try{u="export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL",It("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(Be||We||Ue)try{u="df -lkPT",It("mount").toString().split(`
|
|
168
|
-
`).forEach(p=>{r[p.split(" ")[0]]=p.toLowerCase().indexOf("read-only")===-1})}catch{O.noop()}we(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)):we("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)}})})}ps.fsSize=Cu;function Ou(s){return new Promise(t=>{process.nextTick(()=>{let e={max:null,allocated:null,available:null};(Be||We||Ue||Lt)&&we("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)}),Fe&&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))})})}ps.fsOpenFiles=Ou;function Iu(s){return parseInt(s.substr(s.indexOf(" (")+2,s.indexOf(" Bytes)")-10))}function Lu(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=Iu(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 Un(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 Eu(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=It(`mdadm --export --detail /dev/${e.name}`,O.execOptsLinux).toString().split(`
|
|
173
|
-
`),i=Eu(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 Pu(s){let t=[];return s.forEach(e=>{e.type.startsWith("disk")&&t.push(e.name)}),t}function Tu(s){let t=s;try{let e=Pu(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 Vu(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 Nu(s){let t=s;try{let e=Vu(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 Du(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 Au(s,t){let e=Du(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 Gn(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 bu(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(Fe&&we("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)we("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=Gn(o).split(`
|
|
176
|
-
`);e=Un(a),e=To(e)}s&&s(e),t(e)});else{let n=Gn(i).split(`
|
|
177
|
-
`);e=Un(n),e=To(e),e=Tu(e),s&&s(e),t(e)}}),Lt&&we("diskutil info -all",{maxBuffer:1024*1024},function(r,i){if(!r){let n=i.toString().split(`
|
|
178
|
-
`);e=Lu(n),e=Nu(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=Au(e,a),s&&s(e),t(e)})}catch{s&&s(e),t(e)}}(Be||We||Ue)&&(s&&s(null),t(null))})})}ps.blockDevices=bu;function Vo(s,t){let e={rx:0,wx:0,tx:0,rx_sec:null,wx_sec:null,tx_sec:null,ms:0};return re&&re.ms?(e.rx=s,e.wx=t,e.tx=e.rx+e.wx,e.ms=Date.now()-re.ms,e.rx_sec=(e.rx-re.bytes_read)/(e.ms/1e3),e.wx_sec=(e.wx-re.bytes_write)/(e.ms/1e3),e.tx_sec=e.rx_sec+e.wx_sec,re.rx_sec=e.rx_sec,re.wx_sec=e.wx_sec,re.tx_sec=e.tx_sec,re.bytes_read=e.rx,re.bytes_write=e.wx,re.bytes_overall=e.rx+e.wx,re.ms=Date.now(),re.last_ms=e.ms):(e.rx=s,e.wx=t,e.tx=e.rx+e.wx,re.rx_sec=null,re.wx_sec=null,re.tx_sec=null,re.bytes_read=e.rx,re.bytes_write=e.wx,re.bytes_overall=e.rx+e.wx,re.ms=Date.now(),re.last_ms=0),e}function Mu(s){return new Promise(t=>{process.nextTick(()=>{if(Ms||Be||We||Ue||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;re&&!re.ms||re&&re.ms&&Date.now()-re.ms>=500?(Fe&&we("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("|");we('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)})}}),Lt&&we(`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=re.last_ms,e.rx=re.bytes_read,e.wx=re.bytes_write,e.tx=re.bytes_read+re.bytes_write,e.rx_sec=re.rx_sec,e.wx_sec=re.wx_sec,e.tx_sec=re.tx_sec,s&&s(e),t(e))})})}ps.fsStats=Mu;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 U&&U.ms?(n.rIO=s,n.wIO=t,n.tIO=s+t,n.ms=Date.now()-U.ms,n.rIO_sec=(n.rIO-U.rIO)/(n.ms/1e3),n.wIO_sec=(n.wIO-U.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-U.rWaitTime)*100/n.ms,n.wWaitPercent=(n.wWaitTime-U.wWaitTime)*100/n.ms,n.tWaitPercent=(n.tWaitTime-U.tWaitTime)*100/n.ms,U.rIO=s,U.wIO=t,U.rIO_sec=n.rIO_sec,U.wIO_sec=n.wIO_sec,U.tIO_sec=n.tIO_sec,U.rWaitTime=e,U.wWaitTime=r,U.tWaitTime=i,U.rWaitPercent=n.rWaitPercent,U.wWaitPercent=n.wWaitPercent,U.tWaitPercent=n.tWaitPercent,U.last_ms=n.ms,U.ms=Date.now()):(n.rIO=s,n.wIO=t,n.tIO=s+t,n.rWaitTime=e,n.wWaitTime=r,n.tWaitTime=i,U.rIO=s,U.wIO=t,U.rIO_sec=null,U.wIO_sec=null,U.tIO_sec=null,U.rWaitTime=e,U.wWaitTime=r,U.tWaitTime=i,U.rWaitPercent=null,U.wWaitPercent=null,U.tWaitPercent=null,U.last_ms=0,U.ms=Date.now()),n}function Ru(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;U&&!U.ms||U&&U.ms&&Date.now()-U.ms>=500?((Fe||Be||We||Ue)&&we('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))}),Lt&&we(`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=U.rIO,e.wIO=U.wIO,e.tIO=U.rIO+U.wIO,e.ms=U.last_ms,e.rIO_sec=U.rIO_sec,e.wIO_sec=U.wIO_sec,e.tIO_sec=U.tIO_sec,e.rWaitTime=U.rWaitTime,e.wWaitTime=U.wWaitTime,e.tWaitTime=U.tWaitTime,e.rWaitPercent=U.rWaitPercent,e.wWaitPercent=U.wWaitPercent,e.tWaitPercent=U.tWaitPercent,s&&s(e),t(e))})})}ps.disksIO=Ru;function ku(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(Fe){let o="";we("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=It("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=Gn(f).split(`
|
|
187
|
-
`);u=Un(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=It("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?we(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
|
-
"`,we(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((Be||We||Ue)&&(s&&s(i),e(i)),Rs&&(s&&s(i),e(i)),Lt&&we("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
|
-
"`,we(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(It("smartctl --scan -j").toString());a&&a.devices&&a.devices.length>0&&a.devices.forEach(l=>{o.push(wu(`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)}})})}ps.diskLayout=ku});var Wo=ce(ms=>{"use strict";var Qr=R("os"),De=R("child_process").exec,pe=R("child_process").execSync,Fu=R("fs"),D=ue(),Pt=process.platform,ot=Pt==="linux"||Pt==="android",at=Pt==="darwin",pr=Pt==="win32",Tt=Pt==="freebsd",Vt=Pt==="openbsd",Nt=Pt==="netbsd",Ao=Pt==="sunos",ee={},bo="",ks={},Mo=[],Fs=[],Bs={},fs;function ds(){let s="",t="";try{let e=Qr.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||"",pr){let i="";if(pe("netstat -r",D.execOptsWin).toString().split(Qr.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(ot){let o=pe("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(at||Tt||Vt||Nt||Ao){let i="";ot&&(i="ip route 2> /dev/null | grep default | awk '{print $5}'"),at&&(i="route -n get default 2>/dev/null | grep interface: | awk '{print $2}'"),(Tt||Vt||Nt||Ao)&&(i="route get 0.0.0.0 | grep interface:"),s=pe(i).toString().split(`
|
|
212
|
-
`)[0],s.indexOf(":")>-1&&(s=s.split(":")[1].trim())}}catch{D.noop()}return s&&(bo=s),bo}ms.getDefaultNetworkInterface=ds;function Ro(){let s="",t="",e={};if(ot||Tt||Vt||Nt){if(typeof fs>"u")try{let r=pe("which ip",D.execOptsLinux).toString().split(`
|
|
213
|
-
`);r.length&&r[0].indexOf(":")===-1&&r[0].indexOf("/")===0?fs=r[0]:fs=""}catch{fs=""}try{let r="export LC_ALL=C; "+(fs?fs+" link show up":"/sbin/ifconfig")+"; unset LC_ALL",n=pe(r,D.execOptsLinux).toString().split(`
|
|
214
|
-
`);for(let o=0;o<n.length;o++)if(n[o]&&n[o][0]!==" "){if(fs){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(at)try{let n=pe("/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 Bu(s){return new Promise(t=>{process.nextTick(()=>{let e=ds();s&&s(e),t(e)})})}ms.networkInterfaceDefault=Bu;function Wu(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 Uu(){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(Wu(r,i))})}catch{s([])}})})}function Gu(){let s={},t={primaryDNS:"",exitCode:0,ifaces:[]};try{return pe("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 ju(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 zu(){try{return pe("netsh lan show profiles",D.execOptsWin).split(`\r
|
|
222
|
-
Profile on interface`)}catch(s){return s.status===1&&s.stdout.includes("AutoConfig")?"Disabled":[]}}function qu(s){try{return pe(`netsh wlan show interface name="${s}" | findstr "SSID"`,D.execOptsWin).split(`\r
|
|
223
|
-
`).shift().split(":").pop()}catch{return"Unknown"}}function Hu(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=qu(t);o!=="Unknown"&&(i=pe(`netsh wlan show profiles "${o}" | findstr "802.1X"`,D.execOptsWin),n=pe(`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 $u(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 Yu(){let s="/sbin/ifconfig -v";try{let t=pe(s,{maxBuffer:2048e4}).toString().split(`
|
|
226
|
-
`),e=ko(t);return $u(e)}catch{return[]}}function Xu(s){let t=`nmcli device status 2>/dev/null | grep ${s}`;try{let n=pe(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'`;pe(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 Ku(){let s="ip a 2> /dev/null",t=[];try{let e=pe(s,D.execOptsLinux).toString().split(`
|
|
228
|
-
`),r=ko(e);t=Zu(r)}catch{D.noop()}try{t=Fo("/etc/network/interfaces")}catch{D.noop()}return t}function Zu(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 Ju(s,t,e){let r=!1;if(t){let i=`nmcli connection show "${t}" 2>/dev/null | grep ipv4.method;`;try{switch(pe(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 Qu(s){let t=!1,e=`ipconfig getpacket "${s}" 2>/dev/null | grep lease_time;`;try{let r=pe(e).toString().split(`
|
|
229
|
-
`);r.length&&r[0].startsWith("lease_time")&&(t=!0)}catch{D.noop()}return t}function ep(s){if(s){let t=`nmcli connection show "${s}" 2>/dev/null | grep ipv4.dns-search;`;try{let i=pe(t,D.execOptsLinux).toString().replace(/\s+/g," ").trim().split(" ").slice(1).toString();return i=="--"?"Not defined":i}catch{return"Unknown"}}else return"Unknown"}function tp(s){if(s){let t=`nmcli connection show "${s}" 2>/dev/null | grep 802-1x.eap;`;try{let i=pe(t,D.execOptsLinux).toString().replace(/\s+/g," ").trim().split(" ").slice(1).toString();return i=="--"?"":i}catch{return"Not defined"}}else return"Not defined"}function sp(s){return s?s=="Not defined"?"Disabled":"Enabled":"Unknown"}function jn(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 zn(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=Qr.networkInterfaces(),n=[],o=[],a=[],l=[];if(at||Tt||Vt||Nt)if(JSON.stringify(i)===JSON.stringify(ks)&&!t)n=Fs,s&&s(n),r(n);else{let c=ds();ks=JSON.parse(JSON.stringify(i)),o=Yu(),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:jn(u.iface,u.iface,u.mac),operstate:u.operstate,type:u.type,duplex:u.duplex,mtu:u.mtu,speed:u.speed,dhcp:Qu(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(ot)if(JSON.stringify(i)===JSON.stringify(ks)&&!t)n=Fs,s&&s(n),r(n);else{ks=JSON.parse(JSON.stringify(i)),Mo=Ku();let c=ds();for(let u in i){let p="",f="",d="",m="",g="",_="",h="",y=null,S=0,v=!1,x="",N="",T="",Q="";if({}.hasOwnProperty.call(i,u)){let E=u;i[u].forEach(function(oe){(oe.family==="IPv4"||oe.family===4)&&(p=oe.address,f=oe.netmask),(oe.family==="IPv6"||oe.family===6)&&(!d||d.match(/^fe80::/i))&&(d=oe.address,m=oe.netmask),g=oe.mac;let Si=parseInt(process.versions.node.split("."),10);g.indexOf("00:00:0")>-1&&(ot||at)&&!oe.internal&&Si>=8&&Si<=11&&(Object.keys(Bs).length===0&&(Bs=Ro()),g=Bs[u]||"")});let J=u.split(":")[0].trim().toLowerCase(),W="",le=D.isPrototypePolluted()?"---":D.sanitizeShellString(J),de=D.mathMin(le.length,2e3);for(let oe=0;oe<=de;oe++)le[oe]!==void 0&&(W=W+le[oe]);let Se=`echo -n "addr_assign_type: "; cat /sys/class/net/${W}/addr_assign_type 2>/dev/null; echo;
|
|
230
|
-
echo -n "address: "; cat /sys/class/net/${W}/address 2>/dev/null; echo;
|
|
231
|
-
echo -n "addr_len: "; cat /sys/class/net/${W}/addr_len 2>/dev/null; echo;
|
|
232
|
-
echo -n "broadcast: "; cat /sys/class/net/${W}/broadcast 2>/dev/null; echo;
|
|
233
|
-
echo -n "carrier: "; cat /sys/class/net/${W}/carrier 2>/dev/null; echo;
|
|
234
|
-
echo -n "carrier_changes: "; cat /sys/class/net/${W}/carrier_changes 2>/dev/null; echo;
|
|
235
|
-
echo -n "dev_id: "; cat /sys/class/net/${W}/dev_id 2>/dev/null; echo;
|
|
236
|
-
echo -n "dev_port: "; cat /sys/class/net/${W}/dev_port 2>/dev/null; echo;
|
|
237
|
-
echo -n "dormant: "; cat /sys/class/net/${W}/dormant 2>/dev/null; echo;
|
|
238
|
-
echo -n "duplex: "; cat /sys/class/net/${W}/duplex 2>/dev/null; echo;
|
|
239
|
-
echo -n "flags: "; cat /sys/class/net/${W}/flags 2>/dev/null; echo;
|
|
240
|
-
echo -n "gro_flush_timeout: "; cat /sys/class/net/${W}/gro_flush_timeout 2>/dev/null; echo;
|
|
241
|
-
echo -n "ifalias: "; cat /sys/class/net/${W}/ifalias 2>/dev/null; echo;
|
|
242
|
-
echo -n "ifindex: "; cat /sys/class/net/${W}/ifindex 2>/dev/null; echo;
|
|
243
|
-
echo -n "iflink: "; cat /sys/class/net/${W}/iflink 2>/dev/null; echo;
|
|
244
|
-
echo -n "link_mode: "; cat /sys/class/net/${W}/link_mode 2>/dev/null; echo;
|
|
245
|
-
echo -n "mtu: "; cat /sys/class/net/${W}/mtu 2>/dev/null; echo;
|
|
246
|
-
echo -n "netdev_group: "; cat /sys/class/net/${W}/netdev_group 2>/dev/null; echo;
|
|
247
|
-
echo -n "operstate: "; cat /sys/class/net/${W}/operstate 2>/dev/null; echo;
|
|
248
|
-
echo -n "proto_down: "; cat /sys/class/net/${W}/proto_down 2>/dev/null; echo;
|
|
249
|
-
echo -n "speed: "; cat /sys/class/net/${W}/speed 2>/dev/null; echo;
|
|
250
|
-
echo -n "tx_queue_len: "; cat /sys/class/net/${W}/tx_queue_len 2>/dev/null; echo;
|
|
251
|
-
echo -n "type: "; cat /sys/class/net/${W}/type 2>/dev/null; echo;
|
|
252
|
-
echo -n "wireless: "; cat /proc/net/wireless 2>/dev/null | grep ${W}; echo;
|
|
253
|
-
echo -n "wirelessspeed: "; iw dev ${W} link 2>&1 | grep bitrate; echo;`,K=[];try{K=pe(Se,D.execOptsLinux).toString().split(`
|
|
254
|
-
`);let oe=Xu(W);v=Ju(W,oe,Mo),x=ep(oe),N=tp(oe),T=sp(N)}catch{D.noop()}_=D.getValue(K,"duplex"),_=_.startsWith("cat")?"":_,h=parseInt(D.getValue(K,"mtu"),10);let ve=parseInt(D.getValue(K,"speed"),10);y=isNaN(ve)?null:ve;let me=D.getValue(K,"wirelessspeed").split("tx bitrate: ");y===null&&me.length===2&&(ve=parseFloat(me[1]),y=isNaN(ve)?null:ve),S=parseInt(D.getValue(K,"carrier_changes"),10);let Ae=D.getValue(K,"operstate");Q=Ae==="up"?D.getValue(K,"wireless").trim()?"wireless":"wired":"unknown",(W==="lo"||W.startsWith("bond"))&&(Q="virtual");let Te=i[u]&&i[u][0]?i[u][0].internal:!1;(u.toLowerCase().indexOf("loopback")>-1||E.toLowerCase().indexOf("loopback")>-1)&&(Te=!0);let ie=Te?!1:jn(u,E,g);n.push({iface:W,ifaceName:E,default:J===c,ip4:p,ip4subnet:f,ip6:d,ip6subnet:m,mac:g,internal:Te,virtual:ie,operstate:Ae,type:Q,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(pr)if(JSON.stringify(i)===JSON.stringify(ks)&&!t)n=Fs,s&&s(n),r(n);else{ks=JSON.parse(JSON.stringify(i));let c=ds();Uu().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=zu(),a=Gu();for(let p in i){let f="",d=D.isPrototypePolluted()?"---":D.sanitizeShellString(p),m=D.mathMin(d.length,2e3);for(let K=0;K<=m;K++)d[K]!==void 0&&(f=f+d[K]);let g=p,_="",h="",y="",S="",v="",x="",N="",T=null,Q=0,E="down",J=!1,W="",le="",de="",Se="";if({}.hasOwnProperty.call(i,p)){let K=p;i[p].forEach(function(ie){(ie.family==="IPv4"||ie.family===4)&&(_=ie.address,h=ie.netmask),(ie.family==="IPv6"||ie.family===6)&&(!y||y.match(/^fe80::/i))&&(y=ie.address,S=ie.netmask),v=ie.mac;let oe=parseInt(process.versions.node.split("."),10);v.indexOf("00:00:0")>-1&&(ot||at)&&!ie.internal&&oe>=8&&oe<=11&&(Object.keys(Bs).length===0&&(Bs=Ro()),v=Bs[p]||"")}),W=ju(a.ifaces,f);let ve=!1;u.forEach(ie=>{ie.mac===v&&!ve&&(g=ie.iface||g,K=ie.name,J=ie.dhcp,E=ie.operstate,T=E==="up"?ie.speed:0,Se=ie.type,ve=!0)}),(p.toLowerCase().indexOf("wlan")>=0||K.toLowerCase().indexOf("wlan")>=0||K.toLowerCase().indexOf("802.11n")>=0||K.toLowerCase().indexOf("wireless")>=0||K.toLowerCase().indexOf("wi-fi")>=0||K.toLowerCase().indexOf("wifi")>=0)&&(Se="wireless");let me=Hu(Se,f,l);le=me.protocol,de=me.state;let Ae=i[p]&&i[p][0]?i[p][0].internal:!1;(p.toLowerCase().indexOf("loopback")>-1||K.toLowerCase().indexOf("loopback")>-1)&&(Ae=!0);let Te=Ae?!1:jn(p,K,v);n.push({iface:g,ifaceName:K,default:g===c,ip4:_,ip4subnet:h,ip6:y,ip6subnet:S,mac:v,internal:Ae,virtual:Te,operstate:E,type:Se,duplex:x,mtu:N,speed:T,dhcp:J,dnsSuffix:W,ieee8021xAuth:le,ieee8021xState:de,carrierChanges:Q})}}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)})}})})}ms.networkInterfaces=zn;function Jr(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 ee[s]&&ee[s].ms?(l.ms=Date.now()-ee[s].ms,l.rx_sec=t-ee[s].rx_bytes>=0?(t-ee[s].rx_bytes)/(l.ms/1e3):0,l.tx_sec=e-ee[s].tx_bytes>=0?(e-ee[s].tx_bytes)/(l.ms/1e3):0,ee[s].rx_bytes=t,ee[s].tx_bytes=e,ee[s].rx_sec=l.rx_sec,ee[s].tx_sec=l.tx_sec,ee[s].ms=Date.now(),ee[s].last_ms=l.ms,ee[s].operstate=r):(ee[s]||(ee[s]={}),ee[s].rx_bytes=t,ee[s].tx_bytes=e,ee[s].rx_sec=null,ee[s].tx_sec=null,ee[s].ms=Date.now(),ee[s].last_ms=0,ee[s].operstate=r),l}function Bo(s,t){let e=[];return new Promise(r=>{process.nextTick(()=>{if(D.isFunction(s)&&!t)t=s,e=[ds()];else{if(typeof s!="string"&&s!==void 0)return t&&t([]),r([]);s=s||ds(),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=[],zn(!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(rp(o.trim()));n.length?Promise.all(n).then(o=>{t&&t(o),r(o)}):(t&&t(i),r(i))}})})}function rp(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(!ee[r]||ee[r]&&!ee[r].ms||ee[r]&&ee[r].ms&&Date.now()-ee[r].ms>=500){if(ot&&(Fu.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; ",De(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=Jr(r,l,c,a,u,p,f,d)),e(o)})):e(o)),(Tt||Vt||Nt)&&(m="netstat -ibndI "+r,De(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=Jr(r,l,c,a,u,p,f,d)}e(o)})),at&&(m="ifconfig "+r+' | grep "status"',De(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,De(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=Jr(r,l,c,o.operstate,u,p,f,d)}e(o)})})),pr){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)}zn(!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=Jr(y,parseInt(l),parseInt(c),a,u,p,f,d)),e(o)})})}}else o.rx_bytes=ee[r].rx_bytes,o.tx_bytes=ee[r].tx_bytes,o.rx_sec=ee[r].rx_sec,o.tx_sec=ee[r].tx_sec,o.ms=ee[r].last_ms,o.operstate=ee[r].operstate,e(o)})})}ms.networkStats=Bo;function np(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 ip(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(ot||Tt||Vt||Nt){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';(Tt||Vt||Nt)&&(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'),De(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"',De(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(at){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";De(r,{maxBuffer:1024*2e4},function(n,o){n||De("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:np(c,v)})}}),s&&s(e),t(e)})})}if(pr){let r="netstat -nao";try{De(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)}}})})}ms.networkConnections=ip;function op(s){return new Promise(t=>{process.nextTick(()=>{let e="";if(ot||Tt||Vt||Nt){let r="ip route get 1";try{De(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(at){let r="route -n get default";try{De(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}'",De(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(pr)try{De("netstat -r",D.execOptsWin,function(r,i){i.toString().split(Qr.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)}})})}ms.networkGatewayDefault=op});var Ho=ce(rn=>{"use strict";var fr=R("os"),en=R("child_process").exec,Dt=R("child_process").execSync,I=ue(),tn=process.platform,qn=tn==="linux"||tn==="android",Hn=tn==="darwin",$n=tn==="win32";function Yn(s){let t=parseFloat(s);return t<0?0:t>=100?-50:t/2-100}function sn(s){let t=2*(parseFloat(s)+100);return t<=100?t:100}var dr={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(dr,s)?dr[s]:null}function ap(s){let t=0;for(let e in dr)({}).hasOwnProperty.call(dr,e)&&dr[e]===s&&(t=I.toInt(e));return t}function jo(){let s=[],t="iw dev 2>/dev/null";try{let r=Dt(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=Dt("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=Dt(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 lp(s){let t=`nmcli -t --show-secrets connection show ${s} 2>/dev/null`;try{let e=Dt(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 cp(s){if(!s)return{};let t=`wpa_cli -i ${s} status 2>&1`;try{let e=Dt(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:ap(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=Dt(t,I.execOptsLinux).toString().split("ACTIVE:");return r.shift(),r.forEach(i=>{i="ACTIVE:"+i;let n=i.split(fr.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:Yn(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=Dt(`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?sn(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 up(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:sn(r),security:i,wpaFlags:n,rsnFlags:[]})}),t}function pp(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(qn)if(e=qo(),e.length===0)try{let r=Dt("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 Hn?en("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s -x",{maxBuffer:1024*4e4},function(i,n){let o=n.toString();e=up(I.plistParser(o)),s&&s(e),t(e)}):$n?I.powerShell("netsh wlan show networks mode=Bssid").then(i=>{let n=i.toString("utf8").split(fr.EOL+fr.EOL+"SSID ");n.shift(),n.forEach(o=>{let a=o.split(fr.EOL);if(a&&a.length>=8&&a[0].indexOf(":")>=0){let l=o.split(" BSSID");l.shift(),l.forEach(c=>{let u=c.split(fr.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:Yn(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))})})}rn.wifiNetworks=pp;function fp(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 dp(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(qn){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=cp(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 _=lp(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:sn(S),txRate:null})}),s&&s(e),t(e)}else if(Hn){let r="system_profiler SPNetworkDataType";en(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',en(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:sn(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 $n?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=Yn(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))})})}rn.wifiConnections=dp;function mp(s){return new Promise(t=>{process.nextTick(()=>{let e=[];qn?(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)):Hn?en("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)}):$n?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=fp(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))})})}rn.wifiInterfaces=mp});var Xo=ce(an=>{"use strict";var on=R("os"),hp=R("fs"),gp=R("path"),mr=R("child_process").exec,Xn=R("child_process").execSync,z=ue(),At=process.platform,et=At==="linux"||At==="android",hs=At==="darwin",Kn=At==="win32",hr=At==="freebsd",gr=At==="openbsd",yr=At==="netbsd",nn=At==="sunos",ge={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:{}},Pe={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 yp(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 _p(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{z.noop()}return p}function Sp(s,t){return z.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=z.stringToLower,r.__proto__.replace=z.stringReplace,r.__proto__.trim=z.stringTrim;let i=z.sanitizeShellString(s),n=z.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="*"),z.isPrototypePolluted()&&r!=="*"&&(r="------");let o=r.split("|"),a=[],l=[];if(et||hr||gr||yr||hs){if((et||hr||gr||yr)&&r==="*")try{let u=Xn("systemctl --all --type=service --no-legend 2> /dev/null",z.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=Xn("service --status-all 2> /dev/null",z.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=Xn("ls /etc/init.d/ -m 2> /dev/null",z.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=[]}}}hs&&r==="*"&&(t&&t(a),e(a));let c=hs?["-caxo","pcpu,pmem,pid,command"]:["-axo","pcpu,pmem,pid,command"];r!==""&&o.length>0?z.execSafe("ps",c).then(u=>{if(u){let p=u.replace(/ +/g," ").replace(/,+/g,".").split(`
|
|
310
|
-
`);if(o.forEach(function(f){let d;hs?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))})}),et){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";mr(f,{maxBuffer:1024*2e4},function(d,m){let g=m.toString().split(`
|
|
311
|
-
`),_=Zn(g.shift()),h={},y={};g.forEach(S=>{if(y=Jn(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"],z.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(Kn)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",z.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=z.getValue(m,"Name",":",!0).toLowerCase(),_=z.getValue(m,"Caption",":",!0).toLowerCase(),h=z.getValue(m,"Started",":",!0),y=z.getValue(m,"StartMode",":",!0),S=z.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([])})})}an.services=Sp;function Zn(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 Jn(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 vp(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(J){a=l,t[J]?l=o.substring(t[J].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=nn?yp(o.substring(t[8].from+a,t[8].to+l).trim()):_p(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="",Q="",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 J=E.indexOf("("),W=E.indexOf(")"),le=E.indexOf("/"),de=E.indexOf(":");if(J<W&&J<le&&le<W)T=E.split(" ")[0],T=T.replace(/:/g,"");else if(de>0&&(le===-1||le>3))T=E.split(" ")[0],T=T.replace(/:/g,"");else{let Se=E.indexOf(" -"),K=E.indexOf(" /");Se=Se>=0?Se:1e4,K=K>=0?K:1e4;let ve=Math.min(Se,K),me=E.substr(0,ve),Ae=E.substr(ve),Te=me.lastIndexOf("/");if(Te>=0&&(N=me.substr(0,Te),me=me.substr(Te+1)),ve===1e4&&me.indexOf(" ")>-1){let ie=me.split(" ");hp.existsSync(gp.join(N,ie[0]))?(T=ie.shift(),Q=(ie.join(" ")+" "+Ae).trim()):(T=me.trim(),Q=Ae.trim())}else T=me.trim(),Q=Ae.trim()}}return{pid:u,parentPid:p,name:et?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:Q,path:N}}function i(o){let a=[];if(o.length>1){let l=o[0];t=z.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/on.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(ge.ms&&Date.now()-ge.ms>=500||ge.ms===0)if(et||hr||gr||yr||hs||nn)et&&(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"),(hr||gr||yr)&&(l="export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,etime,state,tty,user,command; unset LC_ALL"),hs&&(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"),nn&&(l="ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm"),mr(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,et?(l='cat /proc/stat | grep "cpu "',a.list.forEach(p=>{l+=";cat /proc/"+p.pid+"/stat"}),mr(l,{maxBuffer:1024*2e4},function(p,f){let d=f.toString().split(`
|
|
315
|
-
`),m=Zn(d.shift()),g={},_={};d.forEach(h=>{if(_=Jn(h,m,ge),_.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}}}),ge.all=m,ge.list=Object.assign({},g),ge.ms=Date.now()-ge.ms,ge.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",nn&&(l="ps -o pid,ppid,vsz,rss,nice,etime,s,tty,user,comm"),mr(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(Kn)try{z.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(z.getValue(y,"ProcessId",":",!0),10),v=parseInt(z.getValue(y,"ParentProcessId",":",!0),10),x=z.getValue(y,"ExecutionState",":"),N=z.getValue(y,"Caption",":",!0),T=z.getValue(y,"CommandLine",":",!0),Q=!1;y.forEach(de=>{Q&&de.toLowerCase().startsWith(" ")?T+=" "+de.trim():Q=!1,de.toLowerCase().startsWith("commandline")&&(Q=!0)});let E=z.getValue(y,"ExecutablePath",":",!0),J=parseInt(z.getValue(y,"UserModeTime",":",!0),10),W=parseInt(z.getValue(y,"KernelModeTime",":",!0),10),le=parseInt(z.getValue(y,"WorkingSetSize",":",!0),10);g=g+J,_=_+W,a.all++,x||a.unknown++,x==="3"&&a.running++,(x==="4"||x==="5")&&a.blocked++,d.push({pid:S,utime:J,stime:W,cpu:0,cpuu:0,cpus:0}),f.push({pid:S,parentPid:v,name:N,cpu:0,cpuu:0,cpus:0,mem:le/on.totalmem()*100,priority:parseInt(z.getValue(y,"Priority",":",!0),10),memVsz:parseInt(z.getValue(y,"PageFileUsage",":",!0),10),memRss:Math.floor(parseInt(z.getValue(y,"WorkingSetSize",":",!0),10)/1024),nice:0,started:z.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+_,ge),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}}),ge.all=g+_,ge.all_utime=g,ge.all_stime=_,ge.list=Object.assign({},m),ge.ms=Date.now()-ge.ms,ge.result=Object.assign({},a)}s&&s(a),o(a)})}catch{s&&s(a),o(a)}else s&&s(a),o(a);else s&&s(ge.result),o(ge.result)})})}an.processes=vp;function xp(s,t){return z.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=z.stringToLower,r.__proto__.replace=z.stringReplace,r.__proto__.trim=z.stringTrim;let i=z.sanitizeShellString(s),n=z.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="*"),z.isPrototypePolluted()&&r!=="*"&&(r="------");let o=r.split("|"),a=[];if((z.isPrototypePolluted()?"":z.sanitizeShellString(s)||"*")&&o.length&&o[0]!=="------"){if(Kn)try{z.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(z.getValue(h,"ProcessId",":",!0),10),S=z.getValue(h,"Caption",":",!0),v=parseInt(z.getValue(h,"UserModeTime",":",!0),10),x=parseInt(z.getValue(h,"KernelModeTime",":",!0),10),N=parseInt(z.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="",Q=!1;if(o.forEach(function(E){S.toLowerCase().indexOf(E.toLowerCase())>=0&&!Q&&(Q=!0,T=E)}),r==="*"||Q){let E=!1;a.forEach(function(J){J.proc.toLowerCase()===T.toLowerCase()&&(J.pids.push(y),J.mem+=N/on.totalmem()*100,E=!0)}),E||a.push({proc:T,pid:y,pids:[y],cpu:0,mem:N/on.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,Pe),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}}),Pe.all=m+g,Pe.all_utime=m,Pe.all_stime=g,Pe.list=Object.assign({},d),Pe.ms=Date.now()-Pe.ms,Pe.result=JSON.parse(JSON.stringify(a)),t&&t(a),e(a)}})}catch{t&&t(a),e(a)}if(hs||et||hr||gr||yr){let c=["-axo","pid,ppid,pcpu,pmem,comm"];z.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],_=et?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})}),et){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";mr(d,{maxBuffer:1024*2e4},function(m,g){let _=g.toString().split(`
|
|
320
|
-
`),h=Zn(_.shift()),y={},S={};_.forEach(v=>{if(S=Jn(v,h,Pe),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}),Pe.all=h,Pe.list=Object.assign({},y),Pe.ms=Date.now()-Pe.ms,Pe.result=Object.assign({},a),t&&t(a),e(a)})}else t&&t(a),e(a)}else t&&t(a),e(a)})}}})})}an.processLoad=xp});var Jo=ce(Zo=>{"use strict";var _r=R("child_process").exec,bt=ue(),Mt=process.platform,wp=Mt==="linux"||Mt==="android",Cp=Mt==="darwin",Op=Mt==="win32",Ip=Mt==="freebsd",Lp=Mt==="openbsd",Ep=Mt==="netbsd",Pp=Mt==="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 Qn(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 Tp(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(wp&&_r('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?_r('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))}}),(Ip||Lp||Ep)&&_r('who; echo "---"; w -ih',function(r,i){if(!r){let n=i.toString().split(`
|
|
323
|
-
`);e=Qn(n)}s&&s(e),t(e)}),Pp&&_r('who; echo "---"; w -h',function(r,i){if(!r){let n=i.toString().split(`
|
|
324
|
-
`);e=Qn(n)}s&&s(e),t(e)}),Cp&&_r('who; echo "---"; w -ih',function(r,i){if(!r){let n=i.toString().split(`
|
|
325
|
-
`);e=Qn(n)}s&&s(e),t(e)}),Op)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",bt.powerShell(r).then(i=>{if(i){i=i.split("#-#-#-#");let n=Vp((i[0]||"").split(/\n\s*\n/)),o=Ap((i[1]||"").split(/\n\s*\n/)),a=bp((i[3]||"").split(`\r
|
|
326
|
-
`)),l=Dp((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 Vp(s){let t={};return s.forEach(e=>{let r=e.split(`\r
|
|
327
|
-
`),i=bt.getValue(r,"LogonId"),n=bt.getValue(r,"starttime");i&&(t[i]=n)}),t}function Np(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 Dp(s,t){let e=[];return s.forEach(r=>{let i=r.split(`\r
|
|
328
|
-
`),n=bt.getValue(i,"domain",":",!0),o=bt.getValue(i,"user",":",!0),a=bt.getValue(i,"sessionid",":",!0);if(o){let l=t.filter(c=>Np(c.user,o));e.push({domain:n,user:o,tty:l&&l[0]&&l[0].tty?l[0].tty:a})}}),e}function Ap(s){let t={};return s.forEach(e=>{let r=e.split(`\r
|
|
329
|
-
`),n=bt.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=bt.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 bp(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=Tp});var ta=ce(ii=>{"use strict";var Ce=ue(),Rt=process.platform,ei=Rt==="linux"||Rt==="android",ti=Rt==="darwin",Qo=Rt==="win32",si=Rt==="freebsd",ri=Rt==="openbsd",ni=Rt==="netbsd",ea=Rt==="sunos";function Mp(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=Ce.sanitizeShellString(s,!0),o=Ce.mathMin(n.length,2e3);for(let a=0;a<=o;a++)if(n[a]!==void 0){n[a].__proto__.toLowerCase=Ce.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&&!Ce.isPrototypePolluted()){if(i.__proto__.startsWith=Ce.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(ei||si||ri||ni||ti||ea){let l=["-I","--connect-timeout","5","-m","5"];l.push(i),Ce.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:")?R("https"):R("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)}})})}ii.inetChecksite=Mp;function Rp(s,t){return Ce.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=(Ce.isPrototypePolluted()?"8.8.8.8":Ce.sanitizeShellString(s,!0)).trim(),n=Ce.mathMin(i.length,2e3);for(let a=0;a<=n;a++)if(i[a]!==void 0){i[a].__proto__.toLowerCase=Ce.stringToLower;let l=i[a].toLowerCase();l&&l[0]&&!l[1]&&(r=r+l[0])}if(r.__proto__.startsWith=Ce.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((ei||si||ri||ni||ti)&&(ei&&(o=["-c","2","-w","3",r]),(si||ri||ni)&&(o=["-c","2","-t","3",r]),ti&&(o=["-c2","-t3",r]),Ce.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";Ce.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"];Ce.execSafe("ping",l,Ce.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)}}})})}ii.inetLatency=Rp});var ra=ce((im,sa)=>{"use strict";var kt=R("net"),kp=R("os").type()==="Windows_NT",Ft=kp?"//./pipe/docker_engine":"/var/run/docker.sock",oi=class{getInfo(t){try{let e=kt.createConnection({path:Ft}),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=kt.createConnection({path:Ft}),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=kt.createConnection({path:Ft}),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=kt.createConnection({path:Ft}),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=kt.createConnection({path:Ft}),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=kt.createConnection({path:Ft}),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=kt.createConnection({path:Ft}),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=kt.createConnection({path:Ft}),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=oi});var ia=ce(Wt=>{"use strict";var fe=ue(),Bt=ra(),Fp=process.platform,Bp=Fp==="win32",Gs={},ae,ai=0;function Wp(s){return new Promise(t=>{process.nextTick(()=>{ae||(ae=new Bt);let e={};ae.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)})})})}Wt.dockerInfo=Wp;function Up(s,t){fe.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(()=>{ae||(ae=new Bt);let i=[];ae.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(Gp(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 Gp(s,t){return new Promise(e=>{process.nextTick(()=>{if(s=s||"",typeof s!="string")return e();let r=(fe.isPrototypePolluted()?"":fe.sanitizeShellString(s,!0)).trim();r?(ae||(ae=new Bt),ae.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()})})}Wt.dockerImages=Up;function li(s,t){function e(i,n){return i.filter(a=>a.Id&&a.Id===n).length>0}fe.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(()=>{ae||(ae=new Bt);let n=[];ae.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(jp(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 jp(s,t){return new Promise(e=>{process.nextTick(()=>{if(s=s||"",typeof s!="string")return e();let r=(fe.isPrototypePolluted()?"":fe.sanitizeShellString(s,!0)).trim();r?(ae||(ae=new Bt),ae.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()})})}Wt.dockerContainers=li;function zp(s,t){if(Bp){let e=fe.nanoSeconds(),r=0;if(ai>0){let i=e-ai,n=s.cpu_usage.total_usage-t.cpu_usage.total_usage;i>0&&(r=100*n/i)}return ai=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 qp(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 Hp(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 ci(s,t){let e=[];return new Promise(r=>{process.nextTick(()=>{if(fe.isFunction(s)&&!t)t=s,e=["*"];else{if(s=s||"*",typeof s!="string")return t&&t([]),r([]);let o="";if(o.__proto__.toLowerCase=fe.stringToLower,o.__proto__.replace=fe.stringReplace,o.__proto__.trim=fe.stringTrim,o=s,o=o.trim(),o!=="*"){o="";let a=(fe.isPrototypePolluted()?"":fe.sanitizeShellString(s,!0)).trim(),l=fe.mathMin(a.length,2e3);for(let c=0;c<=l;c++)if(a[c]!==void 0){a[c].__proto__.toLowerCase=fe.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=[],li().then(o=>{for(let a of o)e.push(a.id.substring(0,12));e.length?ci(e.join(",")).then(a=>{t&&t(a),r(a)}):(t&&t(i),r(i))});else{for(let o of e)n.push($p(o.trim()));n.length?Promise.all(n).then(o=>{t&&t(o),r(o)}):(t&&t(i),r(i))}})})}function $p(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?(ae||(ae=new Bt),ae.getInspect(s,r=>{try{ae.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?zp(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=qp(n.networks)),n.blkio_stats&&(t.blockIO=Hp(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{fe.noop()}e(t)})}catch{fe.noop()}})):e(t)})})}Wt.dockerContainerStats=ci;function na(s,t){let e=[];return new Promise(r=>{process.nextTick(()=>{if(s=s||"",typeof s!="string")return r(e);let i=(fe.isPrototypePolluted()?"":fe.sanitizeShellString(s,!0)).trim();i?(ae||(ae=new Bt),ae.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{fe.noop()}t&&t(e),r(e)})):(t&&t(e),r(e))})})}Wt.dockerContainerProcesses=na;function Yp(s){let t=[];return new Promise(e=>{process.nextTick(()=>{ae||(ae=new Bt),ae.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)}})})})}Wt.dockerVolumes=Yp;function Xp(s){return new Promise(t=>{process.nextTick(()=>{li(!0).then(e=>{if(e&&Object.prototype.toString.call(e)==="[object Array]"&&e.length>0){let r=e.length;e.forEach(function(i){ci(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)})})})}Wt.dockerAll=Xp});var aa=ce(oa=>{"use strict";var ui=R("os"),Kp=R("child_process").exec,te=ue();function Zp(s){let t=[];return new Promise(e=>{process.nextTick(()=>{try{Kp(te.getVboxmanage()+" list vms --long",function(r,i){let n=(ui.EOL+i.toString()).split(ui.EOL+"Name:");n.shift(),n.forEach(o=>{let a=("Name:"+o).split(ui.EOL),l=te.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{te.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{te.noop()}t.push({id:te.getValue(a,"UUID"),name:te.getValue(a,"Name"),running:c,started:u,runningSince:p,stopped:f,stoppedSince:d,guestOS:te.getValue(a,"Guest OS"),hardwareUUID:te.getValue(a,"Hardware UUID"),memory:parseInt(te.getValue(a,"Memory size"," "),10),vram:parseInt(te.getValue(a,"VRAM size"),10),cpus:parseInt(te.getValue(a,"Number of CPUs"),10),cpuExepCap:te.getValue(a,"CPU exec cap"),cpuProfile:te.getValue(a,"CPUProfile"),chipset:te.getValue(a,"Chipset"),firmware:te.getValue(a,"Firmware"),pageFusion:te.getValue(a,"Page Fusion")==="enabled",configFile:te.getValue(a,"Config file"),snapshotFolder:te.getValue(a,"Snapshot folder"),logFolder:te.getValue(a,"Log folder"),hpet:te.getValue(a,"HPET")==="enabled",pae:te.getValue(a,"PAE")==="enabled",longMode:te.getValue(a,"Long Mode")==="enabled",tripleFaultReset:te.getValue(a,"Triple Fault Reset")==="enabled",apic:te.getValue(a,"APIC")==="enabled",x2Apic:te.getValue(a,"X2APIC")==="enabled",acpi:te.getValue(a,"ACPI")==="enabled",ioApic:te.getValue(a,"IOAPIC")==="enabled",biosApicMode:te.getValue(a,"BIOS APIC mode"),bootMenuMode:te.getValue(a,"Boot menu mode"),bootDevice1:te.getValue(a,"Boot Device 1"),bootDevice2:te.getValue(a,"Boot Device 2"),bootDevice3:te.getValue(a,"Boot Device 3"),bootDevice4:te.getValue(a,"Boot Device 4"),timeOffset:te.getValue(a,"Time offset"),rtc:te.getValue(a,"RTC")})}),s&&s(t),e(t)})}catch{s&&s(t),e(t)}})})}oa.vboxInfo=Zp});var pa=ce(ua=>{"use strict";var pi=R("child_process").exec,_e=ue(),Ut=process.platform,la=Ut==="linux"||Ut==="android",Jp=Ut==="darwin",Qp=Ut==="win32",ef=Ut==="freebsd",tf=Ut==="openbsd",sf=Ut==="netbsd",rf=Ut==="sunos",ca={1:"Other",2:"Unknown",3:"Idle",4:"Printing",5:"Warmup",6:"Stopped Printing",7:"Offline"};function nf(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 of(s){let t={},e=_e.getValue(s,"PrinterId"," ");return t.id=e?parseInt(e,10):null,t.name=_e.getValue(s,"Info"," "),t.model=s.length>0&&s[0]?s[0].split(" ")[0]:"",t.uri=_e.getValue(s,"DeviceURI"," "),t.uuid=_e.getValue(s,"UUID"," "),t.status=_e.getValue(s,"State"," "),t.local=_e.getValue(s,"Location"," ").toLowerCase().startsWith("local"),t.default=null,t.shared=_e.getValue(s,"Shared"," ").toLowerCase().startsWith("yes"),t}function af(s,t){let e={};return e.id=t,e.name=_e.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=_e.getValue(s,"Location",":",!0).toLowerCase().startsWith("local"),e.default=null,e.shared=_e.getValue(s,"Shared"," ").toLowerCase().startsWith("yes"),e}function lf(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 cf(s,t){let e={},r=parseInt(_e.getValue(s,"PrinterStatus",":"),10);return e.id=t,e.name=_e.getValue(s,"name",":"),e.model=_e.getValue(s,"DriverName",":"),e.uri=null,e.uuid=null,e.status=ca[r]?ca[r]:null,e.local=_e.getValue(s,"Local",":").toUpperCase()==="TRUE",e.default=_e.getValue(s,"Default",":").toUpperCase()==="TRUE",e.shared=_e.getValue(s,"Shared",":").toUpperCase()==="TRUE",e}function uf(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(la||ef||tf||sf){let r="cat /etc/cups/printers.conf 2>/dev/null";pi(r,function(i,n){if(!i){let o=n.toString().split("<Printer "),a=nf(o[0]);for(let l=1;l<o.length;l++){let c=of(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",pi(r,function(o,a){let l=(`
|
|
369
|
-
`+a.toString()).split(`
|
|
370
|
-
printer `);for(let c=1;c<l.length;c++){let u=af(l[c].split(`
|
|
371
|
-
`),c);e.push(u)}}),s&&s(e),t(e)):(s&&s(e),t(e))})}Jp&&pi("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=lf(o.SPPrintersDataType[a],a);e.push(l)}}catch{_e.noop()}s&&s(e),t(e)}),Qp&&_e.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=cf(n[o].split(`
|
|
372
|
-
`),o);(a.name||a.model)&&e.push(a)}}s&&s(e),t(e)}),rf&&t(null)})})}ua.printer=uf});var ma=ce(da=>{"use strict";var fa=R("child_process").exec,Ge=ue(),Gt=process.platform,pf=Gt==="linux"||Gt==="android",ff=Gt==="darwin",df=Gt==="win32",mf=Gt==="freebsd",hf=Gt==="openbsd",gf=Gt==="netbsd",yf=Gt==="sunos";function _f(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 Sf(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=Ge.getValue(e,"idVendor"," ",!0).trim(),i=r.split(" ");i.shift();let n=i.join(" "),o=Ge.getValue(e,"idProduct"," ",!0).trim(),a=o.split(" ");a.shift();let l=a.join(" "),u=Ge.getValue(e,"bInterfaceClass"," ",!0).trim().split(" ");u.shift();let p=u.join(" "),d=Ge.getValue(e,"iManufacturer"," ",!0).trim().split(" ");d.shift();let m=d.join(" "),_=Ge.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=_f(p,l),t.removable=null,t.vendor=n,t.manufacturer=m,t.maxPower=Ge.getValue(e,"MaxPower"," ",!0),t.serialNumber=h,t}function vf(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 xf(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=vf((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 wf(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 Cf(s,t){let e=wf(Ge.getValue(s,"CreationClassName",":").toLowerCase(),Ge.getValue(s,"name",":").toLowerCase());if(e){let r={};return r.bus=null,r.deviceId=Ge.getValue(s,"deviceid",":"),r.id=t,r.name=Ge.getValue(s,"name",":"),r.type=e,r.removable=null,r.vendor=null,r.manufacturer=Ge.getValue(s,"Manufacturer",":"),r.maxPower=null,r.serialNumber=null,r}else return null}function Of(s){return new Promise(t=>{process.nextTick(()=>{let e=[];pf&&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=Sf(o[a]);e.push(l)}}s&&s(e),t(e)}),ff&&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=xf(o[a]);l&&e.push(l)}s&&s(e),t(e)}s&&s(e),t(e)}),df&&Ge.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=Cf(n[o].split(`
|
|
380
|
-
`),o);a&&e.filter(l=>l.deviceId===a.deviceId).length===0&&e.push(a)}}s&&s(e),t(e)}),(yf||mf||hf||gf)&&t(null)})})}da.usb=Of});var ya=ce(ga=>{"use strict";var ha=R("child_process").exec,If=R("child_process").execSync,Le=ue(),jt=process.platform,Lf=jt==="linux"||jt==="android",Ef=jt==="darwin",Pf=jt==="win32",Tf=jt==="freebsd",Vf=jt==="openbsd",Nf=jt==="netbsd",Df=jt==="sunos";function fi(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 Af(){let s="lspci -v 2>/dev/null",t=[];try{return If(s,Le.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=Le.getValue(i,"Kernel driver in use",":",!0)||Le.getValue(i,"Kernel modules",":",!0),t.push(n)}}),t}catch{return t}}function bf(s,t){let e={},r=Le.getValue(s,"Slot"),i=t.filter(function(n){return n.slotId===r});return e.id=r,e.name=Le.getValue(s,"SDevice"),e.manufacturer=Le.getValue(s,"SVendor"),e.revision=Le.getValue(s,"Rev"),e.driver=i&&i.length===1&&i[0].driver?i[0].driver:"",e.default=null,e.channel="PCIe",e.type=fi(e.name,null,null),e.in=null,e.out=null,e.status="online",e}function Mf(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 Rf(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=Mf(r),e.type=fi(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 kf(s){let t={},e=Le.getValue(s,"StatusInfo",":");return t.id=Le.getValue(s,"DeviceID",":"),t.name=Le.getValue(s,"name",":"),t.manufacturer=Le.getValue(s,"manufacturer",":"),t.revision=null,t.driver=null,t.default=null,t.channel=null,t.type=fi(t.name,null,null),t.in=null,t.out=null,t.status=e,t}function Ff(s){return new Promise(t=>{process.nextTick(()=>{let e=[];(Lf||Tf||Vf||Nf)&&ha("lspci -vmm 2>/dev/null",function(i,n){if(!i){let o=Af();n.toString().split(`
|
|
384
|
-
|
|
385
|
-
`).forEach(l=>{let c=l.split(`
|
|
386
|
-
`);if(Le.getValue(c,"class",":",!0).toLowerCase().indexOf("audio")>=0){let u=bf(c,o);e.push(u)}})}s&&s(e),t(e)}),Ef&&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=Rf(o.SPAudioDataType[0]._items[a],a);e.push(l)}}catch{Le.noop()}s&&s(e),t(e)}),Pf&&Le.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
|
-
`);Le.getValue(a,"name",":")&&e.push(kf(a))}),s&&s(e),t(e)}),Df&&t(null)})})}ga.audio=Ff});var Sa=ce(_a=>{"use strict";var Bf=R("child_process").exec,Wf=R("child_process").execSync,Uf=R("path"),lt=ue(),Gf=R("fs"),zt=process.platform,jf=zt==="linux"||zt==="android",zf=zt==="darwin",qf=zt==="win32",Hf=zt==="freebsd",$f=zt==="openbsd",Yf=zt==="netbsd",Xf=zt==="sunos";function mi(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 Kf(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 Zf(s,t,e){let r={};return r.device=null,r.name=lt.getValue(s,"name","="),r.manufacturer=null,r.macDevice=t,r.macHost=e,r.batteryPercent=null,r.type=mi(r.name.toLowerCase()),r.connected=!1,r}function di(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||Kf(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=mi(r),e.connected=s.device_isconnected==="attrib_Yes"||!1,e}function Jf(s){let t={};return t.device=null,t.name=lt.getValue(s,"name",":"),t.manufacturer=lt.getValue(s,"manufacturer",":"),t.macDevice=null,t.macHost=null,t.batteryPercent=null,t.type=mi(t.name.toLowerCase()),t.connected=null,t}function Qf(s){return new Promise(t=>{process.nextTick(()=>{let e=[];if(jf){lt.getFilesInPath("/var/lib/bluetooth/").forEach(i=>{let n=Uf.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=Gf.readFileSync(i,{encoding:"utf8"}).split(`
|
|
388
|
-
`);e.push(Zf(c,a,l))}});try{let i=Wf("hcitool con",lt.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{lt.noop()}s&&s(e),t(e)}zf&&Bf("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=di(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=di(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=di(p,a);e.push(f)}})}}catch{lt.noop()}s&&s(e),t(e)}),qf&<.powerShell("Get-CimInstance Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl").then((r,i)=>{i||r.toString().split(/\n\s*\n/).forEach(o=>{lt.getValue(o.split(`
|
|
389
|
-
`),"PNPClass",":")==="Bluetooth"&&e.push(Jf(o.split(`
|
|
390
|
-
`)))}),s&&s(e),t(e)}),(Hf||Yf||$f||Xf)&&t(null)})})}_a.bluetoothDevices=Qf});var Ea=ce(k=>{"use strict";var ed=Fi().version,gs=ue(),qt=eo(),ct=so(),je=lo(),cn=So(),va=wo(),xa=Eo(),st=Do(),ut=Wo(),un=Ho(),wr=Xo(),wa=Jo(),hi=ta(),ys=ia(),td=aa(),sd=pa(),rd=ma(),nd=ya(),id=Sa(),Cr=process.platform,ln=Cr==="win32",Sr=Cr==="freebsd",vr=Cr==="openbsd",xr=Cr==="netbsd",tt=Cr==="sunos";ln&&gs.getCodepage();function Ca(){return ed}function Oa(s){return new Promise(t=>{process.nextTick(()=>{let e={};e.version=Ca(),Promise.all([qt.system(),qt.bios(),qt.baseboard(),qt.chassis(),ct.osInfo(),ct.uuid(),ct.versions(),je.cpu(),je.cpuFlags(),xa.graphics(),ut.networkInterfaces(),cn.memLayout(),st.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 gs.isFunction(t)&&(e=t,t=""),gs.isFunction(s)&&(e=s,s=""),new Promise(r=>{process.nextTick(()=>{t=t||ut.getDefaultNetworkInterface(),s=s||"";let i=function(){let o=15;return ln&&(o=13),(Sr||vr||xr)&&(o=11),tt&&(o=6),function(){--o===0&&(e&&e(n),r(n))}}(),n={};n.time=ct.time(),n.node=process.versions.node,n.v8=process.versions.v8,je.cpuCurrentSpeed().then(o=>{n.cpuCurrentSpeed=o,i()}),wa.users().then(o=>{n.users=o,i()}),wr.processes().then(o=>{n.processes=o,i()}),je.currentLoad().then(o=>{n.currentLoad=o,i()}),tt||je.cpuTemperature().then(o=>{n.temp=o,i()}),!vr&&!Sr&&!xr&&!tt&&ut.networkStats(t).then(o=>{n.networkStats=o,i()}),tt||ut.networkConnections().then(o=>{n.networkConnections=o,i()}),cn.mem().then(o=>{n.mem=o,i()}),tt||va().then(o=>{n.battery=o,i()}),tt||wr.services(s).then(o=>{n.services=o,i()}),tt||st.fsSize().then(o=>{n.fsSize=o,i()}),!ln&&!vr&&!Sr&&!xr&&!tt&&st.fsStats().then(o=>{n.fsStats=o,i()}),!ln&&!vr&&!Sr&&!xr&&!tt&&st.disksIO().then(o=>{n.disksIO=o,i()}),!vr&&!Sr&&!xr&&!tt&&un.wifiNetworks().then(o=>{n.wifiNetworks=o,i()}),hi.inetLatency().then(o=>{n.inetLatency=o,i()})})})}function od(s,t,e){return new Promise(r=>{process.nextTick(()=>{let i={};t&&gs.isFunction(t)&&!e&&(e=t,t=""),s&&gs.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(k,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?k[o](n):k[o]("")});Promise.all(r).then(i=>{let n={},o=0;for(let a in s)if({}.hasOwnProperty.call(s,a)&&{}.hasOwnProperty.call(k,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 ad(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)}k.version=Ca;k.system=qt.system;k.bios=qt.bios;k.baseboard=qt.baseboard;k.chassis=qt.chassis;k.time=ct.time;k.osInfo=ct.osInfo;k.versions=ct.versions;k.shell=ct.shell;k.uuid=ct.uuid;k.cpu=je.cpu;k.cpuFlags=je.cpuFlags;k.cpuCache=je.cpuCache;k.cpuCurrentSpeed=je.cpuCurrentSpeed;k.cpuTemperature=je.cpuTemperature;k.currentLoad=je.currentLoad;k.fullLoad=je.fullLoad;k.mem=cn.mem;k.memLayout=cn.memLayout;k.battery=va;k.graphics=xa.graphics;k.fsSize=st.fsSize;k.fsOpenFiles=st.fsOpenFiles;k.blockDevices=st.blockDevices;k.fsStats=st.fsStats;k.disksIO=st.disksIO;k.diskLayout=st.diskLayout;k.networkInterfaceDefault=ut.networkInterfaceDefault;k.networkGatewayDefault=ut.networkGatewayDefault;k.networkInterfaces=ut.networkInterfaces;k.networkStats=ut.networkStats;k.networkConnections=ut.networkConnections;k.wifiNetworks=un.wifiNetworks;k.wifiInterfaces=un.wifiInterfaces;k.wifiConnections=un.wifiConnections;k.services=wr.services;k.processes=wr.processes;k.processLoad=wr.processLoad;k.users=wa.users;k.inetChecksite=hi.inetChecksite;k.inetLatency=hi.inetLatency;k.dockerInfo=ys.dockerInfo;k.dockerImages=ys.dockerImages;k.dockerContainers=ys.dockerContainers;k.dockerContainerStats=ys.dockerContainerStats;k.dockerContainerProcesses=ys.dockerContainerProcesses;k.dockerVolumes=ys.dockerVolumes;k.dockerAll=ys.dockerAll;k.vboxInfo=td.vboxInfo;k.printer=sd.printer;k.usb=rd.usb;k.audio=nd.audio;k.bluetoothDevices=id.bluetoothDevices;k.getStaticData=Oa;k.getDynamicData=Ia;k.getAllData=od;k.get=La;k.observe=ad;k.powerShellStart=gs.powerShellStart;k.powerShellRelease=gs.powerShellRelease});var Ta=ce((gm,ld)=>{ld.exports={name:"dotenv",version:"16.4.5",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","lint-readme":"standard-markdown",pretest:"npm run lint && npm run dts-check",test:"tap tests/*.js --100 -Rspec","test:coverage":"tap --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:{"@definitelytyped/dtslint":"^0.0.133","@types/node":"^18.11.3",decache:"^4.6.1",sinon:"^14.0.1",standard:"^17.0.0","standard-markdown":"^7.1.0","standard-version":"^9.5.0",tap:"^16.3.0",tar:"^6.1.11",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var Aa=ce((ym,pt)=>{var gi=R("fs"),yi=R("path"),cd=R("os"),ud=R("crypto"),pd=Ta(),_i=pd.version,fd=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function dd(s){let t={},e=s.toString();e=e.replace(/\r\n?/mg,`
|
|
391
|
-
`);let r;for(;(r=fd.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 md(s){let t=Da(s),e=ye.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=yd(e,a);n=ye.decrypt(l.ciphertext,l.key);break}catch(a){if(o+1>=i)throw a}return ye.parse(n)}function hd(s){console.log(`[dotenv@${_i}][INFO] ${s}`)}function gd(s){console.log(`[dotenv@${_i}][WARN] ${s}`)}function fn(s){console.log(`[dotenv@${_i}][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 yd(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)gi.existsSync(e)&&(t=e.endsWith(".vault")?e:`${e}.vault`);else t=s.path.endsWith(".vault")?s.path:`${s.path}.vault`;else t=yi.resolve(process.cwd(),".env.vault");return gi.existsSync(t)?t:null}function Va(s){return s[0]==="~"?yi.join(cd.homedir(),s.slice(1)):s}function _d(s){hd("Loading env from encrypted .env.vault");let t=ye._parseVault(s),e=process.env;return s&&s.processEnv!=null&&(e=s.processEnv),ye.populate(e,t,s),{parsed:t}}function Sd(s){let t=yi.resolve(process.cwd(),".env"),e="utf8",r=!!(s&&s.debug);s&&s.encoding?e=s.encoding:r&&fn("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=ye.parse(gi.readFileSync(l,{encoding:e}));ye.populate(o,c,s)}catch(c){r&&fn(`Failed to load ${l} ${c.message}`),n=c}let a=process.env;return s&&s.processEnv!=null&&(a=s.processEnv),ye.populate(a,o,s),n?{parsed:o,error:n}:{parsed:o}}function vd(s){if(Na(s).length===0)return ye.configDotenv(s);let t=Da(s);return t?ye._configVault(s):(gd(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),ye.configDotenv(s))}function xd(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=ud.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 wd(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&&fn(i===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):s[n]=t[n]}var ye={configDotenv:Sd,_configVault:_d,_parseVault:md,config:vd,decrypt:xd,parse:dd,populate:wd};pt.exports.configDotenv=ye.configDotenv;pt.exports._configVault=ye._configVault;pt.exports._parseVault=ye._parseVault;pt.exports.config=ye.config;pt.exports.decrypt=ye.decrypt;pt.exports.parse=ye.parse;pt.exports.populate=ye.populate;pt.exports=ye});var se;(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})(se||(se={}));var hn;(function(s){s.mergeShapes=(t,e)=>({...t,...e})})(hn||(hn={}));var M=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ft=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=se.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"]),Ua=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:"),Ve=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,se.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()}};Ve.create=s=>new Ve(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,se.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:e=`Unrecognized key(s) in object: ${se.joinValues(s.keys,", ")}`;break;case L.invalid_union:e="Invalid input";break;case L.invalid_union_discriminator:e=`Invalid discriminator value. Expected ${se.joinValues(s.options)}`;break;case L.invalid_enum_value:e=`Invalid enum value. Expected ${se.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}"`:se.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,se.assertNever(s)}return{message:e}},Oi=vs;function Ga(s){Oi=s}function Ir(){return Oi}var Lr=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}},ja=[];function A(s,t){let e=Ir(),r=Lr({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 xe=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 H;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 H;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}}},H=Object.freeze({status:"aborted"}),Ss=s=>({status:"dirty",value:s}),Oe=s=>({status:"valid",value:s}),gn=s=>s.status==="aborted",yn=s=>s.status==="dirty",qs=s=>s.status==="valid",Hs=s=>typeof Promise<"u"&&s instanceof Promise;function Er(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 F;(function(s){s.errToObj=t=>typeof t=="string"?{message:t}:t||{},s.toString=t=>typeof t=="string"?t:t?.message})(F||(F={}));var js,zs,Me=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(qs(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 Ve(s.common.issues);return this._error=e,this._error}}};function Y(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 X=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 ft(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:ft(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new xe,ctx:{common:t.parent.common,data:t.data,parsedType:ft(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(Hs(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:ft(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:ft(t)},i=this._parse({data:t,path:r.path,parent:r}),n=await(Hs(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 Ne({schema:this,typeName:q.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return be.create(this,this._def)}nullable(){return Ke.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return it.create(this,this._def)}promise(){return ht.create(this,this._def)}or(t){return Jt.create([this,t],this._def)}and(t){return Qt.create(this,t,this._def)}transform(t){return new Ne({...Y(this._def),schema:this,typeName:q.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new ns({...Y(this._def),innerType:this,defaultValue:e,typeName:q.ZodDefault})}brand(){return new $s({typeName:q.ZodBranded,type:this,...Y(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new is({...Y(this._def),innerType:this,catchValue:e,typeName:q.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return Ys.create(this,t)}readonly(){return os.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},za=/^c[^\s-]{8,}$/i,qa=/^[0-9a-z]+$/,Ha=/^[0-9A-HJKMNP-TV-Z]{26}$/,$a=/^[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,Ya=/^[a-z0-9_-]{21}$/i,Xa=/^[-+]?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)?)??$/,Ka=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Za="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",mn,Ja=/^(?:(?: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])$/,Qa=/^(([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})))$/,el=/^([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])))",tl=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 sl(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 rl(s,t){return!!((t==="v4"||!t)&&Ja.test(s)||(t==="v6"||!t)&&Qa.test(s))}var dt=class s extends X{_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}),H}let r=new xe,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")Ka.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")mn||(mn=new RegExp(Za,"u")),mn.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")$a.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")Ya.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")za.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")qa.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")Ha.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"?tl.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{code:L.invalid_string,validation:"date",message:n.message}),r.dirty()):n.kind==="time"?sl(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"?Xa.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"duration",code:L.invalid_string,message:n.message}),r.dirty()):n.kind==="ip"?rl(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"?el.test(t.data)||(i=this._getOrReturnCtx(t,i),A(i,{validation:"base64",code:L.invalid_string,message:n.message}),r.dirty()):se.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,...F.errToObj(r)})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...F.errToObj(t)})}url(t){return this._addCheck({kind:"url",...F.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...F.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...F.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...F.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...F.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...F.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...F.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...F.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...F.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,...F.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,...F.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...F.errToObj(t)})}regex(t,e){return this._addCheck({kind:"regex",regex:t,...F.errToObj(e)})}includes(t,e){return this._addCheck({kind:"includes",value:t,position:e?.position,...F.errToObj(e?.message)})}startsWith(t,e){return this._addCheck({kind:"startsWith",value:t,...F.errToObj(e)})}endsWith(t,e){return this._addCheck({kind:"endsWith",value:t,...F.errToObj(e)})}min(t,e){return this._addCheck({kind:"min",value:t,...F.errToObj(e)})}max(t,e){return this._addCheck({kind:"max",value:t,...F.errToObj(e)})}length(t,e){return this._addCheck({kind:"length",value:t,...F.errToObj(e)})}nonempty(t){return this.min(1,F.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}};dt.create=s=>{var t;return new dt({checks:[],typeName:q.ZodString,coerce:(t=s?.coerce)!==null&&t!==void 0?t:!1,...Y(s)})};function nl(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 Ht=class s extends X{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}),H}let r,i=new xe;for(let n of this._def.checks)n.kind==="int"?se.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"?nl(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()):se.assertNever(n);return{status:i.value,value:t.data}}gte(t,e){return this.setLimit("min",t,!0,F.toString(e))}gt(t,e){return this.setLimit("min",t,!1,F.toString(e))}lte(t,e){return this.setLimit("max",t,!0,F.toString(e))}lt(t,e){return this.setLimit("max",t,!1,F.toString(e))}setLimit(t,e,r,i){return new s({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:F.toString(i)}]})}_addCheck(t){return new s({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:F.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:F.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:F.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:F.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:F.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:F.toString(e)})}finite(t){return this._addCheck({kind:"finite",message:F.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:F.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:F.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"&&se.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)}};Ht.create=s=>new Ht({checks:[],typeName:q.ZodNumber,coerce:s?.coerce||!1,...Y(s)});var $t=class s extends X{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}),H}let r,i=new xe;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()):se.assertNever(n);return{status:i.value,value:t.data}}gte(t,e){return this.setLimit("min",t,!0,F.toString(e))}gt(t,e){return this.setLimit("min",t,!1,F.toString(e))}lte(t,e){return this.setLimit("max",t,!0,F.toString(e))}lt(t,e){return this.setLimit("max",t,!1,F.toString(e))}setLimit(t,e,r,i){return new s({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:F.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:F.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:F.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:F.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:F.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:F.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}};$t.create=s=>{var t;return new $t({checks:[],typeName:q.ZodBigInt,coerce:(t=s?.coerce)!==null&&t!==void 0?t:!1,...Y(s)})};var Yt=class extends X{_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}),H}return Oe(t.data)}};Yt.create=s=>new Yt({typeName:q.ZodBoolean,coerce:s?.coerce||!1,...Y(s)});var Xt=class s extends X{_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}),H}if(isNaN(t.data.getTime())){let n=this._getOrReturnCtx(t);return A(n,{code:L.invalid_date}),H}let r=new xe,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()):se.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:F.toString(e)})}max(t,e){return this._addCheck({kind:"max",value:t.getTime(),message:F.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}};Xt.create=s=>new Xt({checks:[],coerce:s?.coerce||!1,typeName:q.ZodDate,...Y(s)});var xs=class extends X{_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}),H}return Oe(t.data)}};xs.create=s=>new xs({typeName:q.ZodSymbol,...Y(s)});var Kt=class extends X{_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}),H}return Oe(t.data)}};Kt.create=s=>new Kt({typeName:q.ZodUndefined,...Y(s)});var Zt=class extends X{_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}),H}return Oe(t.data)}};Zt.create=s=>new Zt({typeName:q.ZodNull,...Y(s)});var mt=class extends X{constructor(){super(...arguments),this._any=!0}_parse(t){return Oe(t.data)}};mt.create=s=>new mt({typeName:q.ZodAny,...Y(s)});var nt=class extends X{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Oe(t.data)}};nt.create=s=>new nt({typeName:q.ZodUnknown,...Y(s)});var ze=class extends X{_parse(t){let e=this._getOrReturnCtx(t);return A(e,{code:L.invalid_type,expected:M.never,received:e.parsedType}),H}};ze.create=s=>new ze({typeName:q.ZodNever,...Y(s)});var ws=class extends X{_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}),H}return Oe(t.data)}};ws.create=s=>new ws({typeName:q.ZodVoid,...Y(s)});var it=class s extends X{_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}),H;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 Me(e,o,e.path,a)))).then(o=>xe.mergeArray(r,o));let n=[...e.data].map((o,a)=>i.type._parseSync(new Me(e,o,e.path,a)));return xe.mergeArray(r,n)}get element(){return this._def.type}min(t,e){return new s({...this._def,minLength:{value:t,message:F.toString(e)}})}max(t,e){return new s({...this._def,maxLength:{value:t,message:F.toString(e)}})}length(t,e){return new s({...this._def,exactLength:{value:t,message:F.toString(e)}})}nonempty(t){return this.min(1,t)}};it.create=(s,t)=>new it({type:s,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...Y(t)});function _s(s){if(s instanceof Ee){let t={};for(let e in s.shape){let r=s.shape[e];t[e]=be.create(_s(r))}return new Ee({...s._def,shape:()=>t})}else return s instanceof it?new it({...s._def,type:_s(s.element)}):s instanceof be?be.create(_s(s.unwrap())):s instanceof Ke?Ke.create(_s(s.unwrap())):s instanceof Xe?Xe.create(s.items.map(t=>_s(t))):s}var Ee=class s extends X{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=se.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}),H}let{status:r,ctx:i}=this._processInputParams(t),{shape:n,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof ze&&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 Me(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof ze){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 Me(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=>xe.mergeObjectSync(r,c)):xe.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return F.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=F.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:q.ZodObject})}setKey(t,e){return this.augment({[t]:e})}catchall(t){return new s({...this._def,catchall:t})}pick(t){let e={};return se.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 se.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 se.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 se.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])e[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof be;)n=n._def.innerType;e[r]=n}}),new s({...this._def,shape:()=>e})}keyof(){return Ti(se.objectKeys(this.shape))}};Ee.create=(s,t)=>new Ee({shape:()=>s,unknownKeys:"strip",catchall:ze.create(),typeName:q.ZodObject,...Y(t)});Ee.strictCreate=(s,t)=>new Ee({shape:()=>s,unknownKeys:"strict",catchall:ze.create(),typeName:q.ZodObject,...Y(t)});Ee.lazycreate=(s,t)=>new Ee({shape:s,unknownKeys:"strip",catchall:ze.create(),typeName:q.ZodObject,...Y(t)});var Jt=class extends X{_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 Ve(a.ctx.common.issues));return A(e,{code:L.invalid_union,unionErrors:o}),H}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 Ve(l));return A(e,{code:L.invalid_union,unionErrors:a}),H}}get options(){return this._def.options}};Jt.create=(s,t)=>new Jt({options:s,typeName:q.ZodUnion,...Y(t)});var rt=s=>s instanceof es?rt(s.schema):s instanceof Ne?rt(s.innerType()):s instanceof ts?[s.value]:s instanceof ss?s.options:s instanceof rs?se.objectValues(s.enum):s instanceof ns?rt(s._def.innerType):s instanceof Kt?[void 0]:s instanceof Zt?[null]:s instanceof be?[void 0,...rt(s.unwrap())]:s instanceof Ke?[null,...rt(s.unwrap())]:s instanceof $s||s instanceof os?rt(s.unwrap()):s instanceof is?rt(s._def.innerType):[],Pr=class s extends X{_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}),H;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]}),H)}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=rt(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:q.ZodDiscriminatedUnion,discriminator:t,options:e,optionsMap:i,...Y(r)})}};function _n(s,t){let e=ft(s),r=ft(t);if(s===t)return{valid:!0,data:s};if(e===M.object&&r===M.object){let i=se.objectKeys(t),n=se.objectKeys(s).filter(a=>i.indexOf(a)!==-1),o={...s,...t};for(let a of n){let l=_n(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=_n(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 Qt=class extends X{_parse(t){let{status:e,ctx:r}=this._processInputParams(t),i=(n,o)=>{if(gn(n)||gn(o))return H;let a=_n(n.value,o.value);return a.valid?((yn(n)||yn(o))&&e.dirty(),{status:e.value,value:a.data}):(A(r,{code:L.invalid_intersection_types}),H)};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}))}};Qt.create=(s,t,e)=>new Qt({left:s,right:t,typeName:q.ZodIntersection,...Y(e)});var Xe=class s extends X{_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}),H;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"}),H;!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 Me(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(n).then(o=>xe.mergeArray(e,o)):xe.mergeArray(e,n)}get items(){return this._def.items}rest(t){return new s({...this._def,rest:t})}};Xe.create=(s,t)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xe({items:s,typeName:q.ZodTuple,rest:null,...Y(t)})};var Tr=class s extends X{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}),H;let i=[],n=this._def.keyType,o=this._def.valueType;for(let a in r.data)i.push({key:n._parse(new Me(r,a,r.path,a)),value:o._parse(new Me(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?xe.mergeObjectAsync(e,i):xe.mergeObjectSync(e,i)}get element(){return this._def.valueType}static create(t,e,r){return e instanceof X?new s({keyType:t,valueType:e,typeName:q.ZodRecord,...Y(r)}):new s({keyType:dt.create(),valueType:t,typeName:q.ZodRecord,...Y(e)})}},Cs=class extends X{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}),H;let i=this._def.keyType,n=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new Me(r,a,r.path,[c,"key"])),value:n._parse(new Me(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 H;(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 H;(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:q.ZodMap,...Y(e)});var Os=class s extends X{_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}),H;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 H;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 Me(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:F.toString(e)}})}max(t,e){return new s({...this._def,maxSize:{value:t,message:F.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:q.ZodSet,...Y(t)});var Vr=class s extends X{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}),H;function r(a,l){return Lr({data:a,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Ir(),vs].filter(c=>!!c),issueData:{code:L.invalid_arguments,argumentsError:l}})}function i(a,l){return Lr({data:a,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Ir(),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 ht){let a=this;return Oe(async function(...l){let c=new Ve([]),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 Oe(function(...l){let c=a._def.args.safeParse(l,n);if(!c.success)throw new Ve([r(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(u,n);if(!p.success)throw new Ve([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:Xe.create(t).rest(nt.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||Xe.create([]).rest(nt.create()),returns:e||nt.create(),typeName:q.ZodFunction,...Y(r)})}},es=class extends X{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})}};es.create=(s,t)=>new es({getter:s,typeName:q.ZodLazy,...Y(t)});var ts=class extends X{_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}),H}return{status:"valid",value:t.data}}get value(){return this._def.value}};ts.create=(s,t)=>new ts({value:s,typeName:q.ZodLiteral,...Y(t)});function Ti(s,t){return new ss({values:s,typeName:q.ZodEnum,...Y(t)})}var ss=class s extends X{constructor(){super(...arguments),js.set(this,void 0)}_parse(t){if(typeof t.data!="string"){let e=this._getOrReturnCtx(t),r=this._def.values;return A(e,{expected:se.joinValues(r),received:e.parsedType,code:L.invalid_type}),H}if(Er(this,js,"f")||Ii(this,js,new Set(this._def.values),"f"),!Er(this,js,"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}),H}return Oe(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})}};js=new WeakMap;ss.create=Ti;var rs=class extends X{constructor(){super(...arguments),zs.set(this,void 0)}_parse(t){let e=se.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==M.string&&r.parsedType!==M.number){let i=se.objectValues(e);return A(r,{expected:se.joinValues(i),received:r.parsedType,code:L.invalid_type}),H}if(Er(this,zs,"f")||Ii(this,zs,new Set(se.getValidEnumValues(this._def.values)),"f"),!Er(this,zs,"f").has(t.data)){let i=se.objectValues(e);return A(r,{received:r.data,code:L.invalid_enum_value,options:i}),H}return Oe(t.data)}get enum(){return this._def.values}};zs=new WeakMap;rs.create=(s,t)=>new rs({values:s,typeName:q.ZodNativeEnum,...Y(t)});var ht=class extends X{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}),H;let r=e.parsedType===M.promise?e.data:Promise.resolve(e.data);return Oe(r.then(i=>this._def.type.parseAsync(i,{path:e.path,errorMap:e.common.contextualErrorMap})))}};ht.create=(s,t)=>new ht({type:s,typeName:q.ZodPromise,...Y(t)});var Ne=class extends X{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.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 H;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?H:l.status==="dirty"||e.value==="dirty"?Ss(l.value):l});{if(e.value==="aborted")return H;let a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?H: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"?H:(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"?H:(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(!qs(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=>qs(o)?Promise.resolve(i.transform(o.value,n)).then(a=>({status:e.value,value:a})):o);se.assertNever(i)}};Ne.create=(s,t,e)=>new Ne({schema:s,typeName:q.ZodEffects,effect:t,...Y(e)});Ne.createWithPreprocess=(s,t,e)=>new Ne({schema:t,effect:{type:"preprocess",transform:s},typeName:q.ZodEffects,...Y(e)});var be=class extends X{_parse(t){return this._getType(t)===M.undefined?Oe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};be.create=(s,t)=>new be({innerType:s,typeName:q.ZodOptional,...Y(t)});var Ke=class extends X{_parse(t){return this._getType(t)===M.null?Oe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ke.create=(s,t)=>new Ke({innerType:s,typeName:q.ZodNullable,...Y(t)});var ns=class extends X{_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}};ns.create=(s,t)=>new ns({innerType:s,typeName:q.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Y(t)});var is=class extends X{_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 Hs(i)?i.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ve(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ve(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};is.create=(s,t)=>new is({innerType:s,typeName:q.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Y(t)});var Is=class extends X{_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}),H}return{status:"valid",value:t.data}}};Is.create=s=>new Is({typeName:q.ZodNaN,...Y(s)});var il=Symbol("zod_brand"),$s=class extends X{_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}},Ys=class s extends X{_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"?H: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"?H: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:q.ZodPipeline})}},os=class extends X{_parse(t){let e=this._def.innerType._parse(t),r=i=>(qs(i)&&(i.value=Object.freeze(i.value)),i);return Hs(e)?e.then(i=>r(i)):r(e)}unwrap(){return this._def.innerType}};os.create=(s,t)=>new os({innerType:s,typeName:q.ZodReadonly,...Y(t)});function Vi(s,t={},e){return s?mt.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})}}):mt.create()}var ol={object:Ee.lazycreate},q;(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"})(q||(q={}));var al=(s,t={message:`Input not instance of ${s.name}`})=>Vi(e=>e instanceof s,t),Ni=dt.create,Di=Ht.create,ll=Is.create,cl=$t.create,Ai=Yt.create,ul=Xt.create,pl=xs.create,fl=Kt.create,dl=Zt.create,ml=mt.create,hl=nt.create,gl=ze.create,yl=ws.create,_l=it.create,Xs=Ee.create,Sl=Ee.strictCreate,vl=Jt.create,xl=Pr.create,wl=Qt.create,Cl=Xe.create,Ol=Tr.create,Il=Cs.create,Ll=Os.create,El=Vr.create,Pl=es.create,Tl=ts.create,Vl=ss.create,Nl=rs.create,Dl=ht.create,Ci=Ne.create,Al=be.create,bl=Ke.create,Ml=Ne.createWithPreprocess,Rl=Ys.create,kl=()=>Ni().optional(),Fl=()=>Di().optional(),Bl=()=>Ai().optional(),Wl={string:s=>dt.create({...s,coerce:!0}),number:s=>Ht.create({...s,coerce:!0}),boolean:s=>Yt.create({...s,coerce:!0}),bigint:s=>$t.create({...s,coerce:!0}),date:s=>Xt.create({...s,coerce:!0})},Ul=H,Ks=Object.freeze({__proto__:null,defaultErrorMap:vs,setErrorMap:Ga,getErrorMap:Ir,makeIssue:Lr,EMPTY_PATH:ja,addIssueToContext:A,ParseStatus:xe,INVALID:H,DIRTY:Ss,OK:Oe,isAborted:gn,isDirty:yn,isValid:qs,isAsync:Hs,get util(){return se},get objectUtil(){return hn},ZodParsedType:M,getParsedType:ft,ZodType:X,datetimeRegex:Pi,ZodString:dt,ZodNumber:Ht,ZodBigInt:$t,ZodBoolean:Yt,ZodDate:Xt,ZodSymbol:xs,ZodUndefined:Kt,ZodNull:Zt,ZodAny:mt,ZodUnknown:nt,ZodNever:ze,ZodVoid:ws,ZodArray:it,ZodObject:Ee,ZodUnion:Jt,ZodDiscriminatedUnion:Pr,ZodIntersection:Qt,ZodTuple:Xe,ZodRecord:Tr,ZodMap:Cs,ZodSet:Os,ZodFunction:Vr,ZodLazy:es,ZodLiteral:ts,ZodEnum:ss,ZodNativeEnum:rs,ZodPromise:ht,ZodEffects:Ne,ZodTransformer:Ne,ZodOptional:be,ZodNullable:Ke,ZodDefault:ns,ZodCatch:is,ZodNaN:Is,BRAND:il,ZodBranded:$s,ZodPipeline:Ys,ZodReadonly:os,custom:Vi,Schema:X,ZodSchema:X,late:ol,get ZodFirstPartyTypeKind(){return q},coerce:Wl,any:ml,array:_l,bigint:cl,boolean:Ai,date:ul,discriminatedUnion:xl,effect:Ci,enum:Vl,function:El,instanceof:al,intersection:wl,lazy:Pl,literal:Tl,map:Il,nan:ll,nativeEnum:Nl,never:gl,null:dl,nullable:bl,number:Di,object:Xs,oboolean:Bl,onumber:Fl,optional:Al,ostring:kl,pipeline:Rl,preprocess:Ml,promise:Dl,record:Ol,set:Ll,strictObject:Sl,string:Ni,symbol:pl,transformer:Ci,tuple:Cl,undefined:fl,union:vl,unknown:hl,void:yl,NEVER:Ul,ZodIssueCode:L,quotelessJson:Ua,ZodError:Ve});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=Xs(i),l=Xs(n),c=Xs(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 Gl=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:Ks.enum(["prod","prod-cn","staging","staging-cn","dev","local"]).default(s),CONNECT_API_BASE_URL:Ks.string().url(),CANVA_ENV_URL:Ks.string().url(),CANVA_CLI_CLIENT_ID:Ks.enum(["OC-AZICxlGo2biD","OC-AZN2AS1hKtVM","OC-AZH-EOTpT8Ib","OC-AZNlOhtxI_Zb","OC-AZFEJKOjQYw3","FAKE_CLIENT_ID"]).default("OC-AZICxlGo2biD")},runtimeEnv:Gl(Mi({fallback:s})),emptyStringAsUndefined:!0});var Nr=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 Pa=xi(Ea(),1);import Or from"crypto";var pn=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 Or.pbkdf2Sync(t,e,this.KEY_DERIVATION_ITERATIONS,this.KEY_LENGTH,"sha256")}async encrypt(t){try{let e=await this.generateMachineId(),r=Or.randomBytes(16),i=this.deriveKeyFromMachineId(e,r),n=Or.randomBytes(12),o=Or.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=Or.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=xi(Aa(),1);import Cd from"fs/promises";import Od from"os";import Id from"path";var dn=class{constructor(t,e=Cd,r=Id,i=Od.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=ba.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 Ld=Ri({fallback:"prod"}),Ed=new pn,Pd=new dn(Ed),Td=new Nr(Pd,Ld),Tm=()=>Td.generatePreviewResult();export{Tm as generatePreviewUrl};
|