diff --git a/Gruntfile.js b/Gruntfile.js index 8a82bc2..453dbd6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -171,9 +171,19 @@ module.exports = function(grunt) { } else { version = guiEasy.major + '.' + guiEasy.minor + '.' + guiEasy.minimal; } + let semVer = guiEasy.major + '.' + guiEasy.minor + '.' + guiEasy.minimal; + + let packageJSON = grunt.file.read('package.json'); + packageJSON = JSON.parse(packageJSON); + packageJSON.version = guiEasy.major + '.' + guiEasy.minor + '.' + guiEasy.minimal; + packageJSON.bin["index.html.gz"] = "build/" + version + "/"; + grunt.file.write('package.json', + JSON.stringify(packageJSON,null,2) + ); grunt.log.ok(version); // add version as a property for the grunt ini loop grunt.config("version", version); + grunt.config("semVer", semVer); grunt.task.run( 'clean', 'uglify', diff --git a/build/0.0.nightly.1/gui.min.js b/build/0.0.nightly.1/gui.min.js index c069c4f..00aa52c 100644 --- a/build/0.0.nightly.1/gui.min.js +++ b/build/0.0.nightly.1/gui.min.js @@ -1 +1 @@ -/* GUIEasy Copyright (C) 2019-2019 Jimmy "Grovkillen" Westberg */const guiEasy={logLevel:0,name:"GUI Easy",version:{major:0,minor:0,minimal:1,development:!0,releaseCandidate:0,full:function(){let e=guiEasy.version;return!0===e.development&&e.releaseCandidate>0?e.major+"."+e.minor+".rc"+e.releaseCandidate+"."+e.minimal:!0===e.development?e.major+"."+e.minor+".nightly."+e.minimal:e.major+"."+e.minor+"."+e.minimal}},geekName:function(){return guiEasy.name.replace(" ","-").toLowerCase()},geekNameFull:function(){return guiEasy.geekName()+"-"+guiEasy.version.full()},current:{},fetchSettings:{maxToKeep:5,minToKeep:1,intervalGUIupdater:1e3,intervalTimeKeeper:700,maxToKeepMs:function(){return 6e4/guiEasy.intervalGUIupdater}},nodes:[],startup:[{id:"curly",logText:"HTML build up"},{id:"scrubber",logText:"HTML scrubbing"},{id:"popper",logText:"Adding event handlers"},{id:"pitcher",logText:"Getting data from unit plus setting up user preferences"}],silentStartup:[{id:"butler",logText:"Fetching stuff from internet"},{id:"tender",logText:"The relay runner is being triggered"}],endpoints:{defaultTTL:function(){return 6e4},get:[{endpoint:"json",ttl_fallback:2e3},{endpoint:"buildinfo",ttl_fallback:99999999},{endpoint:"logjson"},{endpoint:"sysinfo_json"},{endpoint:"node_list_json"},{endpoint:"filelist_json"},{endpoint:"i2cscanner_json"},{endpoint:"pinstates_json"},{endpoint:"timingstats_json",ttl_fallback:999999},{endpoint:"wifiscanner_json"}],post:[{endpoint:"factoryreset_json"},{endpoint:"upload_json"}]},fetchingWait:"Fetching not yet completed, please wait...",maxTasks:function(e="ESP82XX"){return"ESP82XX"===e?12:"ESP32"===e?48:void 0},maxValuesPerTask:function(e="ESP82XX"){return"ESP82XX"===e?4:"ESP32"===e?8:void 0},maxNotification:function(e="ESP82XX"){return"ESP82XX"===e?3:"ESP32"===e?3:void 0},maxController:function(e="ESP82XX"){return"ESP82XX"===e?3:"ESP32"===e?3:void 0},maxPluginConfigVar:function(e="ESP82XX"){return"ESP82XX"===e?8:"ESP32"===e?8:void 0},maxPluginConfigFloatVar:function(e="ESP82XX"){return"ESP82XX"===e?4:"ESP32"===e?4:void 0},maxPluginConfigLongVar:function(e="ESP82XX"){return"ESP82XX"===e?4:"ESP32"===e?4:void 0},maxPluginExtraConfigVar:function(e="ESP82XX"){return"ESP82XX"===e?16:"ESP32"===e?16:void 0},maxFormulaLength:function(e="ESP82XX"){return"ESP82XX"===e?40:"ESP32"===e?40:void 0},timelist:{week:[{text:"Last",value:0,disabled:!1,note:""},{text:"1st",value:1,disabled:!1,note:""},{text:"2nd",value:2,disabled:!1,note:""},{text:"3rd",value:3,disabled:!1,note:""},{text:"4th",value:4,disabled:!1,note:""}],day:[{text:"Monday",value:1,disabled:!1,note:""},{text:"Tuesday",value:2,disabled:!1,note:""},{text:"Wednesday",value:3,disabled:!1,note:""},{text:"Thursday",value:4,disabled:!1,note:""},{text:"Friday",value:5,disabled:!1,note:""},{text:"Saturday",value:6,disabled:!1,note:""},{text:"Sunday",value:7,disabled:!1,note:""}],month:[{text:"January",value:1,disabled:!1,note:""},{text:"February",value:2,disabled:!1,note:""},{text:"Mars",value:3,disabled:!1,note:""},{text:"April",value:4,disabled:!1,note:""},{text:"May",value:5,disabled:!1,note:""},{text:"June",value:6,disabled:!1,note:""},{text:"July",value:7,disabled:!1,note:""},{text:"August",value:8,disabled:!1,note:""},{text:"September",value:9,disabled:!1,note:""},{text:"October",value:10,disabled:!1,note:""},{text:"November",value:11,disabled:!1,note:""},{text:"December",value:12,disabled:!1,note:""}]},gpiolist:function(e="ESP82XX"){return"ESP82XX"===e?[{text:"- None -",value:-1,disabled:!1,note:""},{text:"GPIO 0 (D3)",value:0,disabled:!1,note:"⚠"},{text:"GPIO 1 (D10)",value:1,disabled:!0,note:"Tx0"},{text:"GPIO 2 (D4)",value:2,disabled:!1,note:"⚠"},{text:"GPIO 3 (D9)",value:3,disabled:!0,note:"Rx0"},{text:"GPIO 4 (D2)",value:4,disabled:!1,note:""},{text:"GPIO 5 (D1)",value:5,disabled:!1,note:""},{text:"GPIO 9 (D11)",value:9,disabled:!1,note:"⚠"},{text:"GPIO 10 (D10)",value:10,disabled:!1,note:"⚠"},{text:"GPIO 12 (D12)",value:12,disabled:!1,note:""},{text:"GPIO 13 (D13)",value:13,disabled:!1,note:""},{text:"GPIO 14 (D14)",value:14,disabled:!1,note:""},{text:"GPIO 15 (D15)",value:15,disabled:!1,note:"⚠"},{text:"GPIO 16 (D16)",value:16,disabled:!1,note:""}]:"ESP32"===e?null:void 0},tabs:{left:["main","config","hardware","devices"],right:["controllers","notification","tools","rules"]},guiStats:{pageSize:0,bootTime:0,eventCalls:0,eventCallsTotal:0},syntax:{curlyLC:0,curly:["fetching","input","table","goto","button","version","devicetable","controllertable","notificationtable","setup","notifier","drawer","navbar","unit","unitname","modal","menu","wave","page","logo","icon"]},configDat:{}};guiEasy.configDat.configDatParseConfig=[{prop:"status.PID",type:"int32"},{prop:"status.version",type:"int32"},{prop:"status.build",type:"int16"},{prop:"config.IP.ip",type:"bytes",length:4},{prop:"config.IP.gw",type:"bytes",length:4},{prop:"config.IP.subnet",type:"bytes",length:4},{prop:"config.IP.dns",type:"bytes",length:4},{prop:"config.experimental.ip_octet",type:"byte"},{prop:"config.general.unitnr",type:"byte"},{prop:"config.general.unitname",type:"string",length:26},{prop:"config.ntp.host",type:"string",length:64},{prop:"config.sleep.sleeptime",type:"int32"},{prop:"hardware.i2c.sda",type:"byte"},{prop:"hardware.i2c.scl",type:"byte"},{prop:"hardware.led.gpio",type:"byte"},{prop:"Pin_sd_cs",type:"byte"},{prop:"hardware.gpio",type:"bytes",length:17},{prop:"config.log.syslog_ip",type:"bytes",length:4},{prop:"config.espnetwork.port",type:"int32"},{prop:"config.log.syslog_level",type:"byte"},{prop:"config.log.serial_level",type:"byte"},{prop:"config.log.web_level",type:"byte"},{prop:"config.log.sd_level",type:"byte"},{prop:"config.serial.baudrate",type:"int32"},{prop:"config.mqtt.interval",type:"int32"},{prop:"config.sleep.awaketime",type:"byte"},{prop:"CustomCSS",type:"byte"},{prop:"config.dst.enabled",type:"byte"},{prop:"config.experimental.WDI2CAddress",type:"byte"},{prop:"config.rules.enabled",type:"byte"},{prop:"config.serial.enabled",type:"byte"},{prop:"config.ssdp.enabled",type:"byte"},{prop:"config.ntp.enabled",type:"byte"},{prop:"config.experimental.WireClockStretchLimit",type:"int32"},{prop:"GlobalSync",type:"byte"},{prop:"config.experimental.ConnectionFailuresThreshold",type:"int32"},{prop:"TimeZone",type:"int16",signed:!0},{prop:"config.mqtt.retain_flag",type:"byte"},{prop:"hardware.spi.enabled",type:"byte"},[...Array(guiEasy.maxController())].map((e,t)=>({prop:`controllers[${t}].protocol`,type:"byte"})),[...Array(guiEasy.maxNotification())].map((e,t)=>({prop:`notifications[${t}].type`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].device`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].OLD_TaskDeviceID`,type:"int32"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].gpio1`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].gpio2`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].gpio3`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].gpio4`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].pin1pullup`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].configs`,type:"ints",length:guiEasy.maxPluginConfigVar()})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].pin1inversed`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].configs_float`,type:"floats",length:guiEasy.maxPluginConfigFloatVar()})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].configs_long`,type:"longs",length:guiEasy.maxPluginConfigLongVar()})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].OLD_senddata`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].global_sync`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].data_feed`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].interval`,type:"int32"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].enabled`,type:"byte"})),[...Array(guiEasy.maxController())].map((e,t)=>({prop:`controllers[${t}].enabled`,type:"byte"})),[...Array(guiEasy.maxNotification())].map((e,t)=>({prop:`notifications[${t}].enabled`,type:"byte"})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].TaskDeviceID`,type:"longs",length:guiEasy.maxController()})),[...Array(guiEasy.maxTasks())].map((e,t)=>({prop:`tasks[${t}].TaskDeviceSendData`,type:"bytes",length:guiEasy.maxController()})),{prop:"hardware.led.inverse",type:"byte"},{prop:"config.sleep.sleeponfailiure",type:"byte"},{prop:"UseValueLogger",type:"byte"},{prop:"ArduinoOTAEnable",type:"byte"},{prop:"config.dst.start",type:"int16"},{prop:"config.dst.end",type:"int16"},{prop:"UseRTOSMultitasking",type:"byte"},{prop:"hardware.reset.pin",type:"byte"},{prop:"config.log.syslog_facility",type:"byte"},{prop:"StructSize",type:"int32"},{prop:"config.mqtt.useunitname",type:"byte"},{prop:"config.location.lat",type:"float"},{prop:"config.location.long",type:"float"},{prop:"config._emptyBit",type:"bit"},{prop:"config.general.appendunitno",type:"bit"},{prop:"config.mqtt.changeclientidrecon",type:"bit"},{prop:"config.rules.oldengine",type:"bit"},{prop:"config.wifi.forcebgmode",type:"bit"},{prop:"config.wifi.restartconnlost",type:"bit"},{prop:"config.power.ecomode",type:"bit"},{prop:"config.wifi.nosleep",type:"bit"},{prop:"config.rules.tolerantargs",type:"bit"},{prop:"config.rules.SendToHTTPack",type:"bit"},{prop:"config.wifi.gratuitousARP",type:"bit"},{prop:"config._bits2",type:"byte"},{prop:"config._bits3",type:"byte"},{prop:"ResetFactoryDefaultPreference",type:"int32"}].flat(),guiEasy.configDat.taskSettings=[{prop:"index",type:"byte"},{prop:"name",type:"string",length:guiEasy.maxFormulaLength()+1},[...Array(guiEasy.maxValuesPerTask())].map((e,t)=>({prop:`values[${t}].formula`,type:"string",length:guiEasy.maxFormulaLength()+1})),[...Array(guiEasy.maxValuesPerTask())].map((e,t)=>({prop:`values[${t}].name`,type:"string",length:guiEasy.maxFormulaLength()+1})),{prop:"value_names",type:"string",length:guiEasy.maxFormulaLength()+1},{prop:"plugin_config_long",type:"longs",length:guiEasy.maxPluginExtraConfigVar()},{prop:"decimals",type:"bytes",length:guiEasy.maxValuesPerTask()},{prop:"plugin_config",type:"ints",length:guiEasy.maxPluginExtraConfigVar()}].flat(),guiEasy.configDat.controllerSettings=[{prop:"dns",type:"byte"},{prop:"IP",type:"bytes",length:4},{prop:"port",type:"int32"},{prop:"hostname",type:"string",length:65},{prop:"publish",type:"string",length:129},{prop:"subscribe",type:"string",length:129},{prop:"MQTT_lwt_topic",type:"string",length:129},{prop:"lwt_message_connect",type:"string",length:129},{prop:"lwt_message_disconnect",type:"string",length:129},{prop:"minimal_time_between",type:"int32"},{prop:"max_queue_depth",type:"int32"},{prop:"max_retry",type:"int32"},{prop:"delete_oldest",type:"byte"},{prop:"client_timeout",type:"int32"},{prop:"must_check_reply",type:"byte"}],guiEasy.configDat.notificationSettings=[{prop:"server",type:"string",length:65},{prop:"port",type:"int16"},{prop:"domain",type:"string",length:65},{prop:"sender",type:"string",length:65},{prop:"receiver",type:"string",length:65},{prop:"subject",type:"string",length:129},{prop:"body",type:"string",length:513},{prop:"pin1",type:"byte"},{prop:"pin2",type:"byte"},{prop:"user",type:"string",length:49},{prop:"pass",type:"string",length:33}],guiEasy.configDat.securitySettings=[{prop:"WifiSSID",type:"string",length:32},{prop:"WifiKey",type:"string",length:64},{prop:"WifiSSID2",type:"string",length:32},{prop:"WifiKey2",type:"string",length:64},{prop:"WifiAPKey",type:"string",length:64},[...Array(guiEasy.maxController())].map((e,t)=>({prop:`controllers[${t}].user`,type:"string",length:26})),[...Array(guiEasy.maxController())].map((e,t)=>({prop:`controllers[${t}].password`,type:"string",length:64})),{prop:"password",type:"string",length:26},{prop:"AllowedIPrangeLow",type:"bytes",length:4},{prop:"AllowedIPrangeHigh",type:"bytes",length:4},{prop:"IPblockLevel",type:"byte"},{prop:"ProgmemMd5",type:"bytes",length:16},{prop:"md5",type:"bytes",length:16}].flat();const set=(e,t,n)=>{let a=t.replace(/\[/g,".").replace(/]/g,"").split(".");if(a.length>1)for(let t=0;t>this.bitbytepos++&1;this.bitbyte=n?this.bitbyte|1<0&&document.getSelection().getRangeAt(0);t.select(),document.execCommand("copy"),document.body.removeChild(t),n&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n));let a={type:"clipboard",str:e};guiEasy.popper.tryCallEvent(a)},swapKey2Value:function(e){let t={};for(let n in e)t[e[n]]=n;return t},rgb2hex:function(e){e=e.split(",");let t="#";for(let n=0;n")),e},capitalWord:function(e){let t=["ok","gpio","led","ssid","spi","wpa","ap","ip","esp","dns","id","i2c","sda","scl","ntp","dst","gui","json","mqtt","p2p","rssi","bssid","dhcp","cpu","ram","sta","gw","l/r","http","udp"],n=e.toLowerCase().split(" ");for(let e=0;ee.json()).then(l=>{e[t].live[n]=l,e[t].live[n].timestamp=Date.now(),void 0!==l.TTL||(e[t].live[n].TTL=a),"logjson"===n&&void 0!==l.Log.TTL&&(e[t].live[n].TTL=l.Log.TTL),e[t].live[n].TTL_fallback=a;let i=Date.now()+e[t].live[n].TTL;e[t].scheduler.push([i,n]),e[t].scheduler.sort(),e[t].stats.lastRun=Date.now(),e[t].stats[n].run=Date.now()-s,e[t].stats[n].timestamp=Date.now(),e[t].stats.error=0}).catch(a=>{console.error("Error fetching ("+n+"): ",a),e[t].stats.error++;let l=Date.now()+e[t].stats[n].TTL_fallback;e[t].scheduler.push([l,n]),e[t].scheduler.sort(),e[t].stats.lastRun=Date.now(),e[t].stats[n].run=Date.now()-s,e[t].stats[n].timestamp=Date.now(),guiEasy.fetchCount.error++}),guiEasy.fetchCount.current++,guiEasy.fetchCount.current===guiEasy.fetchCount.max&&(guiEasy.current.live=t)},fetchConfigDat:function(e,t,n=!0){let a=Date.now(),s=["config.dat","notification.dat","security.dat"],l="http://"+e[t].ip+"/"+s[0]+"?callback="+a,i="http://"+e[t].ip+"/"+s[1]+"?callback="+a,o="http://"+e[t].ip+"/"+s[2]+"?callback="+a;fetch(l).then(e=>e.arrayBuffer()).then(async s=>{let l=helpEasy.parseConfigDat,r=guiEasy.configDat;const d=l(s,r.configDatParseConfig);[...Array(guiEasy.maxTasks())].map((e,t)=>{e=helpEasy.parseConfigDat,d.tasks[t].settings=e(s,r.taskSettings,4096+2048*t),d.tasks[t].extra=e(s,r.taskSettings,5120+2048*t)}),[...Array(guiEasy.maxController())].map((e,t)=>{e=helpEasy.parseConfigDat,d.controllers[t].settings=e(s,r.controllerSettings,27648+2048*t),d.controllers[t].extra=e(s,r.controllerSettings,28672+2048*t)});const u=await fetch(i).then(e=>e.arrayBuffer());[...Array(guiEasy.maxNotification())].map((e,t)=>{e=helpEasy.parseConfigDat,d.notifications[t].settings=e(u,r.notificationSettings,1024*t)});const p=await fetch(o).then(e=>e.arrayBuffer());d.security=[...Array(1)].map((e,t)=>(0,helpEasy.parseConfigDat)(p,r.securitySettings,1024*t)),e[t].settings=Object.assign({},d),e[t].settings.timestamp=a,!0===n&&(e[t].settingsBrowser=Object.assign({},d),e[t].settingsBrowser.timestamp=a),guiEasy.current.config=t,e[t].stats.lastRun=Date.now(),void 0===e[t].stats.configDat&&(e[t].stats.configDat={}),e[t].stats.configDat.run=Date.now()-a,e[t].stats.configDat.timestamp=a})},parseConfigDat:function(e,t,n){const a=new DataParser(e);n&&(a.offset=n);const s={};return t.map(e=>{const t=e.length?e.length:e.signed;set(s,e.prop,a[e.type](t,e.signed))}),s},getCurrentIndex:function(e=""){let t=document.querySelectorAll("[data-current-index]")[0];return"online"===e?"true"===t.dataset.currentOnline:parseInt(t.dataset.currentIndex)},setCurrentIndex:function(e){let t=document.querySelectorAll("[data-current-index]")[0];t.dataset.currentIndex=e,t.dataset.currentOnline="true"},setCurrentOnline:function(e){let t=document.querySelectorAll("[data-current-index]")[0];t.dataset.currentOnline="online"===e?"true":"false"},scheduleFetch:function(e,t,n){if(void 0===e[t].stats&&(e[t].stats={error:0}),void 0===n){let n=guiEasy.endpoints.get;guiEasy.fetchCount={max:0,current:0,error:0},e[t].live={},e[t].history={},e[t].scheduler=[];for(let a=0;aguiEasy.endpoints.defaultTTL()){e[t].stats[s]={TTL_fallback:guiEasy.endpoints.defaultTTL(),run:-1,timestamp:Date.now()};let n=Date.now()+a*guiEasy.fetchSettings.intervalTimeKeeper+2e3;e[t].scheduler.push([n,s]),e[t].scheduler.sort()}else{e[t].stats[s]={TTL_fallback:n[a].ttl_fallback,run:-1,timestamp:Date.now()},e[t].scheduler.push([0,s]),e[t].scheduler.sort();let l=guiEasy.fetchCount.max*guiEasy.fetchSettings.intervalTimeKeeper;setTimeout(function(){helpEasy.getDataFromNode(e,t,s,n[a].ttl_fallback)},l),guiEasy.fetchCount.max++}}}else{let a=guiEasy.fetchSettings,s=e[t].stats[n].TTL_fallback;helpEasy.getDataFromNode(e,t,n,s);let l=Object.assign({},e[t].live[n]);l.fetched=Date.now(),void 0===e[t].history[n]&&(e[t].history[n]=[]),e[t].history[n].push(l),e[t].history[n].length>a.maxToKeep*a.maxToKeepMs-1&&e[t].history[n].shift()}},getGuiInFields:function(){void 0===guiEasy.jsonPathsIN&&(guiEasy.jsonPathsIN=[]);let e=guiEasy.jsonPathsIN,t=document.querySelectorAll("[data-json-path]");for(let n=0;n"+a+"";for(let e=0;e"+s[e]+"":n+=s[e],e!==s.length-1?n+="
":n+="";for(let e=0;e":n+="";for(let e=0;e",n+=helpEasy.rssiToSVG(i[e]),e!==i.length-1?n+="
"+i[e]+" dBm

":n+="
"+i[e]+" dBm
";a="",s=[],l=[],i=[]}n+="\n \n
"+e.length+" separate APs found
\n
Fetched: "+helpEasy.epochToHHMMSS(e.timestamp)+"
\n
Scheduled: "+helpEasy.epochToHHMMSS(e.timestamp+e.TTL)+"
\n \n ",set(guiEasy.nodes[t],"modal.table.wifi",n)},filelist:function(e,t){let n=["notification.dat","config.dat","security.dat"],a=guiEasy.nodes[helpEasy.getCurrentIndex()].deleteFile;guiEasy.nodes[helpEasy.getCurrentIndex()].deleteFile=null;let s='\n ",set(guiEasy.nodes[t],"modal.table.files",s)},timingstatsList:function(e,t){let n=[],a=["plugin","controller","misc"];for(let t=0;t\n \n \n \n \n \n \n ';for(let e=s.length-1;e>-1;e--){let t="";s[e].subLevels>1&&(t="
"+s[e].subKey),l+='\n \n \n \n \n \n "}l+="\n
TypeTimerProcess
\n '+s[e].type+("000"+s[e].id).slice(-3)+'\n \n '+s[e].sortValue+'\n
\n avg: '+s[e].avg+"
\n min: "+s[e].min+"
\n max: "+s[e].max+"
\n count: "+s[e].count+"
\n per sec: "+s[e]["call-per-sec"]+"\n
\n
\n "+s[e].name+t+"\n
\n
Fetched: "+helpEasy.epochToHHMMSS(e.timestamp)+"
\n
Scheduled: "+helpEasy.epochToHHMMSS(e.timestamp+e.TTL)+"
\n \n ",set(guiEasy.nodes[t],"modal.table.timingstats_json",l)},twoLevelJsonToList:function(e,t){let n=guiEasy.nodes[t].live[e],a="",a+="";for(let l=0;l"}a+="
"+helpEasy.capitalWord(i)+""+o+"
"}}return a+="\n
Fetched: "+helpEasy.epochToHHMMSS(n.timestamp)+"
\n
Scheduled: "+helpEasy.epochToHHMMSS(n.timestamp+n.TTL)+"
\n \n ",set(guiEasy.nodes[t],"modal.table."+e,a),a},guiUpdater:function(){let e=Date.now(),t=helpEasy.getCurrentIndex(),n=guiEasy.nodes[t];void 0===guiEasy.jsonPathsIN&&(guiEasy.jsonPathsIN=[]);let a=guiEasy.jsonPathsIN;for(let e=0;e";set(guiEasy.nodes[t],"modal.table.wifi",e)}if(void 0!==n.live.filelist_json)helpEasy.filelist(n.live.filelist_json,t);else{let e="";set(guiEasy.nodes[t],"modal.table.files",e)}if(void 0!==n.live.sysinfo_json)helpEasy.twoLevelJsonToList("sysinfo_json",t);else{let e="";set(guiEasy.nodes[t],"modal.table.sysinfo_json",e)}if(void 0!==n.live.timingstats_json)helpEasy.timingstatsList(n.live.timingstats_json,t);else{let e="";set(guiEasy.nodes[t],"modal.table.timingstats_json",e)}i=document.querySelectorAll("[data-modal-table]");for(let e=0;eArray(r).fill("")),u=[...Array(o)].fill("");for(let e=0;e0&&document.getElementById(a+"hr").classList.remove("is-hidden"),document.getElementById(a+"name").innerText!==d[e][n].name&&(document.getElementById(a+"name").innerText=d[e][n].name),document.getElementById(a+"value").innerText!==d[e][n].value&&(document.getElementById(a+"value").innerText=d[e][n].value)}}guiEasy.current.gui=t,void 0===guiEasy.nodes[t].stats.gui&&(guiEasy.nodes[t].stats.gui={}),guiEasy.nodes[t].stats.gui.run=Date.now()-e,guiEasy.nodes[t].stats.gui.timestamp=e},clearTaskValues:function(e,t=null){let n,a,s=guiEasy.maxValuesPerTask(),l=[],i=[];if(null!==t){for(let o=1;o<=s;o++)(n=document.querySelectorAll("[id='task-"+(e+1)+"-value-"+(t+o)+"-name']")).length>0&&l.push([].slice.call(n)),(n=document.querySelectorAll("[id='task-"+(e+1)+"-value-"+(t+o)+"-value']")).length>0&&l.push([].slice.call(n)),null!==(a=document.getElementById("task-"+(e+1)+"-value-"+(t+o)+"-hr"))&&i.push(a);l.length>0&&l.map(e=>e.map(e=>e.innerHTML="")),i.length>0&&i.map(e=>e.classList.add("is-hidden"))}else(n=document.querySelectorAll("[data-clear-task='"+(e+1)+"']")).length>0&&(l=[].slice.call(n)),l.length>0&&l.map(e=>e.innerHTML=""),(a=document.querySelectorAll("[data-clear-hr='"+(e+1)+"']")).length>0&&(i=[].slice.call(a)),i.length>0&&i.map(e=>e.classList.add("is-hidden")),(a=document.querySelectorAll("[data-hide-row='"+(e+1)+"']")).length>0&&(i=[].slice.call(a)),i.length>0&&i.map(e=>e.classList.add("is-hidden"))},uploadBinaryAsFile:function(e,t,n){let a,s,l,i=document.getElementById("label-"+n),o=i.innerText;if("generic"===e&&(a=35,l="/upload",s=guiEasy.nodes[helpEasy.getCurrentIndex()].live.sysinfo_json.storage.spiffs_free),"firmware"===e&&(helpEasy.schedulerDelay(guiEasy.nodes,helpEasy.getCurrentIndex(),6e4),a=25,l="/update",s=guiEasy.nodes[helpEasy.getCurrentIndex()].live.sysinfo_json.storage.sketch_free),(s*=1e3)100&&(e=100),i.innerText=t.name+" ("+e+"%)"},n),u=new FormData;u.append("file",t),u.append("name",e),u.append("enctype","multipart/form-data");let p="http://"+guiEasy.nodes[helpEasy.getCurrentIndex()].ip+l;fetch(p,{method:"POST",body:u}).then(e=>e.text()).then(n=>{if(clearInterval(d),i.innerText=t.name+" (100%)",helpEasy.addToLogDOM(n,3),setTimeout(function(){helpEasy.blinkElement(i.id,"success")},500),"generic"===e&&setTimeout(function(){helpEasy.schedulerBump(guiEasy.nodes[helpEasy.getCurrentIndex()].scheduler,"sysinfo_json"),helpEasy.schedulerBump(guiEasy.nodes[helpEasy.getCurrentIndex()].scheduler,"filelist_json"),i.innerText=o,helpEasy.updateIndicator()},900),"firmware"===e){helpEasy.schedulerBump(guiEasy.nodes[helpEasy.getCurrentIndex()].scheduler,"sysinfo_json");let e=30,t=setInterval(function(){i.innerText="Will reboot in "+e,--e<1&&(clearInterval(t),location.reload())},1e3)}})}},updateIndicator:async function(){setTimeout(function(){let e=guiEasy.nodes[helpEasy.getCurrentIndex()].live.sysinfo_json.storage,t=Math.floor(parseInt(e.spiffs_free)/parseInt(e.spiffs_size)*100),n=document.getElementById("modal-input-upload-storage-free"),a=document.getElementById("modal-input-upload-storage-occupied");n.style.width=t+"%",n.innerText=parseInt(e.spiffs_free)+"kB",a.style.width=100-t+"%",a.innerText=(parseInt(e.spiffs_size)-parseInt(e.spiffs_free)).toString()+"kB"},5e3)},parseHTMLstring:function(e,t,n){let a=document.createElement("html");a.innerHTML=e;let s="";return"tag"===t&&(s=a.getElementsByTagName(n)[0].innerHTML.toString()),"name"===t&&(s=a.getElementsByName(n)[0].innerHTML.toString()),"class"===t&&(s=a.getElementsByClassName(n)[0].innerHTML.toString()),"id"===t&&(s=a.getElementById(n).innerHTML.toString()),"query"===t&&(s=a.querySelectorAll(n)[0].innerHTML.toString()),a.remove(),s},guiUpdaterSettings:function(e){let t=guiEasy.nodes[helpEasy.getCurrentIndex()],n=defaultSettings,a=helpEasy.getGuiInFields();e=void 0===e?"settings":"settingsBrowser";for(let s=0;s"+helpEasy.capitalWord(e[l[i].checked+"Text"])+e.tooltip+""}}}}},gaugeLevel:function(e,t){let n,a,s=e.parentNode,l=helpEasy.getjsonPathData(e.dataset.jsonPathGauge.split("--"),t),i=parseInt(e.dataset.max),o=parseInt(e.dataset.min),r="";i>o?((a=(l-o)/(i-o))>.6&&(r="main-info"),a>.8&&(r="main-warning"),a<.05&&(r="main-success")):((a=(l-i)/(o-i))<.4&&(r="main-info"),a<1-.8&&(r="main-warning"),a>.95&&(r="main-success")),(n=574.5*(1-a))>574.5&&(n=574.5),n<0&&(n=0),s.classList.remove("main-info","main-warning"),""!==r&&s.classList.add(r),e.style="stroke-dashoffset:"+n+";"},rssiToBars:function(e){return e>=-55?"level-5":e>=-66?"level-4":e>=-77?"level-3":e>=-88?"level-2":"level-1"},rssiToSVG:function(e){let t=helpEasy.rssiToBars(e);return guiEasy.curly.icon(["wifi",t])},getjsonPathData:function(e,t){return 1===e.length?t[e[0]]:2===e.length?t[e[0]][e[1]]:3===e.length?t[e[0]][e[1]][e[2]]:4===e.length?t[e[0]][e[1]][e[2]][e[3]]:5===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]]:6===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]][e[5]]:7===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]][e[5]][e[6]]:8===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]][e[5]][e[6]][e[7]]:void 0},sortObjectArray:e=>(t,n)=>t[e]===n[e]?0:t[e]=t&&console.log(e)},numberOfFound:function(e,t){return((e||"").match(t)||[]).length},findInArray:function(e,t){return t.indexOf(e)>-1},listOfProcesses:function(e,t,n,a){let s=document.getElementById("modal-loading-log"),l=document.getElementById("modal-loading-progress");document.getElementById("fallback-loading-animation").classList.add("is-hidden"),s.innerHTML+="
"+t+"
",l.max=guiEasy[a].length,void 0===guiEasy.guiStats[a]&&(guiEasy.guiStats[a]={}),guiEasy.guiStats[a][e]="running"},processDone:function(e,t){let n=document.getElementById("modal-loading-progress"),a=document.getElementById("log-entry-"+e),s=Date.now()-a.dataset.timestart;if(guiEasy.guiStats.bootTime+=s,a.innerHTML+=" ("+s+"ms)",a.classList.add("loading-is-done"),"startup"===t){if(n.max===n.value){let e=document.getElementById("modal-container");document.getElementById("modal-loading-screen").classList.add("is-hidden"),e.classList.add("is-hiding"),setTimeout(function(){e.classList.add("is-hidden"),e.classList.remove("is-hiding"),e.classList.remove("is-black")},500),helpEasy.addToLogDOM("total boot time: "+guiEasy.guiStats.bootTime+"ms",1)}n.value++}guiEasy.guiStats[t][e]="done"},internet:function(){let e=!1;return!0===window.navigator.onLine&&(e=!0),e},welcomePhrase:function(){let e=(new Date).getHours();return e>17?"Good evening!":e>11?"Good afternoon!":e>5?"Good morning!":"Hi!"},urlParams:function(){let e={};return window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(t,n,a){e[n.toLowerCase()]=a.toLowerCase()}),e},locationByIP:async function(){let e="https://ipapi.co/json?at="+Date.now()+"&gui="+guiEasy.geekNameFull(),t=await fetch(e);return await t.json()},blinkElement:function(e,t){let n=document.getElementById(e);n.classList.add("main-"+t),setTimeout(function(){n.classList.remove("main-"+t)},250)},dashGroupContainerOpen:function(e=""){return""===e?"
":"
"+helpEasy.capitalWord(e)+"
"},dashBoxContainerOpen:function(){return"
"},dashContainerClose:function(){return"
"},addToolsButton:function(e){let t="",n=e.type,a="";return void 0!==e.color&&(a=" main-"+e.color),"command"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),"info"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),"scanner"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),"system"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),t},addInput:function(e){let t=e.type,n="";void 0!==e.disabled&&!0===e.disabled&&(n="disabled");let a=e.title.split(" ").join("-"),s="generic-input-",l="";!0===e.toSettings&&(s="settings-input-",l+='data-settings="'+e.settingsId+'"'),void 0!==e.settingsIP&&(l+='data-settings-ip="'+e.settingsIP+'"'),void 0!==e.settingsRegEx&&(l+='data-settings-regex="'+e.settingsRegEx+'"'),void 0!==e.valueIfBlank&&(l+='data-value-if-blank="'+e.valueIfBlank+'"'),void 0!==e.allowedBlank&&(l+='data-allowed-blank="'+e.allowedBlank+'"'),void 0!==e.optionListOffset&&(l+='data-option-list-offset="'+e.optionListOffset+'"'),void 0!==e.list2value&&(l+='data-list2value="'+e.list2value+'"'),a=s+a;let i="",o="";void 0!==e.tooltip&&(i="
"+e.tooltip+"
",o="got-tooltip");let r="
";if("string"===t&&(r+=""+helpEasy.capitalWord(e.title)+i+"",r+="\n \n '),"password"===t&&(r+=""+helpEasy.capitalWord(e.title)+i+"",r+="\n \n '),"dropdown"===t){r+=""+helpEasy.capitalWord(e.title)+i+"",r+=' \n \n ";let t=e.optionList;for(let n=0;n"+s+i+"":r+=""}r+='\n \n '}if("toggle"===t&&(r+='\n \n \n "),"number"===t){let t="";""!==e.placeholder&&(t=" ["+e.placeholder+"]"),r+='\n \n \n "}return r+="
"},addLine:function(){return"
"},openArea:function(e){let t=e.replace(" ","-")+"-area";return defaultSettings.areasMinimized?'\n
\n
'+helpEasy.capitalWord(e)+'
\n ':'\n
\n
'+helpEasy.capitalWord(e)+'
\n '},closeArea:function(){return"
"},openColumn:function(e){return void 0===e?"
":"data"===e.split("-")[0]?"
":"
"},closeColumn:function(){return"
"},checkIfIP:function(e){return/^(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(e)},screenshot:function(e){if(helpEasy.internet()){let e="screenshot-script",t={type:"wave",text:guiEasy.curly.icon(["screenshot"]),color:"inverted"},n=guiEasy.current.backgroundColor;void 0===n&&(n="#3492e2");let a=guiEasy.current.invertedColor;void 0===a&&(a="#2F4252");let s=helpEasy.capitalWord(guiEasy.current.tab.id.split("-")[0]),l=guiEasy.current.modal;void 0===l?l=guiEasy.current.tab:(n=a,s=s+"-"+document.getElementById("modal-title-text").innerText.replace(/ /g,"_")),s=guiEasy.nodes[helpEasy.getCurrentIndex()].live.json.System["Unit Name"]+"-"+s,guiEasy.popper.tryCallEvent(t);let i=document.createElement("script");i.id=e,i.onload=function(){html2canvas(l,{backgroundColor:n}).then(function(e){helpEasy.binaryDataToFile(e,"image/png",s+".png")})},i.src="https://github.com/niklasvh/html2canvas/releases/download/v1.0.0-rc.5/html2canvas.min.js",document.head.appendChild(i)}else{let e={type:"wave",text:"No internet!",color:"warning"};guiEasy.popper.tryCallEvent(e)}},binaryDataToFile:function(e,t,n){let a="temp-binary-blob-element",s=document.getElementById(a);null!==s&&s.remove();let l=document.createElement("a");l.id=a,document.body.appendChild(l),l.style.display="none",l.href=e.toDataURL(t),l.download=n,l.click()},favicon:function(e){let t=document.createElement("canvas");t.width=113,t.height=113;let n=t.getContext("2d");n.lineWidth=8,n.fillStyle=e.inverted,n.beginPath(),n.moveTo(0,15),n.lineTo(0,98),n.arc(15,98,15,Math.PI,.5*Math.PI,!0),n.lineTo(15,113),n.lineTo(98,113),n.arc(98,98,15,Math.PI,1.5*Math.PI,!0),n.lineTo(113,98),n.lineTo(113,15),n.arc(98,15,15,0,1.5*Math.PI,!0),n.lineTo(98,0),n.lineTo(15,0),n.arc(15,15,15,0,.5*Math.PI,!0),n.lineTo(0,15),n.closePath(),n.fill(),n.fillStyle=e.font,n.beginPath(),n.arc(90,90,10,0,2*Math.PI),n.closePath(),n.fill(),n.lineCap="round",n.strokeStyle=e.warning,n.beginPath(),n.moveTo(42,99),n.lineTo(99,42),n.closePath(),n.stroke(),n.strokeStyle=e.info,n.beginPath(),n.moveTo(14,99),n.lineTo(99,14),n.closePath(),n.stroke(),n.strokeStyle=e.sunny,n.beginPath(),n.moveTo(14,70),n.lineTo(70,14),n.closePath(),n.stroke(),n.strokeStyle=e.success,n.beginPath(),n.moveTo(14,42),n.lineTo(42,14),n.closePath(),n.stroke();let a=document.getElementById("favicon");null!==a&&a.remove(),(a=document.createElement("link")).id="favicon",a.type="image/x-icon",a.rel="shortcut icon",a.href=t.toDataURL("image/x-icon"),document.head.appendChild(a)}};function initiate(){for(let e=0;e0)return guiEasy.curly(e,t)}helpEasy.processDone(e,t),helpEasy.addToLogDOM(e+" loop count: "+guiEasy.syntax.curlyLC,1)},guiEasy.curly.compileArgs=function(e){let t=[],n=[];t.push(e[0].toLowerCase()),t.push(e.length-1);for(let t=1;t"+guiEasy.geekNameFull()+"
"},guiEasy.curly.unitname=function(){return"
"},guiEasy.curly.modal=function(e){let t=e[0],n="",a="";return"message"!==t?guiEasy.curly[t]:'\n \n "},guiEasy.curly.wave=function(){return'\n
\n
\n
\n '},guiEasy.curly.input=function(e){let t=e[0],n="";return"string"!==t&&"all"!==t||(n+=""),"textarea"!==t&&"all"!==t||(n+="\n
\n
\n
",t+="",n=e.right;let a="";for(let e=0;e",t+="",t+=""},guiEasy.curly.navbar.tab=function(e){return'\n
";a="",s=[],l=[],i=[]}n+="\n \n
"+e.length+" separate APs found
\n
Fetched: "+helpEasy.epochToHHMMSS(e.timestamp)+"
\n
Scheduled: "+helpEasy.epochToHHMMSS(e.timestamp+e.TTL)+"
\n \n ",set(guiEasy.nodes[t],"modal.table.wifi",n)},filelist:function(e,t){let n=["notification.dat","config.dat","security.dat"],a=guiEasy.nodes[helpEasy.getCurrentIndex()].deleteFile;guiEasy.nodes[helpEasy.getCurrentIndex()].deleteFile=null;let s='\n ",set(guiEasy.nodes[t],"modal.table.files",s)},timingstatsList:function(e,t){let n=[],a=["plugin","controller","misc"];for(let t=0;t\n \n \n \n \n \n \n ';for(let e=s.length-1;e>-1;e--){let t="";s[e].subLevels>1&&(t="
"+s[e].subKey),l+='\n \n \n \n \n \n "}l+="\n
TypeTimerProcess
\n '+s[e].type+("000"+s[e].id).slice(-3)+'\n \n '+s[e].sortValue+'\n
\n avg: '+s[e].avg+"
\n min: "+s[e].min+"
\n max: "+s[e].max+"
\n count: "+s[e].count+"
\n per sec: "+s[e]["call-per-sec"]+"\n
\n
\n "+s[e].name+t+"\n
\n
Fetched: "+helpEasy.epochToHHMMSS(e.timestamp)+"
\n
Scheduled: "+helpEasy.epochToHHMMSS(e.timestamp+e.TTL)+"
\n \n ",set(guiEasy.nodes[t],"modal.table.timingstats_json",l)},twoLevelJsonToList:function(e,t){let n=guiEasy.nodes[t].live[e],a="",a+="";for(let l=0;l"}a+="
"+helpEasy.capitalWord(i)+""+o+"
"}}return a+="\n
Fetched: "+helpEasy.epochToHHMMSS(n.timestamp)+"
\n
Scheduled: "+helpEasy.epochToHHMMSS(n.timestamp+n.TTL)+"
\n \n ",set(guiEasy.nodes[t],"modal.table."+e,a),a},guiUpdater:function(){let e=Date.now(),t=helpEasy.getCurrentIndex(),n=guiEasy.nodes[t];void 0===guiEasy.jsonPathsIN&&(guiEasy.jsonPathsIN=[]);let a=guiEasy.jsonPathsIN;for(let e=0;e";set(guiEasy.nodes[t],"modal.table.wifi",e)}if(void 0!==n.live.filelist_json)helpEasy.filelist(n.live.filelist_json,t);else{let e="";set(guiEasy.nodes[t],"modal.table.files",e)}if(void 0!==n.live.sysinfo_json)helpEasy.twoLevelJsonToList("sysinfo_json",t);else{let e="";set(guiEasy.nodes[t],"modal.table.sysinfo_json",e)}if(void 0!==n.live.timingstats_json)helpEasy.timingstatsList(n.live.timingstats_json,t);else{let e="";set(guiEasy.nodes[t],"modal.table.timingstats_json",e)}i=document.querySelectorAll("[data-modal-table]");for(let e=0;eArray(r).fill("")),u=[...Array(o)].fill("");for(let e=0;e0&&document.getElementById(a+"hr").classList.remove("is-hidden"),document.getElementById(a+"name").innerText!==d[e][n].name&&(document.getElementById(a+"name").innerText=d[e][n].name),document.getElementById(a+"value").innerText!==d[e][n].value&&(document.getElementById(a+"value").innerText=d[e][n].value)}}guiEasy.current.gui=t,void 0===guiEasy.nodes[t].stats.gui&&(guiEasy.nodes[t].stats.gui={}),guiEasy.nodes[t].stats.gui.run=Date.now()-e,guiEasy.nodes[t].stats.gui.timestamp=e},clearTaskValues:function(e,t=null){let n,a,s=guiEasy.maxValuesPerTask(),l=[],i=[];if(null!==t){for(let o=1;o<=s;o++)(n=document.querySelectorAll("[id='task-"+(e+1)+"-value-"+(t+o)+"-name']")).length>0&&l.push([].slice.call(n)),(n=document.querySelectorAll("[id='task-"+(e+1)+"-value-"+(t+o)+"-value']")).length>0&&l.push([].slice.call(n)),null!==(a=document.getElementById("task-"+(e+1)+"-value-"+(t+o)+"-hr"))&&i.push(a);l.length>0&&l.map(e=>e.map(e=>e.innerHTML="")),i.length>0&&i.map(e=>e.classList.add("is-hidden"))}else(n=document.querySelectorAll("[data-clear-task='"+(e+1)+"']")).length>0&&(l=[].slice.call(n)),l.length>0&&l.map(e=>e.innerHTML=""),(a=document.querySelectorAll("[data-clear-hr='"+(e+1)+"']")).length>0&&(i=[].slice.call(a)),i.length>0&&i.map(e=>e.classList.add("is-hidden")),(a=document.querySelectorAll("[data-hide-row='"+(e+1)+"']")).length>0&&(i=[].slice.call(a)),i.length>0&&i.map(e=>e.classList.add("is-hidden"))},uploadBinaryAsFile:function(e,t,n){let a,s,l,i=document.getElementById("label-"+n),o=i.innerText;if("generic"===e&&(a=35,l="/upload",s=guiEasy.nodes[helpEasy.getCurrentIndex()].live.sysinfo_json.storage.spiffs_free),"firmware"===e&&(helpEasy.schedulerDelay(guiEasy.nodes,helpEasy.getCurrentIndex(),6e4),a=25,l="/update",s=guiEasy.nodes[helpEasy.getCurrentIndex()].live.sysinfo_json.storage.sketch_free),(s*=1e3)100&&(e=100),i.innerText=t.name+" ("+e+"%)"},n),u=new FormData;u.append("file",t),u.append("name",e),u.append("enctype","multipart/form-data");let p="http://"+guiEasy.nodes[helpEasy.getCurrentIndex()].ip+l;fetch(p,{method:"POST",body:u}).then(e=>e.text()).then(n=>{if(clearInterval(d),i.innerText=t.name+" (100%)",helpEasy.addToLogDOM(n,3),setTimeout(function(){helpEasy.blinkElement(i.id,"success")},500),"generic"===e&&setTimeout(function(){helpEasy.schedulerBump(guiEasy.nodes[helpEasy.getCurrentIndex()].scheduler,"sysinfo_json"),helpEasy.schedulerBump(guiEasy.nodes[helpEasy.getCurrentIndex()].scheduler,"filelist_json"),i.innerText=o,helpEasy.updateIndicator()},900),"firmware"===e){helpEasy.schedulerBump(guiEasy.nodes[helpEasy.getCurrentIndex()].scheduler,"sysinfo_json");let e=30,t=setInterval(function(){i.innerText="Will reboot in "+e,--e<1&&(clearInterval(t),location.reload())},1e3)}})}},updateIndicator:async function(){setTimeout(function(){let e=guiEasy.nodes[helpEasy.getCurrentIndex()].live.sysinfo_json.storage,t=Math.floor(parseInt(e.spiffs_free)/parseInt(e.spiffs_size)*100),n=document.getElementById("modal-input-upload-storage-free"),a=document.getElementById("modal-input-upload-storage-occupied");n.style.width=t+"%",n.innerText=parseInt(e.spiffs_free)+"kB",a.style.width=100-t+"%",a.innerText=(parseInt(e.spiffs_size)-parseInt(e.spiffs_free)).toString()+"kB"},5e3)},parseHTMLstring:function(e,t,n){let a=document.createElement("html");a.innerHTML=e;let s="";return"tag"===t&&(s=a.getElementsByTagName(n)[0].innerHTML.toString()),"name"===t&&(s=a.getElementsByName(n)[0].innerHTML.toString()),"class"===t&&(s=a.getElementsByClassName(n)[0].innerHTML.toString()),"id"===t&&(s=a.getElementById(n).innerHTML.toString()),"query"===t&&(s=a.querySelectorAll(n)[0].innerHTML.toString()),a.remove(),s},guiUpdaterSettings:function(e){let t=guiEasy.nodes[helpEasy.getCurrentIndex()],n=defaultSettings,a=helpEasy.getGuiInFields();e=void 0===e?"settings":"settingsBrowser";for(let s=0;s"+helpEasy.capitalWord(e[l[i].checked+"Text"])+e.tooltip+""}}}}},gaugeLevel:function(e,t){let n,a,s=e.parentNode,l=helpEasy.getjsonPathData(e.dataset.jsonPathGauge.split("--"),t),i=parseInt(e.dataset.max),o=parseInt(e.dataset.min),r="";i>o?((a=(l-o)/(i-o))>.6&&(r="main-info"),a>.8&&(r="main-warning"),a<.05&&(r="main-success")):((a=(l-i)/(o-i))<.4&&(r="main-info"),a<1-.8&&(r="main-warning"),a>.95&&(r="main-success")),(n=574.5*(1-a))>574.5&&(n=574.5),n<0&&(n=0),s.classList.remove("main-info","main-warning"),""!==r&&s.classList.add(r),e.style="stroke-dashoffset:"+n+";"},rssiToBars:function(e){return e>=-55?"level-5":e>=-66?"level-4":e>=-77?"level-3":e>=-88?"level-2":"level-1"},rssiToSVG:function(e){let t=helpEasy.rssiToBars(e);return guiEasy.curly.icon(["wifi",t])},getjsonPathData:function(e,t){return 1===e.length?t[e[0]]:2===e.length?t[e[0]][e[1]]:3===e.length?t[e[0]][e[1]][e[2]]:4===e.length?t[e[0]][e[1]][e[2]][e[3]]:5===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]]:6===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]][e[5]]:7===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]][e[5]][e[6]]:8===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]][e[5]][e[6]][e[7]]:void 0},sortObjectArray:e=>(t,n)=>t[e]===n[e]?0:t[e]=t&&console.log(e)},numberOfFound:function(e,t){return((e||"").match(t)||[]).length},findInArray:function(e,t){return t.indexOf(e)>-1},listOfProcesses:function(e,t,n,a){let s=document.getElementById("modal-loading-log"),l=document.getElementById("modal-loading-progress");document.getElementById("fallback-loading-animation").classList.add("is-hidden"),s.innerHTML+="
"+t+"
",l.max=guiEasy[a].length,void 0===guiEasy.guiStats[a]&&(guiEasy.guiStats[a]={}),guiEasy.guiStats[a][e]="running"},processDone:function(e,t){let n=document.getElementById("modal-loading-progress"),a=document.getElementById("log-entry-"+e),s=Date.now()-a.dataset.timestart;if(guiEasy.guiStats.bootTime+=s,a.innerHTML+=" ("+s+"ms)",a.classList.add("loading-is-done"),"startup"===t){if(n.max===n.value){let e=document.getElementById("modal-container");document.getElementById("modal-loading-screen").classList.add("is-hidden"),e.classList.add("is-hiding"),setTimeout(function(){e.classList.add("is-hidden"),e.classList.remove("is-hiding"),e.classList.remove("is-black")},500),helpEasy.addToLogDOM("total boot time: "+guiEasy.guiStats.bootTime+"ms",1)}n.value++}guiEasy.guiStats[t][e]="done"},internet:function(){let e=!1;return!0===window.navigator.onLine&&(e=!0),e},welcomePhrase:function(){let e=(new Date).getHours();return e>17?"Good evening!":e>11?"Good afternoon!":e>5?"Good morning!":"Hi!"},urlParams:function(){let e={};return window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(t,n,a){e[n.toLowerCase()]=a.toLowerCase()}),e},locationByIP:async function(){let e="https://ipapi.co/json?at="+Date.now()+"&gui="+guiEasy.geekNameFull(),t=await fetch(e);return await t.json()},blinkElement:function(e,t){let n=document.getElementById(e);n.classList.add("main-"+t),setTimeout(function(){n.classList.remove("main-"+t)},250)},dashGroupContainerOpen:function(e=""){return""===e?"
":"
"+helpEasy.capitalWord(e)+"
"},dashBoxContainerOpen:function(){return"
"},dashContainerClose:function(){return"
"},addToolsButton:function(e){let t="",n=e.type,a="";return void 0!==e.color&&(a=" main-"+e.color),"command"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),"info"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),"scanner"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),"system"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),t},addInput:function(e){let t=e.type,n="";void 0!==e.disabled&&!0===e.disabled&&(n="disabled");let a=e.title.split(" ").join("-"),s="generic-input-",l="";!0===e.toSettings&&(s="settings-input-",l+='data-settings="'+e.settingsId+'"'),void 0!==e.settingsIP&&(l+='data-settings-ip="'+e.settingsIP+'"'),void 0!==e.settingsRegEx&&(l+='data-settings-regex="'+e.settingsRegEx+'"'),void 0!==e.valueIfBlank&&(l+='data-value-if-blank="'+e.valueIfBlank+'"'),void 0!==e.allowedBlank&&(l+='data-allowed-blank="'+e.allowedBlank+'"'),void 0!==e.optionListOffset&&(l+='data-option-list-offset="'+e.optionListOffset+'"'),void 0!==e.list2value&&(l+='data-list2value="'+e.list2value+'"'),a=s+a;let i="",o="";void 0!==e.tooltip&&(i="
"+e.tooltip+"
",o="got-tooltip");let r="
";if("string"===t&&(r+=""+helpEasy.capitalWord(e.title)+i+"",r+="\n \n '),"password"===t&&(r+=""+helpEasy.capitalWord(e.title)+i+"",r+="\n \n '),"dropdown"===t){r+=""+helpEasy.capitalWord(e.title)+i+"",r+=' \n \n ";let t=e.optionList;for(let n=0;n"+s+i+"":r+=""}r+='\n \n '}if("toggle"===t&&(r+='\n \n \n "),"number"===t){let t="";""!==e.placeholder&&(t=" ["+e.placeholder+"]"),r+='\n \n \n "}return r+="
"},addLine:function(){return"
"},openArea:function(e){let t=e.replace(" ","-")+"-area";return defaultSettings.areasMinimized?'\n
\n
'+helpEasy.capitalWord(e)+'
\n ':'\n
\n
'+helpEasy.capitalWord(e)+'
\n '},closeArea:function(){return"
"},openColumn:function(e){return void 0===e?"
":"data"===e.split("-")[0]?"
":"
"},closeColumn:function(){return"
"},checkIfIP:function(e){return/^(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(e)},screenshot:function(e){if(helpEasy.internet()){let e="screenshot-script",t={type:"wave",text:guiEasy.curly.icon(["screenshot"]),color:"inverted"},n=guiEasy.current.backgroundColor;void 0===n&&(n="#3492e2");let a=guiEasy.current.invertedColor;void 0===a&&(a="#2F4252");let s=helpEasy.capitalWord(guiEasy.current.tab.id.split("-")[0]),l=guiEasy.current.modal;void 0===l?l=guiEasy.current.tab:(n=a,s=s+"-"+document.getElementById("modal-title-text").innerText.replace(/ /g,"_")),s=guiEasy.nodes[helpEasy.getCurrentIndex()].live.json.System["Unit Name"]+"-"+s,guiEasy.popper.tryCallEvent(t);let i=document.createElement("script");i.id=e,i.onload=function(){html2canvas(l,{backgroundColor:n}).then(function(e){helpEasy.binaryDataToFile(e,"image/png",s+".png")})},i.src="https://github.com/niklasvh/html2canvas/releases/download/v1.0.0-rc.5/html2canvas.min.js",document.head.appendChild(i)}else{let e={type:"wave",text:"No internet!",color:"warning"};guiEasy.popper.tryCallEvent(e)}},binaryDataToFile:function(e,t,n){let a="temp-binary-blob-element",s=document.getElementById(a);null!==s&&s.remove();let l=document.createElement("a");l.id=a,document.body.appendChild(l),l.style.display="none",l.href=e.toDataURL(t),l.download=n,l.click()},favicon:function(e){let t=document.createElement("canvas");t.width=113,t.height=113;let n=t.getContext("2d");n.lineWidth=8,n.fillStyle=e.inverted,n.beginPath(),n.moveTo(0,15),n.lineTo(0,98),n.arc(15,98,15,Math.PI,.5*Math.PI,!0),n.lineTo(15,113),n.lineTo(98,113),n.arc(98,98,15,Math.PI,1.5*Math.PI,!0),n.lineTo(113,98),n.lineTo(113,15),n.arc(98,15,15,0,1.5*Math.PI,!0),n.lineTo(98,0),n.lineTo(15,0),n.arc(15,15,15,0,.5*Math.PI,!0),n.lineTo(0,15),n.closePath(),n.fill(),n.fillStyle=e.font,n.beginPath(),n.arc(90,90,10,0,2*Math.PI),n.closePath(),n.fill(),n.lineCap="round",n.strokeStyle=e.warning,n.beginPath(),n.moveTo(42,99),n.lineTo(99,42),n.closePath(),n.stroke(),n.strokeStyle=e.info,n.beginPath(),n.moveTo(14,99),n.lineTo(99,14),n.closePath(),n.stroke(),n.strokeStyle=e.sunny,n.beginPath(),n.moveTo(14,70),n.lineTo(70,14),n.closePath(),n.stroke(),n.strokeStyle=e.success,n.beginPath(),n.moveTo(14,42),n.lineTo(42,14),n.closePath(),n.stroke();let a=document.getElementById("favicon");null!==a&&a.remove(),(a=document.createElement("link")).id="favicon",a.type="image/x-icon",a.rel="shortcut icon",a.href=t.toDataURL("image/x-icon"),document.head.appendChild(a)}};function initiate(){for(let e=0;e0)return guiEasy.curly(e,t)}helpEasy.processDone(e,t),helpEasy.addToLogDOM(e+" loop count: "+guiEasy.syntax.curlyLC,1)},guiEasy.curly.compileArgs=function(e){let t=[],n=[];t.push(e[0].toLowerCase()),t.push(e.length-1);for(let t=1;t"+guiEasy.geekNameFull()+"
"},guiEasy.curly.unitname=function(){return"
"},guiEasy.curly.modal=function(e){let t=e[0],n="",a="";return"message"!==t?guiEasy.curly[t]:'\n \n "},guiEasy.curly.wave=function(){return'\n
\n
\n
\n '},guiEasy.curly.input=function(e){let t=e[0],n="";return"string"!==t&&"all"!==t||(n+=""),"textarea"!==t&&"all"!==t||(n+="\n
\n
\n
",t+="",n=e.right;let a="";for(let e=0;e",t+="",t+=""},guiEasy.curly.navbar.tab=function(e){return'\n
";a="",s=[],l=[],i=[]}n+="\n \n
"+e.length+" separate APs found
\n
Fetched: "+helpEasy.epochToHHMMSS(e.timestamp)+"
\n
Scheduled: "+helpEasy.epochToHHMMSS(e.timestamp+e.TTL)+"
\n \n ",set(guiEasy.nodes[t],"modal.table.wifi",n)},filelist:function(e,t){let n=["notification.dat","config.dat","security.dat"],a=guiEasy.nodes[helpEasy.getCurrentIndex()].deleteFile;guiEasy.nodes[helpEasy.getCurrentIndex()].deleteFile=null;let s='\n ",set(guiEasy.nodes[t],"modal.table.files",s)},timingstatsList:function(e,t){let n=[],a=["plugin","controller","misc"];for(let t=0;t\n \n \n \n \n \n \n ';for(let e=s.length-1;e>-1;e--){let t="";s[e].subLevels>1&&(t="
"+s[e].subKey),l+='\n \n \n \n \n \n "}l+="\n
TypeTimerProcess
\n '+s[e].type+("000"+s[e].id).slice(-3)+'\n \n '+s[e].sortValue+'\n
\n avg: '+s[e].avg+"
\n min: "+s[e].min+"
\n max: "+s[e].max+"
\n count: "+s[e].count+"
\n per sec: "+s[e]["call-per-sec"]+"\n
\n
\n "+s[e].name+t+"\n
\n
Fetched: "+helpEasy.epochToHHMMSS(e.timestamp)+"
\n
Scheduled: "+helpEasy.epochToHHMMSS(e.timestamp+e.TTL)+"
\n \n ",set(guiEasy.nodes[t],"modal.table.timingstats_json",l)},twoLevelJsonToList:function(e,t){let n=guiEasy.nodes[t].live[e],a="",a+="";for(let l=0;l"}a+="
"+helpEasy.capitalWord(i)+""+o+"
"}}return a+="\n
Fetched: "+helpEasy.epochToHHMMSS(n.timestamp)+"
\n
Scheduled: "+helpEasy.epochToHHMMSS(n.timestamp+n.TTL)+"
\n \n ",set(guiEasy.nodes[t],"modal.table."+e,a),a},guiUpdater:function(){let e=Date.now(),t=helpEasy.getCurrentIndex(),n=guiEasy.nodes[t];void 0===guiEasy.jsonPathsIN&&(guiEasy.jsonPathsIN=[]);let a=guiEasy.jsonPathsIN;for(let e=0;e";set(guiEasy.nodes[t],"modal.table.wifi",e)}if(void 0!==n.live.filelist_json)helpEasy.filelist(n.live.filelist_json,t);else{let e="";set(guiEasy.nodes[t],"modal.table.files",e)}if(void 0!==n.live.sysinfo_json)helpEasy.twoLevelJsonToList("sysinfo_json",t);else{let e="";set(guiEasy.nodes[t],"modal.table.sysinfo_json",e)}if(void 0!==n.live.timingstats_json)helpEasy.timingstatsList(n.live.timingstats_json,t);else{let e="";set(guiEasy.nodes[t],"modal.table.timingstats_json",e)}i=document.querySelectorAll("[data-modal-table]");for(let e=0;eArray(r).fill("")),u=[...Array(o)].fill("");for(let e=0;e0&&document.getElementById(a+"hr").classList.remove("is-hidden"),document.getElementById(a+"name").innerText!==d[e][n].name&&(document.getElementById(a+"name").innerText=d[e][n].name),document.getElementById(a+"value").innerText!==d[e][n].value&&(document.getElementById(a+"value").innerText=d[e][n].value)}}guiEasy.current.gui=t,void 0===guiEasy.nodes[t].stats.gui&&(guiEasy.nodes[t].stats.gui={}),guiEasy.nodes[t].stats.gui.run=Date.now()-e,guiEasy.nodes[t].stats.gui.timestamp=e},clearTaskValues:function(e,t=null){let n,a,s=guiEasy.maxValuesPerTask(),l=[],i=[];if(null!==t){for(let o=1;o<=s;o++)(n=document.querySelectorAll("[id='task-"+(e+1)+"-value-"+(t+o)+"-name']")).length>0&&l.push([].slice.call(n)),(n=document.querySelectorAll("[id='task-"+(e+1)+"-value-"+(t+o)+"-value']")).length>0&&l.push([].slice.call(n)),null!==(a=document.getElementById("task-"+(e+1)+"-value-"+(t+o)+"-hr"))&&i.push(a);l.length>0&&l.map(e=>e.map(e=>e.innerHTML="")),i.length>0&&i.map(e=>e.classList.add("is-hidden"))}else(n=document.querySelectorAll("[data-clear-task='"+(e+1)+"']")).length>0&&(l=[].slice.call(n)),l.length>0&&l.map(e=>e.innerHTML=""),(a=document.querySelectorAll("[data-clear-hr='"+(e+1)+"']")).length>0&&(i=[].slice.call(a)),i.length>0&&i.map(e=>e.classList.add("is-hidden")),(a=document.querySelectorAll("[data-hide-row='"+(e+1)+"']")).length>0&&(i=[].slice.call(a)),i.length>0&&i.map(e=>e.classList.add("is-hidden"))},uploadBinaryAsFile:function(e,t,n){let a,s,l,i=document.getElementById("label-"+n),o=i.innerText;if("generic"===e&&(a=35,l="/upload",s=guiEasy.nodes[helpEasy.getCurrentIndex()].live.sysinfo_json.storage.spiffs_free),"firmware"===e&&(helpEasy.schedulerDelay(guiEasy.nodes,helpEasy.getCurrentIndex(),6e4),a=25,l="/update",s=guiEasy.nodes[helpEasy.getCurrentIndex()].live.sysinfo_json.storage.sketch_free),(s*=1e3)100&&(e=100),i.innerText=t.name+" ("+e+"%)"},n),u=new FormData;u.append("file",t),u.append("name",e),u.append("enctype","multipart/form-data");let p="http://"+guiEasy.nodes[helpEasy.getCurrentIndex()].ip+l;fetch(p,{method:"POST",body:u}).then(e=>e.text()).then(n=>{if(clearInterval(d),i.innerText=t.name+" (100%)",helpEasy.addToLogDOM(n,3),setTimeout(function(){helpEasy.blinkElement(i.id,"success")},500),"generic"===e&&setTimeout(function(){helpEasy.schedulerBump(guiEasy.nodes[helpEasy.getCurrentIndex()].scheduler,"sysinfo_json"),helpEasy.schedulerBump(guiEasy.nodes[helpEasy.getCurrentIndex()].scheduler,"filelist_json"),i.innerText=o,helpEasy.updateIndicator()},900),"firmware"===e){helpEasy.schedulerBump(guiEasy.nodes[helpEasy.getCurrentIndex()].scheduler,"sysinfo_json");let e=30,t=setInterval(function(){i.innerText="Will reboot in "+e,--e<1&&(clearInterval(t),location.reload())},1e3)}})}},updateIndicator:async function(){setTimeout(function(){let e=guiEasy.nodes[helpEasy.getCurrentIndex()].live.sysinfo_json.storage,t=Math.floor(parseInt(e.spiffs_free)/parseInt(e.spiffs_size)*100),n=document.getElementById("modal-input-upload-storage-free"),a=document.getElementById("modal-input-upload-storage-occupied");n.style.width=t+"%",n.innerText=parseInt(e.spiffs_free)+"kB",a.style.width=100-t+"%",a.innerText=(parseInt(e.spiffs_size)-parseInt(e.spiffs_free)).toString()+"kB"},5e3)},parseHTMLstring:function(e,t,n){let a=document.createElement("html");a.innerHTML=e;let s="";return"tag"===t&&(s=a.getElementsByTagName(n)[0].innerHTML.toString()),"name"===t&&(s=a.getElementsByName(n)[0].innerHTML.toString()),"class"===t&&(s=a.getElementsByClassName(n)[0].innerHTML.toString()),"id"===t&&(s=a.getElementById(n).innerHTML.toString()),"query"===t&&(s=a.querySelectorAll(n)[0].innerHTML.toString()),a.remove(),s},guiUpdaterSettings:function(e){let t=guiEasy.nodes[helpEasy.getCurrentIndex()],n=defaultSettings,a=helpEasy.getGuiInFields();e=void 0===e?"settings":"settingsBrowser";for(let s=0;s"+helpEasy.capitalWord(e[l[i].checked+"Text"])+e.tooltip+""}}}}},gaugeLevel:function(e,t){let n,a,s=e.parentNode,l=helpEasy.getjsonPathData(e.dataset.jsonPathGauge.split("--"),t),i=parseInt(e.dataset.max),o=parseInt(e.dataset.min),r="";i>o?((a=(l-o)/(i-o))>.6&&(r="main-info"),a>.8&&(r="main-warning"),a<.05&&(r="main-success")):((a=(l-i)/(o-i))<.4&&(r="main-info"),a<1-.8&&(r="main-warning"),a>.95&&(r="main-success")),(n=574.5*(1-a))>574.5&&(n=574.5),n<0&&(n=0),s.classList.remove("main-info","main-warning"),""!==r&&s.classList.add(r),e.style="stroke-dashoffset:"+n+";"},rssiToBars:function(e){return e>=-55?"level-5":e>=-66?"level-4":e>=-77?"level-3":e>=-88?"level-2":"level-1"},rssiToSVG:function(e){let t=helpEasy.rssiToBars(e);return guiEasy.curly.icon(["wifi",t])},getjsonPathData:function(e,t){return 1===e.length?t[e[0]]:2===e.length?t[e[0]][e[1]]:3===e.length?t[e[0]][e[1]][e[2]]:4===e.length?t[e[0]][e[1]][e[2]][e[3]]:5===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]]:6===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]][e[5]]:7===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]][e[5]][e[6]]:8===e.length?t[e[0]][e[1]][e[2]][e[3]][e[4]][e[5]][e[6]][e[7]]:void 0},sortObjectArray:e=>(t,n)=>t[e]===n[e]?0:t[e]=t&&console.log(e)},numberOfFound:function(e,t){return((e||"").match(t)||[]).length},findInArray:function(e,t){return t.indexOf(e)>-1},listOfProcesses:function(e,t,n,a){let s=document.getElementById("modal-loading-log"),l=document.getElementById("modal-loading-progress");document.getElementById("fallback-loading-animation").classList.add("is-hidden"),s.innerHTML+="
"+t+"
",l.max=guiEasy[a].length,void 0===guiEasy.guiStats[a]&&(guiEasy.guiStats[a]={}),guiEasy.guiStats[a][e]="running"},processDone:function(e,t){let n=document.getElementById("modal-loading-progress"),a=document.getElementById("log-entry-"+e),s=Date.now()-a.dataset.timestart;if(guiEasy.guiStats.bootTime+=s,a.innerHTML+=" ("+s+"ms)",a.classList.add("loading-is-done"),"startup"===t){if(n.max===n.value){let e=document.getElementById("modal-container");document.getElementById("modal-loading-screen").classList.add("is-hidden"),e.classList.add("is-hiding"),setTimeout(function(){e.classList.add("is-hidden"),e.classList.remove("is-hiding"),e.classList.remove("is-black")},500),helpEasy.addToLogDOM("total boot time: "+guiEasy.guiStats.bootTime+"ms",1)}n.value++}guiEasy.guiStats[t][e]="done"},internet:function(){let e=!1;return!0===window.navigator.onLine&&(e=!0),e},welcomePhrase:function(){let e=(new Date).getHours();return e>17?"Good evening!":e>11?"Good afternoon!":e>5?"Good morning!":"Hi!"},urlParams:function(){let e={};return window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(t,n,a){e[n.toLowerCase()]=a.toLowerCase()}),e},locationByIP:async function(){let e="https://ipapi.co/json?at="+Date.now()+"&gui="+guiEasy.geekNameFull(),t=await fetch(e);return await t.json()},blinkElement:function(e,t){let n=document.getElementById(e);n.classList.add("main-"+t),setTimeout(function(){n.classList.remove("main-"+t)},250)},dashGroupContainerOpen:function(e=""){return""===e?"
":"
"+helpEasy.capitalWord(e)+"
"},dashBoxContainerOpen:function(){return"
"},dashContainerClose:function(){return"
"},addToolsButton:function(e){let t="",n=e.type,a="";return void 0!==e.color&&(a=" main-"+e.color),"command"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),"info"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),"scanner"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),"system"===n&&(t+="\n
\n \n
'+helpEasy.capitalWord(e.text)+"
\n
\n "),t},addInput:function(e){let t=e.type,n="";void 0!==e.disabled&&!0===e.disabled&&(n="disabled");let a=e.title.split(" ").join("-"),s="generic-input-",l="";!0===e.toSettings&&(s="settings-input-",l+='data-settings="'+e.settingsId+'"'),void 0!==e.settingsIP&&(l+='data-settings-ip="'+e.settingsIP+'"'),void 0!==e.settingsRegEx&&(l+='data-settings-regex="'+e.settingsRegEx+'"'),void 0!==e.valueIfBlank&&(l+='data-value-if-blank="'+e.valueIfBlank+'"'),void 0!==e.allowedBlank&&(l+='data-allowed-blank="'+e.allowedBlank+'"'),void 0!==e.optionListOffset&&(l+='data-option-list-offset="'+e.optionListOffset+'"'),void 0!==e.list2value&&(l+='data-list2value="'+e.list2value+'"'),a=s+a;let i="",o="";void 0!==e.tooltip&&(i="
"+e.tooltip+"
",o="got-tooltip");let r="
";if("string"===t&&(r+=""+helpEasy.capitalWord(e.title)+i+"",r+="\n \n '),"password"===t&&(r+=""+helpEasy.capitalWord(e.title)+i+"",r+="\n \n '),"dropdown"===t){r+=""+helpEasy.capitalWord(e.title)+i+"",r+=' \n \n ";let t=e.optionList;for(let n=0;n"+s+i+"":r+=""}r+='\n \n '}if("toggle"===t&&(r+='\n \n \n "),"number"===t){let t="";""!==e.placeholder&&(t=" ["+e.placeholder+"]"),r+='\n \n \n "}return r+="
"},addLine:function(){return"
"},openArea:function(e){let t=e.replace(" ","-")+"-area";return defaultSettings.areasMinimized?'\n
\n
'+helpEasy.capitalWord(e)+'
\n ':'\n
\n
'+helpEasy.capitalWord(e)+'
\n '},closeArea:function(){return"
"},openColumn:function(e){return void 0===e?"
":"data"===e.split("-")[0]?"
":"
"},closeColumn:function(){return"
"},checkIfIP:function(e){return/^(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(e)},screenshot:function(e){if(helpEasy.internet()){let e="screenshot-script",t={type:"wave",text:guiEasy.curly.icon(["screenshot"]),color:"inverted"},n=guiEasy.current.backgroundColor;void 0===n&&(n="#3492e2");let a=guiEasy.current.invertedColor;void 0===a&&(a="#2F4252");let s=helpEasy.capitalWord(guiEasy.current.tab.id.split("-")[0]),l=guiEasy.current.modal;void 0===l?l=guiEasy.current.tab:(n=a,s=s+"-"+document.getElementById("modal-title-text").innerText.replace(/ /g,"_")),s=guiEasy.nodes[helpEasy.getCurrentIndex()].live.json.System["Unit Name"]+"-"+s,guiEasy.popper.tryCallEvent(t);let i=document.createElement("script");i.id=e,i.onload=function(){html2canvas(l,{backgroundColor:n}).then(function(e){helpEasy.binaryDataToFile(e,"image/png",s+".png")})},i.src="https://github.com/niklasvh/html2canvas/releases/download/v1.0.0-rc.5/html2canvas.min.js",document.head.appendChild(i)}else{let e={type:"wave",text:"No internet!",color:"warning"};guiEasy.popper.tryCallEvent(e)}},binaryDataToFile:function(e,t,n){let a="temp-binary-blob-element",s=document.getElementById(a);null!==s&&s.remove();let l=document.createElement("a");l.id=a,document.body.appendChild(l),l.style.display="none",l.href=e.toDataURL(t),l.download=n,l.click()},favicon:function(e){let t=document.createElement("canvas");t.width=113,t.height=113;let n=t.getContext("2d");n.lineWidth=8,n.fillStyle=e.inverted,n.beginPath(),n.moveTo(0,15),n.lineTo(0,98),n.arc(15,98,15,Math.PI,.5*Math.PI,!0),n.lineTo(15,113),n.lineTo(98,113),n.arc(98,98,15,Math.PI,1.5*Math.PI,!0),n.lineTo(113,98),n.lineTo(113,15),n.arc(98,15,15,0,1.5*Math.PI,!0),n.lineTo(98,0),n.lineTo(15,0),n.arc(15,15,15,0,.5*Math.PI,!0),n.lineTo(0,15),n.closePath(),n.fill(),n.fillStyle=e.font,n.beginPath(),n.arc(90,90,10,0,2*Math.PI),n.closePath(),n.fill(),n.lineCap="round",n.strokeStyle=e.warning,n.beginPath(),n.moveTo(42,99),n.lineTo(99,42),n.closePath(),n.stroke(),n.strokeStyle=e.info,n.beginPath(),n.moveTo(14,99),n.lineTo(99,14),n.closePath(),n.stroke(),n.strokeStyle=e.sunny,n.beginPath(),n.moveTo(14,70),n.lineTo(70,14),n.closePath(),n.stroke(),n.strokeStyle=e.success,n.beginPath(),n.moveTo(14,42),n.lineTo(42,14),n.closePath(),n.stroke();let a=document.getElementById("favicon");null!==a&&a.remove(),(a=document.createElement("link")).id="favicon",a.type="image/x-icon",a.rel="shortcut icon",a.href=t.toDataURL("image/x-icon"),document.head.appendChild(a)}};function initiate(){for(let e=0;e0)return guiEasy.curly(e,t)}helpEasy.processDone(e,t),helpEasy.addToLogDOM(e+" loop count: "+guiEasy.syntax.curlyLC,1)},guiEasy.curly.compileArgs=function(e){let t=[],n=[];t.push(e[0].toLowerCase()),t.push(e.length-1);for(let t=1;t"+guiEasy.geekNameFull()+"
"},guiEasy.curly.unitname=function(){return"
"},guiEasy.curly.modal=function(e){let t=e[0],n="",a="";return"message"!==t?guiEasy.curly[t]:'\n \n "},guiEasy.curly.wave=function(){return'\n
\n
\n
\n '},guiEasy.curly.input=function(e){let t=e[0],n="";return"string"!==t&&"all"!==t||(n+=""),"textarea"!==t&&"all"!==t||(n+="\n
\n
\n
",t+="",n=e.right;let a="";for(let e=0;e",t+="",t+=""},guiEasy.curly.navbar.tab=function(e){return'\n