diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eaf3984e..d0fb65c9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,6 +28,7 @@ jobs: run: | sed -i 's/NO_AMS2MQTT_PRICE_KEY/AMS2MQTT_PRICE_KEY="${{secrets.AMS2MQTT_PRICE_KEY}}"/g' platformio.ini sed -i 's/NO_AMS2MQTT_PRICE_AUTHENTICATION/AMS2MQTT_PRICE_AUTHENTICATION="${{secrets.AMS2MQTT_PRICE_AUTHENTICATION}}"/g' platformio.ini + sed -i 's/NO_AMS2MQTT_SC_KEY/AMS2MQTT_SC_KEY=\\"${{secrets.AMS2MQTT_SC_KEY}}\\"/g' platformio.ini sed -i 's/NO_ENERGY_SPEEDOMETER_USER/ENERGY_SPEEDOMETER_USER=\\"${{secrets.ENERGY_SPEEDOMETER_USER}}\\"/g' platformio.ini sed -i 's/NO_ENERGY_SPEEDOMETER_PASS/ENERGY_SPEEDOMETER_PASS=\\"${{secrets.ENERGY_SPEEDOMETER_PASS}}\\"/g' platformio.ini @@ -146,6 +147,29 @@ jobs: asset_name: ams2mqtt-esp32s2-${{ steps.release_tag.outputs.tag }}.zip asset_content_type: application/zip + - name: Build esp32s3 firmware + run: pio run -e esp32s3 + - name: Create esp32s3 zip file + run: /bin/sh scripts/esp32s3/mkzip.sh + - name: Upload esp32s3 binary to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .pio/build/esp32s3/firmware.bin + asset_name: ams2mqtt-esp32s3-${{ steps.release_tag.outputs.tag }}.bin + asset_content_type: application/octet-stream + - name: Upload esp32s3 zip to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: esp32s3.zip + asset_name: ams2mqtt-esp32s3-${{ steps.release_tag.outputs.tag }}.zip + asset_content_type: application/zip + - name: Build esp32solo firmware run: pio run -e esp32solo - name: Create esp32solo zip file diff --git a/.gitignore b/.gitignore index ac16b110..cdd141f1 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ platformio-user.ini node_modules /gui/dist /scripts/*dev +/src/KmpCommunicator.cpp +/src/KmpCommunicatorDefs.h diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index 35f478c3..93104868 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -1,31 +1,54 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _AMSCONFIGURATION_h #define _AMSCONFIGURATION_h #include #include "Arduino.h" #define EEPROM_SIZE 1024*3 -#define EEPROM_CHECK_SUM 103 // Used to check if config is stored. Change if structure changes +#define EEPROM_CHECK_SUM 104 // Used to check if config is stored. Change if structure changes #define EEPROM_CLEARED_INDICATOR 0xFC #define EEPROM_CONFIG_ADDRESS 0 #define EEPROM_TEMP_CONFIG_ADDRESS 2048 #define CONFIG_SYSTEM_START 8 -#define CONFIG_METER_START 32 -#define CONFIG_UPGRADE_INFO_START 216 -#define CONFIG_UI_START 248 -#define CONFIG_GPIO_START 266 -#define CONFIG_ENTSOE_START 290 -#define CONFIG_WIFI_START 360 -#define CONFIG_ENERGYACCOUNTING_START 576 -#define CONFIG_WEB_START 648 -#define CONFIG_DEBUG_START 824 -#define CONFIG_DOMOTICZ_START 856 -#define CONFIG_NTP_START 872 -#define CONFIG_MQTT_START 1004 -#define CONFIG_HA_START 1680 - -#define CONFIG_METER_START_93 224 - +#define CONFIG_UPGRADE_INFO_START 16 +#define CONFIG_NETWORK_START 40 +#define CONFIG_METER_START 296 +#define CONFIG_GPIO_START 368 +#define CONFIG_PRICE_START 400 +#define CONFIG_ENERGYACCOUNTING_START 472 +#define CONFIG_WEB_START 496 +#define CONFIG_DEBUG_START 632 +#define CONFIG_NTP_START 640 +#define CONFIG_MQTT_START 768 +#define CONFIG_DOMOTICZ_START 1536 +#define CONFIG_HA_START 1552 +#define CONFIG_UI_START 1720 +#define CONFIG_CLOUD_START 1742 + +#define CONFIG_METER_START_103 32 +#define CONFIG_UPGRADE_INFO_START_103 216 +#define CONFIG_UI_START_103 248 +#define CONFIG_GPIO_START_103 266 +#define CONFIG_ENTSOE_START_103 290 +#define CONFIG_WIFI_START_103 360 +#define CONFIG_ENERGYACCOUNTING_START_103 576 +#define CONFIG_WEB_START_103 648 +#define CONFIG_DEBUG_START_103 824 +#define CONFIG_DOMOTICZ_START_103 856 +#define CONFIG_NTP_START_103 872 +#define CONFIG_MQTT_START_103 1004 +#define CONFIG_HA_START_103 1680 + +#define LED_BEHAVIOUR_DEFAULT 0 +#define LED_BEHAVIOUR_BOOT 1 +#define LED_BEHAVIOUR_ERROR_ONLY 3 +#define LED_BEHAVIOUR_OFF 9 struct SystemConfig { uint8_t boardType; @@ -34,9 +57,9 @@ struct SystemConfig { uint8_t dataCollectionConsent; // 0 = unknown, 1 = accepted, 2 = declined char country[3]; uint8_t energyspeedometer; -}; // 8 +}; // 9 -struct WiFiConfig { +struct NetworkConfig { char ssid[32]; char psk[64]; char ip[16]; @@ -49,8 +72,9 @@ struct WiFiConfig { uint8_t power; uint8_t sleep; uint8_t use11b; - bool unused; -}; // 213 + bool ipv6; + uint8_t mode; +}; // 214 struct MqttConfig { char host[128]; @@ -65,6 +89,13 @@ struct MqttConfig { }; // 676 struct WebConfig { + uint8_t security; + char username[37]; + char password[37]; + char context[37]; +}; // 112 + +struct WebConfig103 { uint8_t security; char username[64]; char password[64]; @@ -86,41 +117,10 @@ struct MeterConfig { uint8_t source; uint8_t parser; uint8_t bufferSize; -}; // 62 - -struct MeterConfig100 { - uint32_t baud; - uint8_t parity; - bool invert; - uint8_t distributionSystem; - uint8_t mainFuse; - uint8_t productionCapacity; - uint8_t encryptionKey[16]; - uint8_t authenticationKey[16]; - uint32_t wattageMultiplier; - uint32_t voltageMultiplier; - uint32_t amperageMultiplier; - uint32_t accumulatedMultiplier; - uint8_t source; - uint8_t parser; -}; // 59 - -struct MeterConfig95 { - uint32_t baud; - uint8_t parity; - bool invert; - uint8_t distributionSystem; - uint8_t mainFuse; - uint8_t productionCapacity; - uint8_t encryptionKey[16]; - uint8_t authenticationKey[16]; - uint16_t wattageMultiplier; - uint16_t voltageMultiplier; - uint16_t amperageMultiplier; - uint16_t accumulatedMultiplier; - uint8_t source; - uint8_t parser; -}; // 50 + uint8_t rxPin; + bool rxPinPullup; + uint8_t txPin; +}; // 65 struct DebugConfig { bool telnet; @@ -129,6 +129,26 @@ struct DebugConfig { }; // 3 struct GpioConfig { + uint8_t apPin; + uint8_t ledPin; + bool ledInverted; + uint8_t ledPinRed; + uint8_t ledPinGreen; + uint8_t ledPinBlue; + bool ledRgbInverted; + uint8_t tempSensorPin; + uint8_t tempAnalogSensorPin; + uint8_t vccPin; + int16_t vccOffset; + uint16_t vccMultiplier; + uint8_t vccBootLimit; + uint16_t vccResistorGnd; + uint16_t vccResistorVcc; + uint8_t ledDisablePin; + uint8_t ledBehaviour; +}; // 21 + +struct GpioConfig103 { uint8_t hanPin; uint8_t apPin; uint8_t ledPin; @@ -146,7 +166,9 @@ struct GpioConfig { uint16_t vccResistorGnd; uint16_t vccResistorVcc; bool hanPinPullup; -}; // 21 + uint8_t ledDisablePin; + uint8_t ledBehaviour; +}; // 23 struct DomoticzConfig { uint16_t elidx; @@ -169,21 +191,13 @@ struct NtpConfig { char timezone[32]; }; // 98 -struct NtpConfig96 { - bool enable; - bool dhcp; - int16_t offset; - int16_t summerOffset; - char server[64]; -}; // 70 - -struct EntsoeConfig { - char token[37]; +struct PriceServiceConfig { + char entsoeToken[37]; char area[17]; char currency[4]; - uint32_t multiplier; + uint32_t unused1; bool enabled; - uint16_t fixedPrice; + uint16_t unused2; }; // 64 struct EnergyAccountingConfig { @@ -208,13 +222,12 @@ struct UiConfig { uint8_t showDayPlot; uint8_t showMonthPlot; uint8_t showTemperaturePlot; -}; // 11 - -struct TempSensorConfig { - uint8_t address[8]; - char name[16]; - bool common; -}; + uint8_t showRealtimePlot; + uint8_t showPerPhasePower; + uint8_t showPowerFactor; + uint8_t darkMode; + char language[3]; +}; // 15 struct UpgradeInformation { char fromVersion[8]; @@ -223,6 +236,14 @@ struct UpgradeInformation { int16_t errorCode; }; // 20 +struct CloudConfig { + bool enabled; + uint8_t interval; + char hostname[64]; + uint16_t port; + uint8_t clientId[16]; +}; // 69 + class AmsConfiguration { public: bool hasConfig(); @@ -235,12 +256,12 @@ class AmsConfiguration { bool isSystemConfigChanged(); void ackSystemConfigChanged(); - bool getWiFiConfig(WiFiConfig&); - bool setWiFiConfig(WiFiConfig&); - void clearWifi(WiFiConfig&); - void clearWifiIp(WiFiConfig&); - bool isWifiChanged(); - void ackWifiChange(); + bool getNetworkConfig(NetworkConfig&); + bool setNetworkConfig(NetworkConfig&); + void clearNetworkConfig(NetworkConfig&); + void clearNetworkConfigIp(NetworkConfig&); + bool isNetworkConfigChanged(); + void ackNetworkConfigChange(); bool getMqttConfig(MqttConfig&); bool setMqttConfig(MqttConfig&); @@ -251,7 +272,7 @@ class AmsConfiguration { bool getWebConfig(WebConfig&); bool setWebConfig(WebConfig&); - void clearAuth(WebConfig&); + void clearWebConfig(WebConfig&); bool getMeterConfig(MeterConfig&); bool setMeterConfig(MeterConfig&); @@ -286,11 +307,11 @@ class AmsConfiguration { bool isNtpChanged(); void ackNtpChange(); - bool getEntsoeConfig(EntsoeConfig&); - bool setEntsoeConfig(EntsoeConfig&); - void clearEntsoe(EntsoeConfig&); - bool isEntsoeChanged(); - void ackEntsoeChange(); + bool getPriceServiceConfig(PriceServiceConfig&); + bool setPriceServiceConfig(PriceServiceConfig&); + void clearPriceServiceConfig(PriceServiceConfig&); + bool isPriceServiceChanged(); + void ackPriceServiceChange(); bool getEnergyAccountingConfig(EnergyAccountingConfig&); bool setEnergyAccountingConfig(EnergyAccountingConfig&); @@ -301,19 +322,20 @@ class AmsConfiguration { bool getUiConfig(UiConfig&); bool setUiConfig(UiConfig&); void clearUiConfig(UiConfig&); - - void loadTempSensors(); - void saveTempSensors(); - uint8_t getTempSensorCount(); - TempSensorConfig* getTempSensorConfig(uint8_t address[8]); - void updateTempSensorConfig(uint8_t address[8], const char name[32], bool common); - - bool isSensorAddressEqual(uint8_t a[8], uint8_t b[8]); + void setUiLanguageChanged(); + bool isUiLanguageChanged(); + void ackUiLanguageChange(); bool getUpgradeInformation(UpgradeInformation&); bool setUpgradeInformation(int16_t exitCode, int16_t errorCode, const char* currentVersion, const char* nextVersion); void clearUpgradeInformation(UpgradeInformation&); + bool getCloudConfig(CloudConfig&); + bool setCloudConfig(CloudConfig&); + void clearCloudConfig(CloudConfig&); + bool isCloudChanged(); + void ackCloudConfig(); + void clear(); protected: @@ -321,18 +343,11 @@ class AmsConfiguration { private: uint8_t configVersion = 0; - bool sysChanged = false, wifiChanged = false, mqttChanged = false, meterChanged = true, ntpChanged = true, entsoeChanged = false, energyAccountingChanged = true; - - uint8_t tempSensorCount = 0; - TempSensorConfig** tempSensors = NULL; + bool sysChanged = false, networkChanged, mqttChanged, meterChanged = true, ntpChanged = true, priceChanged = false, energyAccountingChanged = true, cloudChanged = true, uiLanguageChanged = false; - bool relocateConfig93(); // 2.1.0 - bool relocateConfig94(); // 2.1.0 - bool relocateConfig95(); // 2.1.4 - bool relocateConfig96(); // 2.1.14 - bool relocateConfig100(); // 2.2-dev bool relocateConfig101(); // 2.2.0 through 2.2.8 bool relocateConfig102(); // 2.2.9 through 2.2.11 + bool relocateConfig103(); // 2.2.12, until, but not including 2.3 void saveToFs(); bool loadFromFs(uint8_t version); diff --git a/lib/AmsConfiguration/include/AmsStorage.h b/lib/AmsConfiguration/include/AmsStorage.h index 41abab10..31cda4ef 100644 --- a/lib/AmsConfiguration/include/AmsStorage.h +++ b/lib/AmsConfiguration/include/AmsStorage.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _AMSSTORAGE_H #define _AMSSTORAGE_H @@ -12,5 +18,6 @@ #define FILE_ENERGYACCOUNTING "/energyaccounting.bin" #define FILE_CFG "/configfile.cfg" +#define FILE_PRICE_CONF "/priceconf.bin" #endif diff --git a/lib/AmsConfiguration/include/Timezones.h b/lib/AmsConfiguration/include/Timezones.h index 1e7be4f4..eaa62a02 100644 --- a/lib/AmsConfiguration/include/Timezones.h +++ b/lib/AmsConfiguration/include/Timezones.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include #define JULY1970 15634800 diff --git a/lib/AmsConfiguration/include/hexutils.h b/lib/AmsConfiguration/include/hexutils.h index 3316a9cc..45d6285a 100644 --- a/lib/AmsConfiguration/include/hexutils.h +++ b/lib/AmsConfiguration/include/hexutils.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _HEXUTILS_H #define _HEXUTILS_H diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index 481fd8eb..f52b88aa 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -1,5 +1,14 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "AmsConfiguration.h" #include "hexutils.h" +#if defined(ESP32) +#include "ESPRandom.h" +#endif bool AmsConfiguration::getSystemConfig(SystemConfig& config) { EEPROM.begin(EEPROM_SIZE); @@ -14,7 +23,7 @@ bool AmsConfiguration::getSystemConfig(SystemConfig& config) { config.userConfigured = false; config.dataCollectionConsent = 0; config.energyspeedometer = 0; - strcpy(config.country, ""); + memset(config.country, 0, 3); return false; } } @@ -45,38 +54,40 @@ void AmsConfiguration::ackSystemConfigChanged() { sysChanged = false; } -bool AmsConfiguration::getWiFiConfig(WiFiConfig& config) { +bool AmsConfiguration::getNetworkConfig(NetworkConfig& config) { if(hasConfig()) { EEPROM.begin(EEPROM_SIZE); - EEPROM.get(CONFIG_WIFI_START, config); + EEPROM.get(CONFIG_NETWORK_START, config); EEPROM.end(); if(config.sleep > 2) config.sleep = 1; return true; } else { - clearWifi(config); + clearNetworkConfig(config); return false; } } -bool AmsConfiguration::setWiFiConfig(WiFiConfig& config) { - WiFiConfig existing; +bool AmsConfiguration::setNetworkConfig(NetworkConfig& config) { + NetworkConfig existing; if(config.sleep > 2) config.sleep = 1; - if(getWiFiConfig(existing)) { - wifiChanged |= strcmp(config.ssid, existing.ssid) != 0; - wifiChanged |= strcmp(config.psk, existing.psk) != 0; - wifiChanged |= strcmp(config.ip, existing.ip) != 0; + if(config.mode < 1 || config.mode > 4) config.mode = 1; + if(getNetworkConfig(existing)) { + networkChanged |= strcmp(config.ssid, existing.ssid) != 0; + networkChanged |= strcmp(config.psk, existing.psk) != 0; + networkChanged |= strcmp(config.ip, existing.ip) != 0; if(strlen(config.ip) > 0) { - wifiChanged |= strcmp(config.gateway, existing.gateway) != 0; - wifiChanged |= strcmp(config.subnet, existing.subnet) != 0; - wifiChanged |= strcmp(config.dns1, existing.dns1) != 0; - wifiChanged |= strcmp(config.dns2, existing.dns2) != 0; + networkChanged |= strcmp(config.gateway, existing.gateway) != 0; + networkChanged |= strcmp(config.subnet, existing.subnet) != 0; + networkChanged |= strcmp(config.dns1, existing.dns1) != 0; + networkChanged |= strcmp(config.dns2, existing.dns2) != 0; } - wifiChanged |= strcmp(config.hostname, existing.hostname) != 0; - wifiChanged |= config.power != existing.power; - wifiChanged |= config.sleep != existing.sleep; - wifiChanged |= config.use11b != existing.use11b; + networkChanged |= strcmp(config.hostname, existing.hostname) != 0; + networkChanged |= config.power != existing.power; + networkChanged |= config.sleep != existing.sleep; + networkChanged |= config.use11b != existing.use11b; + networkChanged |= config.mode != existing.mode; } else { - wifiChanged = true; + networkChanged = true; } stripNonAscii((uint8_t*) config.ssid, 32, true); @@ -89,16 +100,16 @@ bool AmsConfiguration::setWiFiConfig(WiFiConfig& config) { stripNonAscii((uint8_t*) config.hostname, 32); EEPROM.begin(EEPROM_SIZE); - EEPROM.put(CONFIG_WIFI_START, config); + EEPROM.put(CONFIG_NETWORK_START, config); bool ret = EEPROM.commit(); EEPROM.end(); return ret; } -void AmsConfiguration::clearWifi(WiFiConfig& config) { - strcpy(config.ssid, ""); - strcpy(config.psk, ""); - clearWifiIp(config); +void AmsConfiguration::clearNetworkConfig(NetworkConfig& config) { + memset(config.ssid, 0, 32); + memset(config.psk, 0, 64); + clearNetworkConfigIp(config); uint16_t chipId; #if defined(ESP32) @@ -112,22 +123,23 @@ void AmsConfiguration::clearWifi(WiFiConfig& config) { config.mdns = true; config.sleep = 0xFF; config.use11b = 1; + config.ipv6 = false; } -void AmsConfiguration::clearWifiIp(WiFiConfig& config) { - strcpy(config.ip, ""); - strcpy(config.gateway, ""); - strcpy(config.subnet, ""); - strcpy(config.dns1, ""); - strcpy(config.dns2, ""); +void AmsConfiguration::clearNetworkConfigIp(NetworkConfig& config) { + memset(config.ip, 0, 16); + memset(config.gateway, 0, 16); + memset(config.subnet, 0, 16); + memset(config.dns1, 0, 16); + memset(config.dns2, 0, 16); } -bool AmsConfiguration::isWifiChanged() { - return wifiChanged; +bool AmsConfiguration::isNetworkConfigChanged() { + return networkChanged; } -void AmsConfiguration::ackWifiChange() { - wifiChanged = false; +void AmsConfiguration::ackNetworkConfigChange() { + networkChanged = false; } bool AmsConfiguration::getMqttConfig(MqttConfig& config) { @@ -173,13 +185,14 @@ bool AmsConfiguration::setMqttConfig(MqttConfig& config) { } void AmsConfiguration::clearMqtt(MqttConfig& config) { - strcpy(config.host, ""); + memset(config.host, 0, 128); config.port = 1883; - strcpy(config.clientId, ""); - strcpy(config.publishTopic, ""); - strcpy(config.subscribeTopic, ""); - strcpy(config.username, ""); - strcpy(config.password, ""); + + memset(config.clientId, 0, 32); + memset(config.publishTopic, 0, 64); + memset(config.subscribeTopic, 0, 64); + memset(config.username, 0, 128); + memset(config.password, 0, 256); config.payloadFormat = 0; config.ssl = false; } @@ -203,15 +216,16 @@ bool AmsConfiguration::getWebConfig(WebConfig& config) { EEPROM.end(); return true; } else { - clearAuth(config); + clearWebConfig(config); return false; } } bool AmsConfiguration::setWebConfig(WebConfig& config) { - stripNonAscii((uint8_t*) config.username, 64); - stripNonAscii((uint8_t*) config.password, 64); + stripNonAscii((uint8_t*) config.username, 37); + stripNonAscii((uint8_t*) config.password, 37); + stripNonAscii((uint8_t*) config.context, 37); EEPROM.begin(EEPROM_SIZE); EEPROM.put(CONFIG_WEB_START, config); @@ -220,10 +234,11 @@ bool AmsConfiguration::setWebConfig(WebConfig& config) { return ret; } -void AmsConfiguration::clearAuth(WebConfig& config) { +void AmsConfiguration::clearWebConfig(WebConfig& config) { config.security = 0; - strcpy(config.username, ""); - strcpy(config.password, ""); + memset(config.username, 0, 37); + memset(config.password, 0, 37); + memset(config.context, 0, 37); } bool AmsConfiguration::getMeterConfig(MeterConfig& config) { @@ -254,6 +269,15 @@ bool AmsConfiguration::setMeterConfig(MeterConfig& config) { meterChanged |= strcmp((char*) config.encryptionKey, (char*) existing.encryptionKey); meterChanged |= strcmp((char*) config.authenticationKey, (char*) existing.authenticationKey); meterChanged |= config.bufferSize != existing.bufferSize; + meterChanged |= config.rxPin != existing.rxPin; + meterChanged |= config.rxPinPullup != existing.rxPinPullup; + meterChanged |= config.txPin != existing.txPin; + meterChanged |= config.wattageMultiplier != existing.wattageMultiplier; + meterChanged |= config.voltageMultiplier != existing.voltageMultiplier; + meterChanged |= config.amperageMultiplier != existing.amperageMultiplier; + meterChanged |= config.accumulatedMultiplier != existing.accumulatedMultiplier; + meterChanged |= config.source != existing.source; + meterChanged |= config.parser != existing.parser; } else { meterChanged = true; } @@ -265,6 +289,9 @@ bool AmsConfiguration::setMeterConfig(MeterConfig& config) { } void AmsConfiguration::clearMeter(MeterConfig& config) { + config.rxPin = 0xFF; + config.txPin = 0xFF; + config.rxPinPullup = true; config.baud = 0; config.parity = 0; config.invert = false; @@ -397,16 +424,15 @@ bool AmsConfiguration::setHomeAssistantConfig(HomeAssistantConfig& config) { } void AmsConfiguration::clearHomeAssistantConfig(HomeAssistantConfig& config) { - strcpy(config.discoveryPrefix, ""); - strcpy(config.discoveryHostname, ""); - strcpy(config.discoveryNameTag, ""); + memset(config.discoveryPrefix, 0, 64); + memset(config.discoveryHostname, 0, 64); + memset(config.discoveryNameTag, 0, 16); } bool AmsConfiguration::pinUsed(uint8_t pin, GpioConfig& config) { if(pin == 0xFF) return false; return - pin == config.hanPin || pin == config.apPin || pin == config.ledPin || pin == config.ledPinRed || @@ -414,7 +440,8 @@ bool AmsConfiguration::pinUsed(uint8_t pin, GpioConfig& config) { pin == config.ledPinBlue || pin == config.tempSensorPin || pin == config.tempAnalogSensorPin || - pin == config.vccPin + pin == config.vccPin || + pin == config.ledDisablePin ; } @@ -433,10 +460,6 @@ bool AmsConfiguration::getGpioConfig(GpioConfig& config) { bool AmsConfiguration::setGpioConfig(GpioConfig& config) { GpioConfig existing; - if(getGpioConfig(existing)) { - meterChanged |= config.hanPin != existing.hanPin; - meterChanged |= config.hanPinPullup != existing.hanPinPullup; - } /* This currently does not work, as it checks its own pin if(pinUsed(config.hanPin, config)) { debugger->println(F("HAN pin already used")); @@ -474,6 +497,10 @@ bool AmsConfiguration::setGpioConfig(GpioConfig& config) { debugger->println(F("Vcc pin already used")); return false; } + if(pinUsed(config.ledDisablePin, config)) { + debugger->println(F("ledDisablePin already used")); + return false; + } */ if(config.apPin >= 0) pinMode(config.apPin, INPUT_PULLUP); @@ -486,8 +513,6 @@ bool AmsConfiguration::setGpioConfig(GpioConfig& config) { } void AmsConfiguration::clearGpio(GpioConfig& config) { - config.hanPin = 3; - config.hanPinPullup = true; config.apPin = 0xFF; config.ledPin = 0xFF; config.ledInverted = true; @@ -503,6 +528,8 @@ void AmsConfiguration::clearGpio(GpioConfig& config) { config.vccBootLimit = 0; config.vccResistorGnd = 0; config.vccResistorVcc = 0; + config.ledDisablePin = 0xFF; + config.ledBehaviour = LED_BEHAVIOUR_DEFAULT; } bool AmsConfiguration::getNtpConfig(NtpConfig& config) { @@ -522,7 +549,7 @@ bool AmsConfiguration::setNtpConfig(NtpConfig& config) { if(getNtpConfig(existing)) { if(config.enable != existing.enable) { if(!existing.enable) { - wifiChanged = true; + networkChanged = true; } else { ntpChanged = true; } @@ -555,64 +582,62 @@ void AmsConfiguration::ackNtpChange() { void AmsConfiguration::clearNtp(NtpConfig& config) { config.enable = true; config.dhcp = true; - strcpy(config.server, "pool.ntp.org"); - strcpy(config.timezone, "Europe/Oslo"); + strcpy_P(config.server, PSTR("pool.ntp.org")); + strcpy_P(config.timezone, PSTR("Europe/Oslo")); } -bool AmsConfiguration::getEntsoeConfig(EntsoeConfig& config) { +bool AmsConfiguration::getPriceServiceConfig(PriceServiceConfig& config) { if(hasConfig()) { EEPROM.begin(EEPROM_SIZE); - EEPROM.get(CONFIG_ENTSOE_START, config); + EEPROM.get(CONFIG_PRICE_START, config); EEPROM.end(); - if(strlen(config.token) != 0 && strlen(config.token) != 36) { - clearEntsoe(config); + if(strlen(config.entsoeToken) != 0 && strlen(config.entsoeToken) != 36) { + clearPriceServiceConfig(config); } return true; } else { - clearEntsoe(config); + clearPriceServiceConfig(config); return false; } } -bool AmsConfiguration::setEntsoeConfig(EntsoeConfig& config) { - EntsoeConfig existing; - if(getEntsoeConfig(existing)) { - entsoeChanged |= strcmp(config.token, existing.token) != 0; - entsoeChanged |= strcmp(config.area, existing.area) != 0; - entsoeChanged |= strcmp(config.currency, existing.currency) != 0; - entsoeChanged |= config.multiplier != existing.multiplier; - entsoeChanged |= config.enabled != existing.enabled; - entsoeChanged |= config.fixedPrice != existing.fixedPrice; +bool AmsConfiguration::setPriceServiceConfig(PriceServiceConfig& config) { + PriceServiceConfig existing; + if(getPriceServiceConfig(existing)) { + priceChanged |= strcmp(config.entsoeToken, existing.entsoeToken) != 0; + priceChanged |= strcmp(config.area, existing.area) != 0; + priceChanged |= strcmp(config.currency, existing.currency) != 0; + priceChanged |= config.enabled != existing.enabled; } else { - entsoeChanged = true; + priceChanged = true; } - stripNonAscii((uint8_t*) config.token, 37); + stripNonAscii((uint8_t*) config.entsoeToken, 37); stripNonAscii((uint8_t*) config.area, 17); stripNonAscii((uint8_t*) config.currency, 4); EEPROM.begin(EEPROM_SIZE); - EEPROM.put(CONFIG_ENTSOE_START, config); + EEPROM.put(CONFIG_PRICE_START, config); bool ret = EEPROM.commit(); EEPROM.end(); return ret; } -void AmsConfiguration::clearEntsoe(EntsoeConfig& config) { - strcpy(config.token, ""); - strcpy(config.area, ""); - strcpy(config.currency, ""); - config.multiplier = 1000; +void AmsConfiguration::clearPriceServiceConfig(PriceServiceConfig& config) { + memset(config.entsoeToken, 0, 37); + memset(config.area, 0, 17); + memset(config.currency, 0, 4); + config.unused1 = 1000; config.enabled = false; - config.fixedPrice = 0; + config.unused2 = 0; } -bool AmsConfiguration::isEntsoeChanged() { - return entsoeChanged; +bool AmsConfiguration::isPriceServiceChanged() { + return priceChanged; } -void AmsConfiguration::ackEntsoeChange() { - entsoeChanged = false; +void AmsConfiguration::ackPriceServiceChange() { + priceChanged = false; } @@ -680,6 +705,7 @@ bool AmsConfiguration::getUiConfig(UiConfig& config) { EEPROM.begin(EEPROM_SIZE); EEPROM.get(CONFIG_UI_START, config); if(config.showImport > 2) clearUiConfig(config); // Must be wrong + if(config.showRealtimePlot > 2) config.showRealtimePlot = 1; // TODO: Move to new config version for v2.3 EEPROM.end(); return true; } else { @@ -689,6 +715,12 @@ bool AmsConfiguration::getUiConfig(UiConfig& config) { } bool AmsConfiguration::setUiConfig(UiConfig& config) { + UiConfig existing; + if(getUiConfig(existing)) { + uiLanguageChanged |= strcmp(config.language, existing.language) != 0; + } else { + uiLanguageChanged = true; + } EEPROM.begin(EEPROM_SIZE); EEPROM.put(CONFIG_UI_START, config); bool ret = EEPROM.commit(); @@ -697,7 +729,7 @@ bool AmsConfiguration::setUiConfig(UiConfig& config) { } void AmsConfiguration::clearUiConfig(UiConfig& config) { - // 1 = Always, 2 = If value present, 0 = Hidden + // 1 = Enable, 2 = Auto, 0 = Disable config.showImport = 1; config.showExport = 2; config.showVoltage = 2; @@ -709,6 +741,19 @@ void AmsConfiguration::clearUiConfig(UiConfig& config) { config.showDayPlot = 1; config.showMonthPlot = 1; config.showTemperaturePlot = 2; + config.showRealtimePlot = 1; + config.showPerPhasePower = 2; + config.showPowerFactor = 2; + config.darkMode = 2; + memset(config.language, 0, 3); +} + +bool AmsConfiguration::isUiLanguageChanged() { + return uiLanguageChanged; +} + +void AmsConfiguration::ackUiLanguageChange() { + uiLanguageChanged = false; } bool AmsConfiguration::setUpgradeInformation(int16_t exitCode, int16_t errorCode, const char* currentVersion, const char* nextVersion) { @@ -750,6 +795,58 @@ void AmsConfiguration::clearUpgradeInformation(UpgradeInformation& upinfo) { memset(upinfo.toVersion, 0, 8); } +bool AmsConfiguration::getCloudConfig(CloudConfig& config) { + if(hasConfig()) { + EEPROM.begin(EEPROM_SIZE); + EEPROM.get(CONFIG_CLOUD_START, config); + EEPROM.end(); + return true; + } else { + clearCloudConfig(config); + return false; + } +} + +bool AmsConfiguration::setCloudConfig(CloudConfig& config) { + CloudConfig existing; + if(getCloudConfig(existing)) { + cloudChanged |= config.enabled != existing.enabled; + cloudChanged |= config.interval!= existing.interval; + cloudChanged |= config.port!= existing.port; + cloudChanged |= strcmp(config.hostname, existing.hostname) != 0; + cloudChanged |= memcmp(config.clientId, existing.clientId, 16) != 0; + } else { + cloudChanged = true; + } + + stripNonAscii((uint8_t*) config.hostname, 64); + + EEPROM.begin(EEPROM_SIZE); + EEPROM.put(CONFIG_CLOUD_START, config); + bool ret = EEPROM.commit(); + EEPROM.end(); + return ret; +} + +void AmsConfiguration::clearCloudConfig(CloudConfig& config) { + config.enabled = false; + strcpy_P(config.hostname, PSTR("cloud.amsleser.no")); + config.port = 7443; + config.interval = 10; + memset(config.clientId, 0, 16); +} + +bool AmsConfiguration::isCloudChanged() { + return cloudChanged; +} + +void AmsConfiguration::ackCloudConfig() { + cloudChanged = false; +} + +void AmsConfiguration::setUiLanguageChanged() { + uiLanguageChanged = true; +} void AmsConfiguration::clear() { EEPROM.begin(EEPROM_SIZE); @@ -759,23 +856,23 @@ void AmsConfiguration::clear() { sys.userConfigured = false; sys.dataCollectionConsent = 0; sys.energyspeedometer = 0; - strcpy(sys.country, ""); + memset(sys.country, 0, 3); EEPROM.put(CONFIG_SYSTEM_START, sys); MeterConfig meter; clearMeter(meter); EEPROM.put(CONFIG_METER_START, meter); - WiFiConfig wifi; - clearWifi(wifi); - EEPROM.put(CONFIG_WIFI_START, wifi); + NetworkConfig network; + clearNetworkConfig(network); + EEPROM.put(CONFIG_NETWORK_START, network); MqttConfig mqtt; clearMqtt(mqtt); EEPROM.put(CONFIG_MQTT_START, mqtt); WebConfig web; - clearAuth(web); + clearWebConfig(web); EEPROM.put(CONFIG_WEB_START, web); DomoticzConfig domo; @@ -790,9 +887,9 @@ void AmsConfiguration::clear() { clearNtp(ntp); EEPROM.put(CONFIG_NTP_START, ntp); - EntsoeConfig entsoe; - clearEntsoe(entsoe); - EEPROM.put(CONFIG_ENTSOE_START, entsoe); + PriceServiceConfig price; + clearPriceServiceConfig(price); + EEPROM.put(CONFIG_PRICE_START, price); EnergyAccountingConfig eac; clearEnergyAccountingConfig(eac); @@ -810,6 +907,10 @@ void AmsConfiguration::clear() { clearUpgradeInformation(upinfo); EEPROM.put(CONFIG_UPGRADE_INFO_START, upinfo); + CloudConfig cloud; + clearCloudConfig(cloud); + EEPROM.put(CONFIG_CLOUD_START, cloud); + EEPROM.put(EEPROM_CONFIG_ADDRESS, EEPROM_CLEARED_INDICATOR); EEPROM.commit(); EEPROM.end(); @@ -829,46 +930,6 @@ bool AmsConfiguration::hasConfig() { } } else { switch(configVersion) { - case 93: - configVersion = -1; // Prevent loop - if(relocateConfig93()) { - configVersion = 94; - } else { - configVersion = 0; - return false; - } - case 94: - configVersion = -1; // Prevent loop - if(relocateConfig94()) { - configVersion = 95; - } else { - configVersion = 0; - return false; - } - case 95: - configVersion = -1; // Prevent loop - if(relocateConfig95()) { - configVersion = 96; - } else { - configVersion = 0; - return false; - } - case 96: - configVersion = -1; // Prevent loop - if(relocateConfig96()) { - configVersion = 100; - } else { - configVersion = 0; - return false; - } - case 100: - configVersion = -1; // Prevent loop - if(relocateConfig100()) { - configVersion = 101; - } else { - configVersion = 0; - return false; - } case 101: configVersion = -1; // Prevent loop if(relocateConfig101()) { @@ -885,6 +946,14 @@ bool AmsConfiguration::hasConfig() { configVersion = 0; return false; } + case 103: + configVersion = -1; // Prevent loop + if(relocateConfig103()) { + configVersion = 104; + } else { + configVersion = 0; + return false; + } case EEPROM_CHECK_SUM: return true; default: @@ -899,204 +968,18 @@ int AmsConfiguration::getConfigVersion() { return configVersion; } -void AmsConfiguration::loadTempSensors() { - EEPROM.begin(EEPROM_SIZE); - TempSensorConfig* tempSensors[32]; - int address = EEPROM_TEMP_CONFIG_ADDRESS; - int c = 0; - int storedCount = EEPROM.read(address++); - if(storedCount > 0 && storedCount <= 32) { - for(int i = 0; i < storedCount; i++) { - TempSensorConfig* tsc = new TempSensorConfig(); - EEPROM.get(address, *tsc); - if(tsc->address[0] != 0xFF) { - tempSensors[c++] = tsc; - } - address += sizeof(*tsc); - } - } - this->tempSensors = new TempSensorConfig*[c]; - for(int i = 0; i < c; i++) { - this->tempSensors[i] = tempSensors[i]; - } - tempSensorCount = c; - EEPROM.end(); -} - -void AmsConfiguration::saveTempSensors() { - int address = EEPROM_TEMP_CONFIG_ADDRESS; - EEPROM.put(address++, tempSensorCount); - for(int i = 0; i < tempSensorCount; i++) { - TempSensorConfig* tsc = tempSensors[i]; - if(tsc->address[0] != 0xFF) { - EEPROM.put(address, *tsc); - address += sizeof(*tsc); - } - } -} - -bool AmsConfiguration::relocateConfig93() { - MeterConfig95 meter; - EEPROM.begin(EEPROM_SIZE); - EEPROM.get(CONFIG_METER_START_93, meter); - meter.wattageMultiplier = 0; - meter.voltageMultiplier = 0; - meter.amperageMultiplier = 0; - meter.accumulatedMultiplier = 0; - EEPROM.put(CONFIG_METER_START, meter); - EEPROM.put(EEPROM_CONFIG_ADDRESS, 94); - bool ret = EEPROM.commit(); - EEPROM.end(); - return ret; -} - -bool AmsConfiguration::relocateConfig94() { - EnergyAccountingConfig eac; - EEPROM.begin(EEPROM_SIZE); - EEPROM.get(CONFIG_ENERGYACCOUNTING_START, eac); - eac.hours = 1; - EEPROM.put(CONFIG_ENERGYACCOUNTING_START, eac); - EEPROM.put(EEPROM_CONFIG_ADDRESS, 95); - bool ret = EEPROM.commit(); - EEPROM.end(); - return ret; -} - -bool AmsConfiguration::relocateConfig95() { - MeterConfig95 meter; - MeterConfig95 meter95; - EEPROM.begin(EEPROM_SIZE); - EEPROM.get(CONFIG_METER_START, meter); - EEPROM.get(CONFIG_METER_START, meter95); - meter.wattageMultiplier = meter95.wattageMultiplier; - meter.voltageMultiplier = meter95.voltageMultiplier; - meter.amperageMultiplier = meter95.amperageMultiplier; - meter.accumulatedMultiplier = meter95.accumulatedMultiplier; - EEPROM.put(CONFIG_METER_START, meter); - EEPROM.put(EEPROM_CONFIG_ADDRESS, 96); - bool ret = EEPROM.commit(); - EEPROM.end(); - return ret; -} - -bool AmsConfiguration::relocateConfig96() { - EEPROM.begin(EEPROM_SIZE); - SystemConfig sys; - EEPROM.get(CONFIG_SYSTEM_START, sys); - - MeterConfig100 meter; - EEPROM.get(CONFIG_METER_START, meter); - meter.source = 1; // Serial - meter.parser = 0; // Auto - EEPROM.put(CONFIG_METER_START, meter); - - #if defined(ESP8266) - GpioConfig gpio; - EEPROM.get(CONFIG_GPIO_START, gpio); - - switch(sys.boardType) { - case 3: // Pow UART0 -- Now Pow-K UART0 - case 4: // Pow GPIO12 -- Now Pow-U UART0 - case 5: // Pow-K+ -- Now also Pow-K GPIO12 - case 7: // Pow-U+ -- Now also Pow-U GPIO12 - if(meter.baud == 2400 && meter.parity == 3) { // 3 == 8N1, assuming Pow-K - if(gpio.hanPin == 3) { // UART0 - sys.boardType = 3; - } else if(gpio.hanPin == 12) { - sys.boardType = 5; - } - } else { // Assuming Pow-U - if(gpio.hanPin == 3) { // UART0 - sys.boardType = 4; - } else if(gpio.hanPin == 12) { - sys.boardType = 7; - } - } - break; - } - #endif - - sys.vendorConfigured = true; - sys.userConfigured = true; - sys.dataCollectionConsent = 0; - strcpy(sys.country, ""); - EEPROM.put(CONFIG_SYSTEM_START, sys); - - WiFiConfig wifi; - EEPROM.get(CONFIG_WIFI_START, wifi); - wifi.use11b = 1; - wifi.unused = true; - EEPROM.put(CONFIG_WIFI_START, wifi); - - NtpConfig ntp; - NtpConfig96 ntp96; - EEPROM.get(CONFIG_NTP_START, ntp96); - ntp.enable = ntp96.enable; - ntp.dhcp = ntp96.dhcp; - if(ntp96.offset == 360 && ntp96.summerOffset == 360) { - strcpy(ntp.timezone, "Europe/Oslo"); - } else { - strcpy(ntp.timezone, "GMT"); - } - strcpy(ntp.server, ntp96.server); - EEPROM.put(CONFIG_NTP_START, ntp); - - EntsoeConfig entsoe; - EEPROM.get(CONFIG_ENTSOE_START, entsoe); - entsoe.enabled = strlen(entsoe.token) > 0; - EEPROM.put(CONFIG_ENTSOE_START, entsoe); - - EEPROM.put(EEPROM_CONFIG_ADDRESS, 100); - bool ret = EEPROM.commit(); - EEPROM.end(); - return ret; -} - -bool AmsConfiguration::relocateConfig100() { - EEPROM.begin(EEPROM_SIZE); - - MeterConfig100 meter100; - EEPROM.get(CONFIG_METER_START, meter100); - MeterConfig meter; - meter.baud = meter100.baud; - meter.parity = meter100.parity; - meter.invert = meter100.invert; - meter.distributionSystem = meter100.distributionSystem; - meter.mainFuse = meter100.mainFuse; - meter.productionCapacity = meter100.productionCapacity; - memcpy(meter.encryptionKey, meter100.encryptionKey, 16); - memcpy(meter.authenticationKey, meter100.authenticationKey, 16); - meter.wattageMultiplier = meter100.wattageMultiplier; - meter.voltageMultiplier = meter100.voltageMultiplier; - meter.amperageMultiplier = meter100.amperageMultiplier; - meter.accumulatedMultiplier = meter100.accumulatedMultiplier; - meter.source = meter100.source; - meter.parser = meter100.parser; - - EEPROM.put(CONFIG_METER_START, meter); - - UiConfig ui; - clearUiConfig(ui); - EEPROM.put(CONFIG_UI_START, ui); - - EEPROM.put(EEPROM_CONFIG_ADDRESS, 101); - bool ret = EEPROM.commit(); - EEPROM.end(); - return ret; -} - bool AmsConfiguration::relocateConfig101() { EEPROM.begin(EEPROM_SIZE); EnergyAccountingConfig config; EnergyAccountingConfig101 config101; - EEPROM.get(CONFIG_ENERGYACCOUNTING_START, config101); + EEPROM.get(CONFIG_ENERGYACCOUNTING_START_103, config101); for(uint8_t i = 0; i < 9; i++) { config.thresholds[i] = config101.thresholds[i]; } config.thresholds[9] = 0xFFFF; config.hours = config101.hours; - EEPROM.put(CONFIG_ENERGYACCOUNTING_START, config); + EEPROM.put(CONFIG_ENERGYACCOUNTING_START_103, config); EEPROM.put(EEPROM_CONFIG_ADDRESS, 102); bool ret = EEPROM.commit(); @@ -1107,19 +990,19 @@ bool AmsConfiguration::relocateConfig101() { bool AmsConfiguration::relocateConfig102() { EEPROM.begin(EEPROM_SIZE); - GpioConfig gpioConfig; - EEPROM.get(CONFIG_GPIO_START, gpioConfig); + GpioConfig103 gpioConfig; + EEPROM.get(CONFIG_GPIO_START_103, gpioConfig); gpioConfig.hanPinPullup = true; - EEPROM.put(CONFIG_GPIO_START, gpioConfig); + EEPROM.put(CONFIG_GPIO_START_103, gpioConfig); HomeAssistantConfig haconf; clearHomeAssistantConfig(haconf); - EEPROM.put(CONFIG_HA_START, haconf); + EEPROM.put(CONFIG_HA_START_103, haconf); - EntsoeConfig entsoe; - EEPROM.get(CONFIG_ENTSOE_START, entsoe); - entsoe.fixedPrice = 0; - EEPROM.put(CONFIG_ENTSOE_START, entsoe); + PriceServiceConfig entsoe; + EEPROM.get(CONFIG_ENTSOE_START_103, entsoe); + entsoe.unused2 = 0; + EEPROM.put(CONFIG_ENTSOE_START_103, entsoe); EEPROM.put(EEPROM_CONFIG_ADDRESS, 103); bool ret = EEPROM.commit(); @@ -1127,10 +1010,100 @@ bool AmsConfiguration::relocateConfig102() { return ret; } +bool AmsConfiguration::relocateConfig103() { + EEPROM.begin(EEPROM_SIZE); + + MeterConfig meter; + UpgradeInformation upinfo; + UiConfig ui; + GpioConfig103 gpio103; + PriceServiceConfig price; + NetworkConfig wifi; + EnergyAccountingConfig eac; + WebConfig103 web103; + DebugConfig debug; + DomoticzConfig domo; + NtpConfig ntp; + MqttConfig mqtt; + HomeAssistantConfig ha; + + EEPROM.get(CONFIG_METER_START_103, meter); + EEPROM.get(CONFIG_UPGRADE_INFO_START_103, upinfo); + EEPROM.get(CONFIG_UI_START_103, ui); + EEPROM.get(CONFIG_GPIO_START_103, gpio103); + EEPROM.get(CONFIG_ENTSOE_START_103, price); + EEPROM.get(CONFIG_WIFI_START_103, wifi); + EEPROM.get(CONFIG_ENERGYACCOUNTING_START_103, eac); + EEPROM.get(CONFIG_WEB_START_103, web103); + EEPROM.get(CONFIG_DEBUG_START_103, debug); + EEPROM.get(CONFIG_DOMOTICZ_START_103, domo); + EEPROM.get(CONFIG_NTP_START_103, ntp); + EEPROM.get(CONFIG_MQTT_START_103, mqtt); + EEPROM.get(CONFIG_HA_START_103, ha); + + meter.rxPin = gpio103.hanPin; + meter.txPin = 0xFF; + meter.rxPinPullup = gpio103.hanPinPullup; + wifi.mode = 1; // 1 == WiFi client + wifi.ipv6 = false; + + GpioConfig gpio = { + gpio103.apPin, + gpio103.ledPin, + gpio103.ledInverted, + gpio103.ledPinRed, + gpio103.ledPinGreen, + gpio103.ledPinBlue, + gpio103.ledRgbInverted, + gpio103.tempSensorPin, + gpio103.tempAnalogSensorPin, + gpio103.vccPin, + gpio103.vccOffset, + gpio103.vccMultiplier, + gpio103.vccBootLimit, + gpio103.vccResistorGnd, + gpio103.vccResistorVcc, + gpio103.ledDisablePin, + gpio103.ledBehaviour + }; + + WebConfig web = {web103.security}; + strcpy_P(web.username, web103.username); + strcpy_P(web.password, web103.password); + memset(web.context, 0, 37); + + strcpy_P(ui.language, PSTR("en")); + ui.showPerPhasePower = 2; + ui.showPowerFactor = 2; + ui.darkMode = 2; + + EEPROM.put(CONFIG_UPGRADE_INFO_START, upinfo); + EEPROM.put(CONFIG_NETWORK_START, wifi); + EEPROM.put(CONFIG_METER_START, meter); + EEPROM.put(CONFIG_GPIO_START, gpio); + EEPROM.put(CONFIG_PRICE_START, price); + EEPROM.put(CONFIG_ENERGYACCOUNTING_START, eac); + EEPROM.put(CONFIG_WEB_START, web); + EEPROM.put(CONFIG_DEBUG_START, debug); + EEPROM.put(CONFIG_NTP_START, ntp); + EEPROM.put(CONFIG_MQTT_START, mqtt); + EEPROM.put(CONFIG_DOMOTICZ_START, domo); + EEPROM.put(CONFIG_HA_START, ha); + EEPROM.put(CONFIG_UI_START, ui); + + CloudConfig cloud; + clearCloudConfig(cloud); + EEPROM.put(CONFIG_CLOUD_START, cloud); + + EEPROM.put(EEPROM_CONFIG_ADDRESS, 104); + bool ret = EEPROM.commit(); + EEPROM.end(); + return ret; +} + bool AmsConfiguration::save() { EEPROM.begin(EEPROM_SIZE); EEPROM.put(EEPROM_CONFIG_ADDRESS, EEPROM_CHECK_SUM); - saveTempSensors(); bool success = EEPROM.commit(); EEPROM.end(); @@ -1138,60 +1111,6 @@ bool AmsConfiguration::save() { return success; } -uint8_t AmsConfiguration::getTempSensorCount() { - return tempSensorCount; -} - -TempSensorConfig* AmsConfiguration::getTempSensorConfig(uint8_t address[8]) { - if(tempSensors == NULL) - return NULL; - for(int x = 0; x < tempSensorCount; x++) { - TempSensorConfig *conf = tempSensors[x]; - if(isSensorAddressEqual(conf->address, address)) { - return conf; - } - } - return NULL; -} - -void AmsConfiguration::updateTempSensorConfig(uint8_t address[8], const char name[32], bool common) { - bool found = false; - if(tempSensors != NULL) { - for(int x = 0; x < tempSensorCount; x++) { - TempSensorConfig *data = tempSensors[x]; - if(isSensorAddressEqual(data->address, address)) { - found = true; - strcpy(data->name, name); - data->common = common; - } - } - } - if(!found) { - TempSensorConfig** tempSensors = new TempSensorConfig*[tempSensorCount+1]; - if(this->tempSensors != NULL) { - for(int i = 0;i < tempSensorCount; i++) { - tempSensors[i] = this->tempSensors[i]; - } - } - TempSensorConfig *data = new TempSensorConfig(); - memcpy(data->address, address, 8); - strcpy(data->name, name); - data->common = common; - tempSensors[tempSensorCount++] = data; - if(this->tempSensors != NULL) { - delete this->tempSensors; - } - this->tempSensors = tempSensors; - } -} - -bool AmsConfiguration::isSensorAddressEqual(uint8_t a[8], uint8_t b[8]) { - for(int i = 0; i < 8; i++) { - if(a[i] != b[i]) return false; - } - return true; -} - void AmsConfiguration::saveToFs() { } @@ -1207,21 +1126,33 @@ void AmsConfiguration::deleteFromFs(uint8_t version) { void AmsConfiguration::print(Print* debugger) { debugger->println(F("-----------------------------------------------")); - WiFiConfig wifi; - if(getWiFiConfig(wifi)) { - debugger->println(F("--WiFi configuration--")); - debugger->printf_P(PSTR("SSID: '%s'\r\n"), wifi.ssid); - debugger->printf_P(PSTR("Psk: '%s'\r\n"), wifi.psk); - if(strlen(wifi.ip) > 0) { - debugger->printf_P(PSTR("IP: '%s'\r\n"), wifi.ip); - debugger->printf_P(PSTR("Gateway: '%s'\r\n"), wifi.gateway); - debugger->printf_P(PSTR("Subnet: '%s'\r\n"), wifi.subnet); - debugger->printf_P(PSTR("DNS1: '%s'\r\n"), wifi.dns1); - debugger->printf_P(PSTR("DNS2: '%s'\r\n"), wifi.dns2); + NetworkConfig network; + if(getNetworkConfig(network)) { + debugger->println(F("--Network configuration--")); + switch(network.mode) { + case 1: + debugger->printf_P(PSTR("Mode: 'WiFi client'\r\n")); + break; + case 2: + debugger->printf_P(PSTR("Mode: 'WiFi AP'\r\n")); + break; + case 3: + debugger->printf_P(PSTR("Mode: 'Ethernet'\r\n")); + break; + } + debugger->printf_P(PSTR("SSID: '%s'\r\n"), network.ssid); + debugger->printf_P(PSTR("Psk: '%s'\r\n"), network.psk); + if(strlen(network.ip) > 0) { + debugger->printf_P(PSTR("IP: '%s'\r\n"), network.ip); + debugger->printf_P(PSTR("Gateway: '%s'\r\n"), network.gateway); + debugger->printf_P(PSTR("Subnet: '%s'\r\n"), network.subnet); + debugger->printf_P(PSTR("DNS1: '%s'\r\n"), network.dns1); + debugger->printf_P(PSTR("DNS2: '%s'\r\n"), network.dns2); } - debugger->printf_P(PSTR("Hostname: '%s'\r\n"), wifi.hostname); - debugger->printf_P(PSTR("mDNS: '%s'\r\n"), wifi.mdns ? "Yes" : "No"); - debugger->printf_P(PSTR("802.11b: '%s'\r\n"), wifi.use11b ? "Yes" : "No"); + debugger->printf_P(PSTR("Hostname: '%s'\r\n"), network.hostname); + debugger->printf_P(PSTR("IPv6: '%s'\r\n"), network.ipv6 ? "Yes" : "No"); + debugger->printf_P(PSTR("mDNS: '%s'\r\n"), network.mdns ? "Yes" : "No"); + debugger->printf_P(PSTR("802.11b: '%s'\r\n"), network.use11b ? "Yes" : "No"); debugger->println(F("")); delay(10); debugger->flush(); @@ -1267,6 +1198,8 @@ void AmsConfiguration::print(Print* debugger) MeterConfig meter; if(getMeterConfig(meter)) { debugger->println(F("--Meter configuration--")); + debugger->printf_P(PSTR("HAN RX: %i\r\n"), meter.rxPin); + debugger->printf_P(PSTR("HAN RX pullup %s\r\n"), meter.rxPinPullup ? "Yes" : "No"); debugger->printf_P(PSTR("Baud: %i\r\n"), meter.baud); debugger->printf_P(PSTR("Parity: %i\r\n"), meter.parity); debugger->printf_P(PSTR("Invert serial: %s\r\n"), meter.invert ? "Yes" : "No"); @@ -1282,8 +1215,6 @@ void AmsConfiguration::print(Print* debugger) GpioConfig gpio; if(getGpioConfig(gpio)) { debugger->println(F("--GPIO configuration--")); - debugger->printf_P(PSTR("HAN pin: %i\r\n"), gpio.hanPin); - debugger->printf_P(PSTR("HAN pin pullup %s\r\n"), gpio.hanPinPullup ? "Yes" : "No"); debugger->printf_P(PSTR("LED pin: %i\r\n"), gpio.ledPin); debugger->printf_P(PSTR("LED inverted: %s\r\n"), gpio.ledInverted ? "Yes" : "No"); debugger->printf_P(PSTR("LED red pin: %i\r\n"), gpio.ledPinRed); @@ -1294,6 +1225,8 @@ void AmsConfiguration::print(Print* debugger) debugger->printf_P(PSTR("Temperature pin: %i\r\n"), gpio.tempSensorPin); debugger->printf_P(PSTR("Temp analog pin: %i\r\n"), gpio.tempAnalogSensorPin); debugger->printf_P(PSTR("Vcc pin: %i\r\n"), gpio.vccPin); + debugger->printf_P(PSTR("LED disable pin: %i\r\n"), gpio.ledDisablePin); + debugger->printf_P(PSTR("LED behaviour: %i\r\n"), gpio.ledBehaviour); if(gpio.vccMultiplier > 0) { debugger->printf_P(PSTR("Vcc multiplier: %f\r\n"), gpio.vccMultiplier / 1000.0); } @@ -1342,21 +1275,37 @@ void AmsConfiguration::print(Print* debugger) debugger->flush(); } - EntsoeConfig entsoe; - if(getEntsoeConfig(entsoe)) { - if(strlen(entsoe.area) > 0) { - debugger->println(F("--ENTSO-E configuration--")); - debugger->printf_P(PSTR("Area: %s\r\n"), entsoe.area); - debugger->printf_P(PSTR("Currency: %s\r\n"), entsoe.currency); - debugger->printf_P(PSTR("Multiplier: %f\r\n"), entsoe.multiplier / 1000.0); - debugger->printf_P(PSTR("Token: %s\r\n"), entsoe.token); + PriceServiceConfig price; + if(getPriceServiceConfig(price)) { + if(strlen(price.area) > 0) { + debugger->println(F("--Price configuration--")); + debugger->printf_P(PSTR("Area: %s\r\n"), price.area); + debugger->printf_P(PSTR("Currency: %s\r\n"), price.currency); + debugger->printf_P(PSTR("ENTSO-E Token: %s\r\n"), price.entsoeToken); } debugger->println(F("")); delay(10); debugger->flush(); } - debugger->printf_P(PSTR("Temp sensor count: %i\r\n"), this->getTempSensorCount()); + UiConfig ui; + if(getUiConfig(ui)) { + debugger->println(F("--UI configuration--")); + debugger->printf_P(PSTR("Language: %s\r\n"), ui.language); + } + + #if defined(ESP32) + CloudConfig cc; + if(getCloudConfig(cc)) { + String uuid = ESPRandom::uuidToString(cc.clientId);; + debugger->println(F("--UI configuration--")); + debugger->printf_P(PSTR("Enabled: %s\r\n"), cc.enabled ? "Yes" : "No"); + debugger->printf_P(PSTR("Hostname: %s\r\n"), cc.hostname); + debugger->printf_P(PSTR("Client ID: %s\r\n"), uuid.c_str()); + debugger->printf_P(PSTR("Interval: %d\r\n"), cc.interval); + } + #endif debugger->println(F("-----------------------------------------------")); + debugger->flush(); } diff --git a/lib/AmsConfiguration/src/hexutils.cpp b/lib/AmsConfiguration/src/hexutils.cpp index a8151824..35819aa0 100644 --- a/lib/AmsConfiguration/src/hexutils.cpp +++ b/lib/AmsConfiguration/src/hexutils.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "hexutils.h" String toHex(uint8_t* in) { diff --git a/lib/AmsData/include/AmsData.h b/lib/AmsData/include/AmsData.h index 0ba73b09..75f751e3 100644 --- a/lib/AmsData/include/AmsData.h +++ b/lib/AmsData/include/AmsData.h @@ -1,8 +1,15 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _AMSDATA_H #define _AMSDATA_H #include "Arduino.h" #include +#include "OBIScodes.h" enum AmsType { AmsTypeAutodetect = 0x00, @@ -21,6 +28,7 @@ class AmsData { AmsData(); void apply(AmsData& other); + void apply(const OBIS_code_t obis, double value); uint64_t getLastUpdateMillis(); @@ -53,13 +61,13 @@ class AmsData { float getL2PowerFactor(); float getL3PowerFactor(); - float getL1ActiveImportPower(); - float getL2ActiveImportPower(); - float getL3ActiveImportPower(); + uint32_t getL1ActiveImportPower(); + uint32_t getL2ActiveImportPower(); + uint32_t getL3ActiveImportPower(); - float getL1ActiveExportPower(); - float getL2ActiveExportPower(); - float getL3ActiveExportPower(); + uint32_t getL1ActiveExportPower(); + uint32_t getL2ActiveExportPower(); + uint32_t getL3ActiveExportPower(); double getL1ActiveImportCounter(); double getL2ActiveImportCounter(); @@ -76,6 +84,7 @@ class AmsData { bool isThreePhase(); bool isTwoPhase(); + bool isCounterEstimated(); bool isL2currentMissing(); int8_t getLastError(); @@ -90,8 +99,8 @@ class AmsData { time_t meterTimestamp = 0; uint32_t activeImportPower = 0, reactiveImportPower = 0, activeExportPower = 0, reactiveExportPower = 0; float l1voltage = 0, l2voltage = 0, l3voltage = 0, l1current = 0, l2current = 0, l3current = 0; - float l1activeImportPower = 0, l2activeImportPower = 0, l3activeImportPower = 0; - float l1activeExportPower = 0, l2activeExportPower = 0, l3activeExportPower = 0; + uint32_t l1activeImportPower = 0, l2activeImportPower = 0, l3activeImportPower = 0; + uint32_t l1activeExportPower = 0, l2activeExportPower = 0, l3activeExportPower = 0; double l1activeImportCounter = 0, l2activeImportCounter = 0, l3activeImportCounter = 0; double l1activeExportCounter = 0, l2activeExportCounter = 0, l3activeExportCounter = 0; float powerFactor = 0, l1PowerFactor = 0, l2PowerFactor = 0, l3PowerFactor = 0; diff --git a/lib/AmsData/include/OBIScodes.h b/lib/AmsData/include/OBIScodes.h new file mode 100644 index 00000000..7d5d1acc --- /dev/null +++ b/lib/AmsData/include/OBIScodes.h @@ -0,0 +1,81 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#ifndef _OBISCODES_H +#define _OBISCODES_H + +#include "lwip/def.h" + +#define OBIS_MEDIUM_ABSTRACT 0 +#define OBIS_MEDIUM_ELECTRICITY 1 + +#define OBIS_CHAN_0 0 +#define OBIS_CHAN_1 1 + +#define OBIS_RANGE_NA 0xFF + +struct OBIS_head_t { + uint8_t medium; + uint8_t channel; +} __attribute__((packed)); + +struct OBIS_code_t { + uint8_t sensor; + uint8_t gr; + uint8_t tariff; +} __attribute__((packed)); + +struct OBIS_t { + OBIS_head_t head; + OBIS_code_t code; + uint8_t range; +} __attribute__((packed)); + + +const OBIS_code_t OBIS_NULL PROGMEM = { 0, 0, 0 }; + +const OBIS_code_t OBIS_FIRMWARE_VERSION PROGMEM = { 0, 2, 0 }; + +const OBIS_code_t OBIS_VERSION PROGMEM = { 0, 2, 129 }; +const OBIS_code_t OBIS_METER_MODEL PROGMEM = { 96, 1, 1 }; +const OBIS_code_t OBIS_METER_MODEL_2 PROGMEM = { 96, 1, 7 }; +const OBIS_code_t OBIS_METER_ID PROGMEM = { 96, 1, 0 }; +const OBIS_code_t OBIS_METER_ID_2 PROGMEM = { 0, 0, 5 }; +const OBIS_code_t OBIS_METER_TIMESTAMP PROGMEM = { 1, 0, 0 }; + +const OBIS_code_t OBIS_ACTIVE_IMPORT PROGMEM = { 1, 7, 0 }; +const OBIS_code_t OBIS_ACTIVE_IMPORT_COUNT PROGMEM = { 1, 8, 0 }; +const OBIS_code_t OBIS_ACTIVE_EXPORT PROGMEM = { 2, 7, 0 }; +const OBIS_code_t OBIS_ACTIVE_EXPORT_COUNT PROGMEM = { 2, 8, 0 }; +const OBIS_code_t OBIS_REACTIVE_IMPORT PROGMEM = { 3, 7, 0 }; +const OBIS_code_t OBIS_REACTIVE_IMPORT_COUNT PROGMEM = { 3, 8, 0 }; +const OBIS_code_t OBIS_REACTIVE_EXPORT PROGMEM = { 4, 7, 0 }; +const OBIS_code_t OBIS_REACTIVE_EXPORT_COUNT PROGMEM = { 4, 8, 0 }; + +const OBIS_code_t OBIS_POWER_FACTOR PROGMEM = { 13, 7, 0 }; + +const OBIS_code_t OBIS_ACTIVE_IMPORT_L1 PROGMEM = { 21, 7, 0 }; +const OBIS_code_t OBIS_ACTIVE_EXPORT_L1 PROGMEM = { 22, 7, 0 }; + +const OBIS_code_t OBIS_CURRENT_L1 PROGMEM = { 31, 7, 0 }; +const OBIS_code_t OBIS_VOLTAGE_L1 PROGMEM = { 32, 7, 0 }; +const OBIS_code_t OBIS_POWER_FACTOR_L1 PROGMEM = { 33, 7, 0 }; + +const OBIS_code_t OBIS_ACTIVE_IMPORT_L2 PROGMEM = { 41, 7, 0 }; +const OBIS_code_t OBIS_ACTIVE_EXPORT_L2 PROGMEM = { 42, 7, 0 }; + +const OBIS_code_t OBIS_CURRENT_L2 PROGMEM = { 51, 7, 0 }; +const OBIS_code_t OBIS_VOLTAGE_L2 PROGMEM = { 52, 7, 0 }; +const OBIS_code_t OBIS_POWER_FACTOR_L2 PROGMEM = { 53, 7, 0 }; + +const OBIS_code_t OBIS_ACTIVE_IMPORT_L3 PROGMEM = { 61, 7, 0 }; +const OBIS_code_t OBIS_ACTIVE_EXPORT_L3 PROGMEM = { 62, 7, 0 }; + +const OBIS_code_t OBIS_CURRENT_L3 PROGMEM = { 71, 7, 0 }; +const OBIS_code_t OBIS_VOLTAGE_L3 PROGMEM = { 72, 7, 0 }; +const OBIS_code_t OBIS_POWER_FACTOR_L3 PROGMEM = { 73, 7, 0 }; + +#endif diff --git a/lib/AmsData/src/AmsData.cpp b/lib/AmsData/src/AmsData.cpp index f9988a6b..68b5d766 100644 --- a/lib/AmsData/src/AmsData.cpp +++ b/lib/AmsData/src/AmsData.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "AmsData.h" AmsData::AmsData() {} @@ -8,23 +14,27 @@ void AmsData::apply(AmsData& other) { if(ms > 0) { if(other.getActiveImportPower() > 0) { - float add = other.getActiveImportPower() * (((float) ms) / 3600000.0); + uint32_t power = (activeImportPower + other.getActiveImportPower()) / 2; + float add = power * (((float) ms) / 3600000.0); activeImportCounter += add / 1000.0; //Serial.printf("%dW, %dms, %.6fkWh added\n", other.getActiveImportPower(), ms, add); } if(other.getListType() > 1) { - ms = this->lastUpdateMillis > other.getLastUpdateMillis() ? 0 : other.getLastUpdateMillis() - this->lastList2; + ms = this->lastList2 > other.getLastUpdateMillis() ? 0 : other.getLastUpdateMillis() - this->lastList2; if(other.getActiveExportPower() > 0) { - float add = other.getActiveExportPower() * (((float) ms) / 3600000.0); + uint32_t power = (activeExportPower + other.getActiveExportPower()) / 2; + float add = power * (((float) ms) / 3600000.0); activeExportCounter += add / 1000.0; } if(other.getReactiveImportPower() > 0) { - float add = other.getReactiveImportPower() * (((float) ms) / 3600000.0); + uint32_t power = (reactiveImportPower + other.getReactiveImportPower()) / 2; + float add = power * (((float) ms) / 3600000.0); reactiveImportCounter += add / 1000.0; } if(other.getReactiveExportPower() > 0) { - float add = other.getReactiveExportPower() * (((float) ms) / 3600000.0); + uint32_t power = (reactiveExportPower + other.getReactiveExportPower()) / 2; + float add = power * (((float) ms) / 3600000.0); reactiveExportCounter += add / 1000.0; } } @@ -89,6 +99,91 @@ void AmsData::apply(AmsData& other) { this->activeExportPower = other.getActiveExportPower(); } +void AmsData::apply(OBIS_code_t obis, double value) { + switch(obis.gr) { + case 1: + switch(obis.sensor) { + case 7: + switch(obis.tariff) { + case 0: + activeImportPower = value; + listType = max(listType, (uint8_t) 1); + break; + } + break; + case 8: + switch(obis.tariff) { + case 0: + activeImportCounter = value; + listType = max(listType, (uint8_t) 3); + break; + } + break; + } + break; + case 2: + switch(obis.sensor) { + case 7: + switch(obis.tariff) { + case 0: + activeExportPower = value; + listType = max(listType, (uint8_t) 2); + break; + } + break; + case 8: + switch(obis.tariff) { + case 0: + activeExportCounter = value; + listType = max(listType, (uint8_t) 3); + break; + } + break; + } + break; + case 3: + switch(obis.sensor) { + case 7: + switch(obis.tariff) { + case 0: + reactiveImportPower = value; + listType = max(listType, (uint8_t) 2); + break; + } + break; + case 8: + switch(obis.tariff) { + case 0: + reactiveImportCounter = value; + listType = max(listType, (uint8_t) 3); + break; + } + break; + } + break; + case 4: + switch(obis.sensor) { + case 7: + switch(obis.tariff) { + case 0: + reactiveExportPower = value; + listType = max(listType, (uint8_t) 2); + break; + } + break; + case 8: + switch(obis.tariff) { + case 0: + reactiveExportCounter = value; + listType = max(listType, (uint8_t) 3); + break; + } + break; + } + break; + } +} + uint64_t AmsData::getLastUpdateMillis() { return this->lastUpdateMillis; } @@ -177,27 +272,27 @@ float AmsData::getL3PowerFactor() { return this->l3PowerFactor; } -float AmsData::getL1ActiveImportPower() { +uint32_t AmsData::getL1ActiveImportPower() { return this->l1activeImportPower; } -float AmsData::getL2ActiveImportPower() { +uint32_t AmsData::getL2ActiveImportPower() { return this->l2activeImportPower; } -float AmsData::getL3ActiveImportPower() { +uint32_t AmsData::getL3ActiveImportPower() { return this->l3activeImportPower; } -float AmsData::getL1ActiveExportPower() { +uint32_t AmsData::getL1ActiveExportPower() { return this->l1activeExportPower; } -float AmsData::getL2ActiveExportPower() { +uint32_t AmsData::getL2ActiveExportPower() { return this->l2activeExportPower; } -float AmsData::getL3ActiveExportPower() { +uint32_t AmsData::getL3ActiveExportPower() { return this->l3activeExportPower; } @@ -249,6 +344,10 @@ bool AmsData::isTwoPhase() { return this->twoPhase; } +bool AmsData::isCounterEstimated() { + return this->counterEstimated; +} + bool AmsData::isL2currentMissing() { return this->l2currentMissing; } diff --git a/lib/AmsDataStorage/include/AmsDataStorage.h b/lib/AmsDataStorage/include/AmsDataStorage.h index 46e1bdb9..556ce6e5 100644 --- a/lib/AmsDataStorage/include/AmsDataStorage.h +++ b/lib/AmsDataStorage/include/AmsDataStorage.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _AMSDATASTORAGE_H #define _AMSDATASTORAGE_H #include "Arduino.h" @@ -5,7 +11,7 @@ #include "RemoteDebug.h" #include "Timezone.h" -struct DayDataPoints { +struct DayDataPoints5 { uint8_t version; uint16_t hImport[24]; time_t lastMeterReadTime; @@ -13,9 +19,9 @@ struct DayDataPoints { uint32_t activeExport; uint16_t hExport[24]; uint8_t accuracy; -}; // 113 bytes +}; -struct MonthDataPoints { +struct MonthDataPoints6 { uint8_t version; uint16_t dImport[31]; time_t lastMeterReadTime; @@ -23,7 +29,27 @@ struct MonthDataPoints { uint32_t activeExport; uint16_t dExport[31]; uint8_t accuracy; -}; // 142 bytes +}; + +struct DayDataPoints { + uint8_t version; + uint16_t hImport[24]; + time_t lastMeterReadTime; + uint64_t activeImport; + uint64_t activeExport; + uint16_t hExport[24]; + uint8_t accuracy; +}; + +struct MonthDataPoints { + uint8_t version; + uint16_t dImport[31]; + time_t lastMeterReadTime; + uint64_t activeImport; + uint64_t activeExport; + uint16_t dExport[31]; + uint8_t accuracy; +}; class AmsDataStorage { public: @@ -51,6 +77,8 @@ class AmsDataStorage { bool isDayHappy(); bool isMonthHappy(); + double getEstimatedImportCounter(); + private: Timezone* tz; DayDataPoints day = { diff --git a/lib/AmsDataStorage/src/AmsDataStorage.cpp b/lib/AmsDataStorage/src/AmsDataStorage.cpp index 44b2bcb3..2602ff85 100644 --- a/lib/AmsDataStorage/src/AmsDataStorage.cpp +++ b/lib/AmsDataStorage/src/AmsDataStorage.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "AmsDataStorage.h" #include #include "LittleFS.h" @@ -5,9 +11,9 @@ #include "FirmwareVersion.h" AmsDataStorage::AmsDataStorage(RemoteDebug* debugger) { - day.version = 5; + day.version = 6; day.accuracy = 1; - month.version = 6; + month.version = 7; month.accuracy = 1; this->debugger = debugger; } @@ -18,33 +24,21 @@ void AmsDataStorage::setTimezone(Timezone* tz) { bool AmsDataStorage::update(AmsData* data) { if(isHappy()) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Data is up to date\n")); return false; } time_t now = time(nullptr); - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Time is: %lu\n"), (int32_t) now); if(tz == NULL) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Timezone is missing\n")); return false; } if(now < FirmwareVersion::BuildEpoch) { if(data->getMeterTimestamp() > FirmwareVersion::BuildEpoch) { now = data->getMeterTimestamp(); - if(debugger->isActive(RemoteDebug::DEBUG)) { - debugger->printf_P(PSTR("(AmsDataStorage) Using meter timestamp, which is: %lu\n"), (int32_t) now); - } } else if(data->getPackageTimestamp() > FirmwareVersion::BuildEpoch) { now = data->getPackageTimestamp(); - if(debugger->isActive(RemoteDebug::DEBUG)) { - debugger->printf_P(PSTR("(AmsDataStorage) Using package timestamp, which is: %lu\n"), (int32_t) now); - } } } if(now < FirmwareVersion::BuildEpoch) { - if(debugger->isActive(RemoteDebug::VERBOSE)) { - debugger->printf_P(PSTR("(AmsDataStorage) Invalid time: %lu\n"), (int32_t) now); - } return false; } @@ -54,52 +48,34 @@ bool AmsDataStorage::update(AmsData* data) { breakTime(now-3600, utcYesterday); breakTime(tz->toLocal(now-3600), ltzYesterDay); - uint32_t importCounter = data->getActiveImportCounter() * 1000; - uint32_t exportCounter = data->getActiveExportCounter() * 1000; + uint64_t importCounter = data->getActiveImportCounter() * 1000; + uint64_t exportCounter = data->getActiveExportCounter() * 1000; // Clear hours between last update and now if(day.lastMeterReadTime > now) { - if(debugger->isActive(RemoteDebug::WARNING)) { - debugger->printf_P(PSTR("(AmsDataStorage) Invalid future timestamp for day plot, resetting\n")); - } day.activeImport = importCounter; day.activeExport = exportCounter; day.lastMeterReadTime = now; - } else if(day.activeImport == 0 || now - day.lastMeterReadTime > 86400) { - if(debugger->isActive(RemoteDebug::VERBOSE)) { - debugger->printf_P(PSTR("(AmsDataStorage) %lu == 0 || %lu - %lu > 86400"), day.activeImport, now, day.lastMeterReadTime); - } + } else if((importCounter > 0 && day.activeImport == 0) || now - day.lastMeterReadTime > 86400) { day.activeImport = importCounter; day.activeExport = exportCounter; day.lastMeterReadTime = now; - if(debugger->isActive(RemoteDebug::WARNING)) { - debugger->printf_P(PSTR("(AmsDataStorage) Too long since last day update, clearing data\n")); - } for(int i = 0; i<24; i++) { setHourImport(i, 0); setHourExport(i, 0); } } else { - if(debugger->isActive(RemoteDebug::DEBUG)) { - debugger->printf_P(PSTR("(AmsDataStorage) Last day update: %lu\n"), (int32_t) day.lastMeterReadTime); - } tmElements_t last; breakTime(day.lastMeterReadTime, last); uint8_t endHour = utc.Hour; if(last.Hour > utc.Hour){ for(int i = 0; i < utc.Hour; i++) { - if(debugger->isActive(RemoteDebug::VERBOSE)) { - debugger->printf_P(PSTR("(AmsDataStorage) Clearing hour: %d\n"), i); - } setHourImport(i, 0); setHourExport(i, 0); } endHour = 24; } for(int i = last.Hour; i < endHour; i++) { - if(debugger->isActive(RemoteDebug::VERBOSE)) { - debugger->printf_P(PSTR("(AmsDataStorage) Clearing hour: %d\n"), i); - } setHourImport(i, 0); setHourExport(i, 0); } @@ -107,54 +83,35 @@ bool AmsDataStorage::update(AmsData* data) { // Clear days between last update and now if(month.lastMeterReadTime > now) { - if(debugger->isActive(RemoteDebug::WARNING)) { - debugger->printf_P(PSTR("(AmsDataStorage) Invalid future timestamp for month plot, resetting\n")); - } month.activeImport = importCounter; month.activeExport = exportCounter; month.lastMeterReadTime = now; - } else if(month.activeImport == 0 || now - month.lastMeterReadTime > 2682000) { - if(debugger->isActive(RemoteDebug::VERBOSE)) { - debugger->printf_P(PSTR("(AmsDataStorage) %lu == 0 || %lu - %lu > 2682000"), month.activeImport, now, month.lastMeterReadTime); - } + } else if((importCounter > 0 && month.activeImport == 0) || now - month.lastMeterReadTime > 2682000) { month.activeImport = importCounter; month.activeExport = exportCounter; month.lastMeterReadTime = now; - if(debugger->isActive(RemoteDebug::WARNING)) { - debugger->printf_P(PSTR("(AmsDataStorage) Too long since last month update, clearing data\n")); - } for(int i = 1; i<=31; i++) { setDayImport(i, 0); setDayExport(i, 0); } } else { - if(debugger->isActive(RemoteDebug::DEBUG)) { - debugger->printf_P(PSTR("(AmsDataStorage) Last month update: %lu\n"), (int32_t) month.lastMeterReadTime); - } tmElements_t last; breakTime(tz->toLocal(month.lastMeterReadTime), last); uint8_t endDay = ltz.Day; if(last.Day > ltz.Day) { for(int i = 1; i < ltz.Day; i++) { - if(debugger->isActive(RemoteDebug::VERBOSE)) { - debugger->printf_P(PSTR("(AmsDataStorage) Clearing day: %d\n"), i); - } setDayImport(i, 0); setDayExport(i, 0); } endDay = 31; } for(int i = last.Day; i < endDay; i++) { - if(debugger->isActive(RemoteDebug::VERBOSE)) { - debugger->printf_P(PSTR("(AmsDataStorage) Clearing day: %d\n"), i); - } setDayImport(i, 0); setDayExport(i, 0); } } if(data->getListType() < 3) { - debugger->printf_P(PSTR("(AmsDataStorage) Not enough data in list type: %d\n"), data->getListType()); return false; } @@ -174,7 +131,6 @@ bool AmsDataStorage::update(AmsData* data) { setHourImport(utcYesterday.Hour, imp); setHourExport(utcYesterday.Hour, exp); - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(AmsDataStorage) Usage for hour %d: %d - %d\n"), ltzYesterDay.Hour, imp, exp); day.activeImport = importCounter; day.activeExport = exportCounter; day.lastMeterReadTime = now; @@ -185,10 +141,6 @@ bool AmsDataStorage::update(AmsData* data) { float ipm = im / mins; float epm = ex / mins; - if(debugger->isActive(RemoteDebug::DEBUG)) { - debugger->printf_P(PSTR("(AmsDataStorage) Since last day update, minutes: %.1f, import: %d (%.2f/min), export: %d (%.2f/min)\n"), mins, im, ipm, ex, epm); - } - tmElements_t last; breakTime(day.lastMeterReadTime, last); day.lastMeterReadTime = day.lastMeterReadTime - (last.Minute * 60) - last.Second; @@ -204,10 +156,6 @@ bool AmsDataStorage::update(AmsData* data) { setHourImport(last.Hour, imp); setHourExport(last.Hour, exp); - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("(AmsDataStorage) Estimated usage for hour %u: %.1f - %.1f (%lu)\n"), last.Hour, imp, exp, (int32_t) cur); - } - day.activeImport += imp; day.activeExport += exp; day.lastMeterReadTime = cur; @@ -225,12 +173,8 @@ bool AmsDataStorage::update(AmsData* data) { setDayImport(ltzYesterDay.Day, 0); setDayExport(ltzYesterDay.Day, 0); } else if(now - month.lastMeterReadTime < 90100 && now - month.lastMeterReadTime > 82700) { // DST days are 23h (82800s) and 25h (90000) - int32_t imp = importCounter - month.activeImport; - int32_t exp = exportCounter - month.activeExport; - - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("(AmsDataStorage) Usage for day %d: %d - %d\n"), ltzYesterDay.Day, imp, exp); - } + uint32_t imp = importCounter - month.activeImport; + uint32_t exp = exportCounter - month.activeExport; setDayImport(ltzYesterDay.Day, imp); setDayExport(ltzYesterDay.Day, exp); @@ -242,9 +186,6 @@ bool AmsDataStorage::update(AmsData* data) { tmElements_t last; breakTime(tz->toLocal(month.lastMeterReadTime), last); month.lastMeterReadTime = month.lastMeterReadTime - (last.Hour * 3600) - (last.Minute * 60) - last.Second; - if(debugger->isActive(RemoteDebug::DEBUG)) { - debugger->printf_P(PSTR("(AmsDataStorage) Last month read after resetting to midnight: %lu\n"), (int32_t) month.lastMeterReadTime); - } float hrs = (now - month.lastMeterReadTime) / 3600.0; uint32_t im = importCounter - month.activeImport; @@ -252,10 +193,6 @@ bool AmsDataStorage::update(AmsData* data) { float iph = im / hrs; float eph = ex / hrs; - if(debugger->isActive(RemoteDebug::DEBUG)) { - debugger->printf_P(PSTR("(AmsDataStorage) Since last month update, hours: %.1f, import: %d (%.2f/hr), export: %d (%.2f/hr)\n"), hrs, im, iph, ex, eph); - } - time_t stopAt = now - (ltz.Hour * 3600) - (ltz.Minute * 60) - ltz.Second; while(month.lastMeterReadTime < stopAt) { time_t cur = min(month.lastMeterReadTime + 86400, stopAt); @@ -267,10 +204,6 @@ bool AmsDataStorage::update(AmsData* data) { setDayImport(last.Day, imp); setDayExport(last.Day, exp); - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("(AmsDataStorage) Estimated usage for day %u: %.1f - %.1f (%lu)\n"), last.Day, imp, exp, (int32_t) cur); - } - month.activeImport += imp; month.activeExport += exp; month.lastMeterReadTime = cur; @@ -439,9 +372,6 @@ uint32_t AmsDataStorage::getDayExport(uint8_t day) { bool AmsDataStorage::load() { if(!LittleFS.begin()) { - if(debugger->isActive(RemoteDebug::ERROR)) { - debugger->printf_P(PSTR("(AmsDataStorage) Unable to load LittleFS\n")); - } return false; } @@ -450,18 +380,48 @@ bool AmsDataStorage::load() { File file = LittleFS.open(FILE_DAYPLOT, "r"); char buf[file.size()]; file.readBytes(buf, file.size()); - DayDataPoints* day = (DayDataPoints*) buf; + if(buf[0] > 5) { + DayDataPoints* day = (DayDataPoints*) buf; + ret = setDayData(*day); + } else { + DayDataPoints5* old = (DayDataPoints5*) buf; + DayDataPoints day = { old->version }; + day.lastMeterReadTime = old->lastMeterReadTime; + day.activeImport = old->activeImport; + day.activeExport = old->activeExport; + day.accuracy = old->accuracy; + for(uint8_t i = 0; i < 24; i++) { + day.hImport[i] = old->hImport[i]; + day.hExport[i] = old->hExport[i]; + } + + ret = setDayData(day); + } file.close(); - ret = setDayData(*day); } if(LittleFS.exists(FILE_MONTHPLOT)) { File file = LittleFS.open(FILE_MONTHPLOT, "r"); char buf[file.size()]; file.readBytes(buf, file.size()); - MonthDataPoints* month = (MonthDataPoints*) buf; + if(buf[0] > 6) { + MonthDataPoints* month = (MonthDataPoints*) buf; + ret &= setMonthData(*month); + } else { + MonthDataPoints6* old = (MonthDataPoints6*) buf; + MonthDataPoints month = { old->version }; + month.lastMeterReadTime = old->lastMeterReadTime; + month.activeImport = old->activeImport; + month.activeExport = old->activeExport; + month.accuracy = old->accuracy; + for(uint8_t i = 0; i < 31; i++) { + month.dImport[i] = old->dImport[i]; + month.dExport[i] = old->dExport[i]; + } + + ret &= setMonthData(month); + } file.close(); - ret = ret && setMonthData(*month); } return ret; @@ -469,9 +429,6 @@ bool AmsDataStorage::load() { bool AmsDataStorage::save() { if(!LittleFS.begin()) { - if(debugger->isActive(RemoteDebug::ERROR)) { - debugger->printf_P(PSTR("(AmsDataStorage) Unable to load LittleFS\n")); - } return false; } { @@ -504,38 +461,40 @@ MonthDataPoints AmsDataStorage::getMonthData() { } bool AmsDataStorage::setDayData(DayDataPoints& day) { - if(day.version == 5) { + if(day.version == 5 || day.version == 6) { this->day = day; + this->day.version = 6; return true; } else if(day.version == 4) { this->day = day; this->day.accuracy = 1; - this->day.version = 5; + this->day.version = 6; return true; } else if(day.version == 3) { this->day = day; for(uint8_t i = 0; i < 24; i++) this->day.hExport[i] = 0; this->day.accuracy = 1; - this->day.version = 5; + this->day.version = 6; return true; } return false; } bool AmsDataStorage::setMonthData(MonthDataPoints& month) { - if(month.version == 6) { + if(month.version == 6 || month.version == 7) { this->month = month; + this->month.version = 7; return true; } else if(month.version == 5) { this->month = month; this->month.accuracy = 1; - this->month.version = 6; + this->month.version = 7; return true; } else if(month.version == 4) { this->month = month; for(uint8_t i = 0; i < 31; i++) this->month.dExport[i] = 0; this->month.accuracy = 1; - this->month.version = 6; + this->month.version = 7; return true; } return false; @@ -578,7 +537,6 @@ bool AmsDataStorage::isHappy() { bool AmsDataStorage::isDayHappy() { if(tz == NULL) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Timezone is missing\n")); return false; } @@ -586,11 +544,9 @@ bool AmsDataStorage::isDayHappy() { if(now < FirmwareVersion::BuildEpoch) return false; if(now < day.lastMeterReadTime) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Day data timestamp %lu < %lu\n"), (int32_t) now, (int32_t) day.lastMeterReadTime); return false; } if(now-day.lastMeterReadTime > 3600) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Day data timestamp age %lu - %lu > 3600\n"), (int32_t) now, (int32_t) day.lastMeterReadTime); return false; } @@ -598,7 +554,6 @@ bool AmsDataStorage::isDayHappy() { breakTime(tz->toLocal(now), tm); breakTime(tz->toLocal(day.lastMeterReadTime), last); if(tm.Hour != last.Hour) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Day data hour of last timestamp %d > %d\n"), tm.Hour, last.Hour); return false; } @@ -607,7 +562,6 @@ bool AmsDataStorage::isDayHappy() { bool AmsDataStorage::isMonthHappy() { if(tz == NULL) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Timezone is missing\n")); return false; } @@ -616,21 +570,31 @@ bool AmsDataStorage::isMonthHappy() { tmElements_t tm, last; if(now < month.lastMeterReadTime) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Month data timestamp %lu < %lu\n"), (int32_t) now, (int32_t) month.lastMeterReadTime); return false; } breakTime(tz->toLocal(now), tm); breakTime(tz->toLocal(month.lastMeterReadTime), last); if(tm.Day != last.Day) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(AmsDataStorage) Month data day of last timestamp %d > %d\n"), tm.Day, last.Day); return false; } if(now-month.lastMeterReadTime > 90100) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(AmsDataStorage) Month %lu - %lu > 3600\n", (int32_t) now, (int32_t) month.lastMeterReadTime); return false; } return true; } + +double AmsDataStorage::getEstimatedImportCounter() { + if(day.lastMeterReadTime == 0) return 0; + + time_t now = time(nullptr); + double hours = (now - day.lastMeterReadTime) / 3600.0; + uint64_t total = 0; + for(uint8_t i = 0; i < 24; i++) { + total += getHourImport(i); + } + double perHour = total / 24.0; + return (day.activeImport + (perHour * hours)) / 1000.0; +} \ No newline at end of file diff --git a/lib/AmsDecoder/include/Cosem.h b/lib/AmsDecoder/include/Cosem.h index e218cd7e..012d9773 100644 --- a/lib/AmsDecoder/include/Cosem.h +++ b/lib/AmsDecoder/include/Cosem.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _COSEM_H #define _COSEM_H diff --git a/lib/AmsDecoder/include/DataParser.h b/lib/AmsDecoder/include/DataParser.h index 6aa92fae..eb80e6ce 100644 --- a/lib/AmsDecoder/include/DataParser.h +++ b/lib/AmsDecoder/include/DataParser.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _DATAPASERSER_H #define _DATAPASERSER_H @@ -10,6 +16,10 @@ #define DATA_TAG_MBUS 0x68 #define DATA_TAG_GBT 0xE0 #define DATA_TAG_GCM 0xDB +#define DATA_TAG_SNRM 0x81 +#define DATA_TAG_AARQ 0x60 +#define DATA_TAG_AARE 0x61 +#define DATA_TAG_RES 0xC4 // Get Response #define DATA_PARSE_OK 0 #define DATA_PARSE_FAIL -1 diff --git a/lib/AmsDecoder/include/DataParsers.h b/lib/AmsDecoder/include/DataParsers.h index 5355784e..3e29b576 100644 --- a/lib/AmsDecoder/include/DataParsers.h +++ b/lib/AmsDecoder/include/DataParsers.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _DATAPASERSERS_H #define _DATAPASERSERS_H diff --git a/lib/AmsDecoder/include/DlmsParser.h b/lib/AmsDecoder/include/DlmsParser.h index 200f0fe9..e7ee15d4 100644 --- a/lib/AmsDecoder/include/DlmsParser.h +++ b/lib/AmsDecoder/include/DlmsParser.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _DLMSPARSER_H #define _DLMSPARSER_H diff --git a/lib/AmsDecoder/include/DsmrParser.h b/lib/AmsDecoder/include/DsmrParser.h index d647de4e..4e2a7f94 100644 --- a/lib/AmsDecoder/include/DsmrParser.h +++ b/lib/AmsDecoder/include/DsmrParser.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _DSMRPARSER_H #define _DSMRPARSER_H diff --git a/lib/AmsDecoder/include/GbtParser.h b/lib/AmsDecoder/include/GbtParser.h index dd97960b..70afcd6b 100644 --- a/lib/AmsDecoder/include/GbtParser.h +++ b/lib/AmsDecoder/include/GbtParser.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _GBTPARSER_H #define _GBTPARSER_H diff --git a/lib/AmsDecoder/include/GcmParser.h b/lib/AmsDecoder/include/GcmParser.h index 23fe9337..fb65ee49 100644 --- a/lib/AmsDecoder/include/GcmParser.h +++ b/lib/AmsDecoder/include/GcmParser.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _GCMPARSER_H #define _GCMPARSER_H diff --git a/lib/AmsDecoder/include/HdlcParser.h b/lib/AmsDecoder/include/HdlcParser.h index 7091cfbd..2289fa05 100644 --- a/lib/AmsDecoder/include/HdlcParser.h +++ b/lib/AmsDecoder/include/HdlcParser.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _HDLCPARSER_H #define _HDLCPARSER_H @@ -24,6 +30,11 @@ typedef struct HDLC3CtrlHcs { class HDLCParser { public: int8_t parse(uint8_t *buf, DataParserContext &ctx); + +private: + uint8_t lastSequenceNumber = 0; + uint16_t pos = 0; + uint8_t *buf = NULL; }; #endif diff --git a/lib/AmsDecoder/include/LlcParser.h b/lib/AmsDecoder/include/LlcParser.h index 3be93109..a7b1fb1b 100644 --- a/lib/AmsDecoder/include/LlcParser.h +++ b/lib/AmsDecoder/include/LlcParser.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _LLCPARSER_H #define _LLCPARSER_H diff --git a/lib/AmsDecoder/include/MbusParser.h b/lib/AmsDecoder/include/MbusParser.h index 61e255d4..132e8371 100644 --- a/lib/AmsDecoder/include/MbusParser.h +++ b/lib/AmsDecoder/include/MbusParser.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _MBUSPARSER_H #define _MBUSPARSER_H diff --git a/lib/AmsDecoder/include/crc.h b/lib/AmsDecoder/include/crc.h index 660b5057..4a2c84d1 100644 --- a/lib/AmsDecoder/include/crc.h +++ b/lib/AmsDecoder/include/crc.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _CRC_H #define _CRC_H @@ -6,5 +12,6 @@ uint16_t crc16(const uint8_t* p, int len); uint16_t crc16_x25(const uint8_t* p, int len); +uint16_t crc16_1021(const uint8_t* p, int len); #endif diff --git a/lib/AmsDecoder/include/ntohll.h b/lib/AmsDecoder/include/ntohll.h index 2bb1e5e0..761fed0a 100644 --- a/lib/AmsDecoder/include/ntohll.h +++ b/lib/AmsDecoder/include/ntohll.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _NTOHLL_H #define _NTOHLL_H diff --git a/lib/AmsDecoder/src/Cosem.cpp b/lib/AmsDecoder/src/Cosem.cpp index 96d796fd..298a681d 100644 --- a/lib/AmsDecoder/src/Cosem.cpp +++ b/lib/AmsDecoder/src/Cosem.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "Cosem.h" #include "lwip/def.h" #include diff --git a/lib/AmsDecoder/src/DlmsParser.cpp b/lib/AmsDecoder/src/DlmsParser.cpp index f0ed63e2..08af8dc9 100644 --- a/lib/AmsDecoder/src/DlmsParser.cpp +++ b/lib/AmsDecoder/src/DlmsParser.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "DlmsParser.h" #include "Cosem.h" diff --git a/lib/AmsDecoder/src/DsmrParser.cpp b/lib/AmsDecoder/src/DsmrParser.cpp index 142c43b1..6d2379df 100644 --- a/lib/AmsDecoder/src/DsmrParser.cpp +++ b/lib/AmsDecoder/src/DsmrParser.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "DsmrParser.h" #include "crc.h" #include "hexutils.h" diff --git a/lib/AmsDecoder/src/GbtParser.cpp b/lib/AmsDecoder/src/GbtParser.cpp index 721bb5b3..ec5d3a25 100644 --- a/lib/AmsDecoder/src/GbtParser.cpp +++ b/lib/AmsDecoder/src/GbtParser.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "GbtParser.h" #include "lwip/def.h" diff --git a/lib/AmsDecoder/src/GcmParser.cpp b/lib/AmsDecoder/src/GcmParser.cpp index 7034e672..eb605792 100644 --- a/lib/AmsDecoder/src/GcmParser.cpp +++ b/lib/AmsDecoder/src/GcmParser.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "GcmParser.h" #include "lwip/def.h" #if defined(ESP8266) diff --git a/lib/AmsDecoder/src/HdlcParser.cpp b/lib/AmsDecoder/src/HdlcParser.cpp index 68a65ae1..3606e3cc 100644 --- a/lib/AmsDecoder/src/HdlcParser.cpp +++ b/lib/AmsDecoder/src/HdlcParser.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "HdlcParser.h" #include "lwip/def.h" #include "crc.h" @@ -49,8 +55,41 @@ int8_t HDLCParser::parse(uint8_t *d, DataParserContext &ctx) { ptr += 3; // Exclude all of header and 3 byte footer - ctx.length -= ptr-d+3; - return ptr-d; + ctx.length -= ptr-d; + if(ctx.length > 1) { + ctx.length -= 3; + } + + // Payload incomplete + if((h->format & 0x08) == 0x08) { + if(lastSequenceNumber == 0) { + if(buf == NULL) buf = (uint8_t *)malloc((size_t)1024); + pos = 0; + } + + if(buf == NULL) return DATA_PARSE_FAIL; + + memcpy(buf + pos, ptr+3, ctx.length); // +3 to skip LLC + pos += ctx.length; + + lastSequenceNumber++; + return DATA_PARSE_INTERMEDIATE_SEGMENT; + } else if(lastSequenceNumber > 0) { + lastSequenceNumber = 0; + if(buf == NULL) return DATA_PARSE_FAIL; + + memcpy(buf + pos, ptr+3, ctx.length); // +3 to skip LLC + pos += ctx.length; + + memcpy((uint8_t *) d, buf, pos); + free(buf); + buf = NULL; + ctx.length = pos; + pos = 0; + return DATA_PARSE_OK; + } else { + return ptr-d; + } } return DATA_PARSE_UNKNOWN_DATA; } \ No newline at end of file diff --git a/lib/AmsDecoder/src/LlcParser.cpp b/lib/AmsDecoder/src/LlcParser.cpp index c6d41a56..9ab24a94 100644 --- a/lib/AmsDecoder/src/LlcParser.cpp +++ b/lib/AmsDecoder/src/LlcParser.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "LlcParser.h" int8_t LLCParser::parse(uint8_t *buf, DataParserContext &ctx) { diff --git a/lib/AmsDecoder/src/MbusParser.cpp b/lib/AmsDecoder/src/MbusParser.cpp index 4a090da9..85285de8 100644 --- a/lib/AmsDecoder/src/MbusParser.cpp +++ b/lib/AmsDecoder/src/MbusParser.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "MbusParser.h" int8_t MBUSParser::parse(uint8_t *d, DataParserContext &ctx) { diff --git a/lib/AmsDecoder/src/crc.cpp b/lib/AmsDecoder/src/crc.cpp index da8e9d76..af3018bf 100644 --- a/lib/AmsDecoder/src/crc.cpp +++ b/lib/AmsDecoder/src/crc.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "crc.h" uint16_t crc16_x25(const uint8_t* p, int len) @@ -15,7 +21,7 @@ uint16_t crc16 (const uint8_t *p, int len) { uint16_t crc = 0; while (len--) { - int i; + uint8_t i; crc ^= *p++; for (i = 0 ; i < 8 ; ++i) { if (crc & 1) @@ -26,4 +32,23 @@ uint16_t crc16 (const uint8_t *p, int len) { } return crc; -} \ No newline at end of file +} + +uint16_t crc16_1021(const uint8_t *p, int len) { + uint32_t crc = 0x0000; + for(int i = 0; i < len; i++) { + int mask = 0x80; + while(mask > 0) { + crc <<= 1; + if (p[i] & mask){ + crc |= 1; + } + mask>>=1; + if (crc & 0x10000) { + crc &= 0xffff; + crc ^= 0x1021; + } + } + } + return crc; +} diff --git a/lib/AmsDecoder/src/ntohll.cpp b/lib/AmsDecoder/src/ntohll.cpp index 25732434..52046e1a 100644 --- a/lib/AmsDecoder/src/ntohll.cpp +++ b/lib/AmsDecoder/src/ntohll.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "ntohll.h" uint64_t ntohll(uint64_t x) { diff --git a/lib/AmsMqttHandler/include/AmsMqttHandler.h b/lib/AmsMqttHandler/include/AmsMqttHandler.h index 74dd2fac..53e15893 100644 --- a/lib/AmsMqttHandler/include/AmsMqttHandler.h +++ b/lib/AmsMqttHandler/include/AmsMqttHandler.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _AMSMQTTHANDLER_H #define _AMSMQTTHANDLER_H @@ -7,7 +13,7 @@ #include "AmsConfiguration.h" #include "EnergyAccounting.h" #include "HwTools.h" -#include "EntsoeApi.h" +#include "PriceService.h" #if defined(ESP32) #include @@ -34,10 +40,10 @@ class AmsMqttHandler { virtual uint8_t getFormat() { return 0; }; - virtual bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, EntsoeApi* eapi) { return false; }; + virtual bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, PriceService* ps) { return false; }; virtual bool publishTemperatures(AmsConfiguration*, HwTools*) { return false; }; - virtual bool publishPrices(EntsoeApi* eapi) { return false; }; - virtual bool publishSystem(HwTools*, EntsoeApi*, EnergyAccounting*) { return false; }; + virtual bool publishPrices(PriceService* ps) { return false; }; + virtual bool publishSystem(HwTools*, PriceService*, EnergyAccounting*) { return false; }; virtual bool publishRaw(String data) { return false; }; virtual void onMessage(String &topic, String &payload) {}; diff --git a/lib/AmsMqttHandler/src/AmsMqttHandler.cpp b/lib/AmsMqttHandler/src/AmsMqttHandler.cpp index 16dba846..5096888f 100644 --- a/lib/AmsMqttHandler/src/AmsMqttHandler.cpp +++ b/lib/AmsMqttHandler/src/AmsMqttHandler.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "AmsMqttHandler.h" #include "FirmwareVersion.h" #include "AmsStorage.h" @@ -25,15 +31,12 @@ bool AmsMqttHandler::connect() { if(mqttConfig.ssl) { if(epoch < FirmwareVersion::BuildEpoch) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("NTP not ready for MQTT SSL\n")); return false; } - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("MQTT SSL is configured (%dkb free heap)\n"), ESP.getFreeHeap()); if(mqttSecureClient == NULL) { mqttSecureClient = new WiFiClientSecure(); #if defined(ESP8266) mqttSecureClient->setBufferSizes(512, 512); - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("ESP8266 firmware does not have enough memory...\n")); return false; #endif } @@ -43,83 +46,69 @@ bool AmsMqttHandler::connect() { File file; if(LittleFS.exists(FILE_MQTT_CA)) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Found MQTT CA file (%dkb free heap)\n"), ESP.getFreeHeap()); file = LittleFS.open(FILE_MQTT_CA, (char*) "r"); #if defined(ESP8266) BearSSL::X509List *serverTrustedCA = new BearSSL::X509List(file); mqttSecureClient->setTrustAnchors(serverTrustedCA); #elif defined(ESP32) - if(mqttSecureClient->loadCACert(file, file.size())) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("CA accepted\n")); - } else { - if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("CA was rejected\n")); + if(!mqttSecureClient->loadCACert(file, file.size())) { return false; } #endif file.close(); } else { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("No CA, disabling validation\n")); mqttSecureClient->setInsecure(); } #if defined(ESP8266) if(LittleFS.exists(FILE_MQTT_CERT) && LittleFS.exists(FILE_MQTT_KEY)) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Found MQTT certificate file (%dkb free heap)\n"), ESP.getFreeHeap()); file = LittleFS.open(FILE_MQTT_CERT, (char*) "r"); BearSSL::X509List *serverCertList = new BearSSL::X509List(file); file.close(); - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Found MQTT key file (%dkb free heap)\n"), ESP.getFreeHeap()); file = LittleFS.open(FILE_MQTT_KEY, (char*) "r"); BearSSL::PrivateKey *serverPrivKey = new BearSSL::PrivateKey(file); file.close(); - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Loading cert and key (%dkb free heap)\n"), ESP.getFreeHeap()); mqttSecureClient->setClientRSACert(serverCertList, serverPrivKey); } #endif #if defined(ESP32) if(LittleFS.exists(FILE_MQTT_CERT)) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Found MQTT certificate file (%dkb free heap)\n"), ESP.getFreeHeap()); file = LittleFS.open(FILE_MQTT_CERT, (char*) "r"); mqttSecureClient->loadCertificate(file, file.size()); file.close(); } if(LittleFS.exists(FILE_MQTT_KEY)) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Found MQTT key file (%dkb free heap)\n"), ESP.getFreeHeap()); file = LittleFS.open(FILE_MQTT_KEY, (char*) "r"); mqttSecureClient->loadPrivateKey(file, file.size()); file.close(); } #endif - - LittleFS.end(); } else { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("CA verification disabled\n")); mqttSecureClient->setInsecure(); } } actualClient = mqttSecureClient; - - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("MQTT SSL setup complete (%dkb free heap)\n"), ESP.getFreeHeap()); } else { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("No SSL, using client without SSL support\n")); if(mqttClient == NULL) { mqttClient = new WiFiClient(); } actualClient = mqttClient; } + actualClient->setTimeout(4); + mqttConfigChanged = false; - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Connecting to MQTT %s:%d\n"), mqttConfig.host, mqttConfig.port); mqtt.begin(mqttConfig.host, mqttConfig.port, *actualClient); + String statusTopic = String(mqttConfig.publishTopic) + "/status"; + mqtt.setWill(statusTopic.c_str(), "offline", true, 0); #if defined(ESP8266) if(mqttSecureClient) { time_t epoch = time(nullptr); - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Setting NTP time %lu for secure MQTT connection\n"), epoch); mqttSecureClient->setX509Time(epoch); } #endif @@ -135,6 +124,7 @@ bool AmsMqttHandler::connect() { if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR(" Unable to subscribe to to [%s]\n"), mqttConfig.subscribeTopic); } } + mqtt.publish(statusTopic, "online", true, 0); return true; } else { if (debugger->isActive(RemoteDebug::ERROR)) { diff --git a/lib/CloudConnector/include/CloudConnector.h b/lib/CloudConnector/include/CloudConnector.h index 9ea41673..e9537fba 100644 --- a/lib/CloudConnector/include/CloudConnector.h +++ b/lib/CloudConnector/include/CloudConnector.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _CLOUDCONNECTOR_H #define _CLOUDCONNECTOR_H @@ -11,18 +17,31 @@ #include "mbedtls/error.h" #include "mbedtls/certs.h" #include "mbedtls/rsa.h" +#include "AmsConfiguration.h" +#include "AmsData.h" +#include "EnergyAccounting.h" +#include "HwTools.h" +#include "AmsMqttHandler.h" +#if defined(ESP8266) + #include +#elif defined(ESP32) // ARDUINO_ARCH_ESP32 + #include + #include + #include + #include +#else + #warning "Unsupported board type" +#endif -const unsigned char PUBLIC_KEY[] = \ -"-----BEGIN PUBLIC KEY-----\n"\ -"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDoIo0CSuuX3tAdF7KPssdlzJNX\n"\ -"QryhgVV1rQIFPhHv3SxzyKtRrRM9s0CVfymcibhnEBXxxg3pxlGmwI/R6k7HHXJN\n"\ -"lBsXzzDtZ/GHDVnw+xRakTfRT0Zt+xdJSH5xJNWq4EwpvJfjA22L1Nz4dKSpgWMx\n"\ -"VRndAaXf0s7Q1XBz2wIDAQAB\n"\ -"-----END PUBLIC KEY-----\0"; - +#define CC_BUF_SIZE 1024 -//const unsigned char PUBLIC_KEY[] = { 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xe8, 0x22, 0x8d, 0x02, 0x4a, 0xeb, 0x97, 0xde, 0xd0, 0x1d, 0x17, 0xb2, 0x8f, 0xb2, 0xc7, 0x65, 0xcc, 0x93, 0x57, 0x42, 0xbc, 0xa1, 0x81, 0x55, 0x75, 0xad, 0x02, 0x05, 0x3e, 0x11, 0xef, 0xdd, 0x2c, 0x73, 0xc8, 0xab, 0x51, 0xad, 0x13, 0x3d, 0xb3, 0x40, 0x95, 0x7f, 0x29, 0x9c, 0x89, 0xb8, 0x67, 0x10, 0x15, 0xf1, 0xc6, 0x0d, 0xe9, 0xc6, 0x51, 0xa6, 0xc0, 0x8f, 0xd1, 0xea, 0x4e, 0xc7, 0x1d, 0x72, 0x4d, 0x94, 0x1b, 0x17, 0xcf, 0x30, 0xed, 0x67, 0xf1, 0x87, 0x0d, 0x59, 0xf0, 0xfb, 0x14, 0x5a, 0x91, 0x37, 0xd1, 0x4f, 0x46, 0x6d, 0xfb, 0x17, 0x49, 0x48, 0x7e, 0x71, 0x24, 0xd5, 0xaa, 0xe0, 0x4c, 0x29, 0xbc, 0x97, 0xe3, 0x03, 0x6d, 0x8b, 0xd4, 0xdc, 0xf8, 0x74, 0xa4, 0xa9, 0x81, 0x63, 0x31, 0x55, 0x19, 0xdd, 0x01, 0xa5, 0xdf, 0xd2, 0xce, 0xd0, 0xd5, 0x70, 0x73, 0xdb, 0x02, 0x03, 0x01, 0x00, 0x01}; +static const char CC_JSON_POWER[] PROGMEM = ",\"%s\":{\"P\":%lu,\"Q\":%lu}"; +static const char CC_JSON_POWER_LIST3[] PROGMEM = ",\"%s\":{\"P\":%lu,\"Q\":%lu,\"tP\":%.3f,\"tQ\":%.3f}"; +static const char CC_JSON_PHASE[] PROGMEM = "%s\"%d\":{\"u\":%.2f,\"i\":%s}"; +static const char CC_JSON_PHASE_LIST4[] PROGMEM = "%s\"%d\":{\"u\":%.2f,\"i\":%s,\"Pim\":%lu,\"Pex\":%lu,\"pf\":%.2f}"; +static const char CC_JSON_STATUS[] PROGMEM = ",\"status\":{\"esp\":{\"state\":%d,\"error\":%d},\"han\":{\"state\":%d,\"error\":%d},\"wifi\":{\"state\":%d,\"error\":%d},\"mqtt\":{\"state\":%d,\"error\":%d}}"; +static const char CC_JSON_INIT[] PROGMEM = "{\"id\":\"%s\",\"init\":{\"mac\":\"%s\",\"apmac\":\"%s\",\"version\":\"%s\"},\"meter\":{\"manufacturerId\":%d,\"manufacturer\":\"%s\",\"model\":\"%s\",\"id\":\"%s\",\"system\":\"%s\",\"fuse\":%d,\"import\":%d,\"export\":%d}"; struct CloudData { uint8_t type; @@ -32,16 +51,57 @@ struct CloudData { class CloudConnector { public: CloudConnector(RemoteDebug*); - void setup(const unsigned char * key); - void send(); + bool setup(CloudConfig& config, MeterConfig& meter, HwTools* hw); + void setMqttHandler(AmsMqttHandler* mqttHandler); + void update(AmsData& data, EnergyAccounting& ea); + void forceUpdate(); private: RemoteDebug* debugger; + HwTools* hw; + AmsMqttHandler* mqttHandler = NULL; + CloudConfig config; + HTTPClient http; + WiFiUDP udp; + int maxPwr = 0; + uint8_t distributionSystem = 0; + uint16_t mainFuse = 0, productionCapacity = 0; + + String uuid; + bool initialized = false; + unsigned long lastUpdate = 0; + char mac[18]; + char apmac[18]; - unsigned char buf[4096]; + char clearBuffer[CC_BUF_SIZE]; + unsigned char encryptedBuffer[256]; mbedtls_rsa_context* rsa = nullptr; + mbedtls_ctr_drbg_context ctr_drbg; + mbedtls_entropy_context entropy; + char* pers = "amsreader"; + bool init(); void debugPrint(byte *buffer, int start, int length); + String meterManufacturer(uint8_t type) { + switch(type) { + case AmsTypeAidon: return F("Aidon"); + case AmsTypeKaifa: return F("Kaifa"); + case AmsTypeKamstrup: return F("Kamstrup"); + case AmsTypeIskra: return F("Iskra"); + case AmsTypeLandisGyr: return F("Landis+Gyr"); + case AmsTypeSagemcom: return F("Sagemcom"); + } + return F(""); + } + + String distributionSystemStr(uint8_t ds) { + switch(ds) { + case 1: return F("IT"); + case 2: return F("TN"); + } + return F(""); + } + }; -#endif +#endif \ No newline at end of file diff --git a/lib/CloudConnector/src/CloudConnector.cpp b/lib/CloudConnector/src/CloudConnector.cpp index 7dbb5976..a03143a8 100644 --- a/lib/CloudConnector/src/CloudConnector.cpp +++ b/lib/CloudConnector/src/CloudConnector.cpp @@ -1,44 +1,339 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "CloudConnector.h" +#include "FirmwareVersion.h" +#include "crc.h" +#include "Uptime.h" +#include "hexutils.h" +#if defined(ESP32) +#include +#endif CloudConnector::CloudConnector(RemoteDebug* debugger) { this->debugger = debugger; - mbedtls_pk_context pk; - mbedtls_pk_init(&pk); - int error_code = 0; - if((error_code = mbedtls_pk_parse_public_key(&pk, PUBLIC_KEY, sizeof(PUBLIC_KEY))) == 0){ - debugger->printf("RSA public key OK\n"); - rsa = mbedtls_pk_rsa(pk); - } else { - debugger->printf("RSA public key read error: "); - mbedtls_strerror(error_code, (char*) buf, 4096); - debugger->printf("%s\n", buf); + http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS); + http.setReuse(false); + http.setTimeout(60000); + http.setUserAgent("ams2mqtt/" + String(FirmwareVersion::VersionString)); + http.useHTTP10(true); + + uint8_t mac[6]; + uint8_t apmac[6]; + + #if defined(ESP8266) + wifi_get_macaddr(STATION_IF, mac); + wifi_get_macaddr(SOFTAP_IF, apmac); + #elif defined(ESP32) + esp_wifi_get_mac((wifi_interface_t)ESP_IF_WIFI_STA, mac); + esp_wifi_get_mac((wifi_interface_t)ESP_IF_WIFI_AP, apmac); + #endif + sprintf_P(this->mac, PSTR("%02X:%02X:%02X:%02X:%02X:%02X"), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + sprintf_P(this->apmac, PSTR("%02X:%02X:%02X:%02X:%02X:%02X"), apmac[0], apmac[1], apmac[2], apmac[3], apmac[4], apmac[5]); +} + +bool CloudConnector::setup(CloudConfig& config, MeterConfig& meter, HwTools* hw) { + bool ret = false; + #if defined(ESP32) + if(!ESPRandom::isValidV4Uuid(config.clientId)) { + ESPRandom::uuid4(config.clientId); + ret = true; + } + uuid = ESPRandom::uuidToString(config.clientId); + #endif + + this->config = config; + this->hw = hw; + + this->maxPwr = 0; + this->distributionSystem = meter.distributionSystem; + this->mainFuse = meter.mainFuse; + this->productionCapacity = meter.productionCapacity; + + this->initialized = false; + + return ret; +} + +void CloudConnector::setMqttHandler(AmsMqttHandler* mqttHandler) { + this->mqttHandler = mqttHandler; +} + +bool CloudConnector::init() { + if(config.enabled) { + //if(config.port == 0) + config.port = 7443; + //if(strlen(config.hostname) == 0) + strcpy_P(config.hostname, PSTR("cloud.amsleser.no")); + + snprintf_P(clearBuffer, CC_BUF_SIZE, PSTR("http://%s/hub/cloud/public.key"), config.hostname); + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(CloudConnector) Downloading public key from %s\n"), clearBuffer); + #if defined(ESP8266) + WiFiClient client; + client.setTimeout(5000); + if(http.begin(client, clearBuffer)) { + #elif defined(ESP32) + if(http.begin(clearBuffer)) { + #endif + int status = http.GET(); + + #if defined(ESP32) + esp_task_wdt_reset(); + #elif defined(ESP8266) + ESP.wdtFeed(); + #endif + + if(status == HTTP_CODE_OK) { + String pub = http.getString(); + http.end(); + + memset(clearBuffer, 0, CC_BUF_SIZE); + snprintf(clearBuffer, CC_BUF_SIZE, pub.c_str()); + + if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Cloud public key:\n%s\n"), clearBuffer); + + mbedtls_pk_context pk; + mbedtls_pk_init(&pk); + + int error_code = 0; + if((error_code = mbedtls_pk_parse_public_key(&pk, (unsigned char*) clearBuffer, strlen((const char*) clearBuffer)+1)) == 0){ + if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("RSA public key OK\n")); + rsa = mbedtls_pk_rsa(pk); + mbedtls_ctr_drbg_init(&ctr_drbg); + mbedtls_entropy_init(&entropy); + + int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, + &entropy, (const unsigned char *) pers, + strlen(pers)); + if(ret != 0) { + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("mbedtls_ctr_drbg_seed return code: %d\n"), ret); + } + return ret == 0; + } else { + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf("RSA public key read error: "); + mbedtls_strerror(error_code, clearBuffer, CC_BUF_SIZE); + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf("%s\n", clearBuffer); + } + } else { + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("(CloudConnector) Communication error, returned status: %d\n"), status); + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf(http.errorToString(status).c_str()); + if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf(http.getString().c_str()); + + http.end(); + } + } } - debugger->flush(); - //send(); + return false; } -void CloudConnector::send() { - if(rsa != nullptr && mbedtls_rsa_check_pubkey(rsa) == 0) { - memset(buf, 0, 4096); +void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { + if(!config.enabled) return; + unsigned long now = millis(); + if(now-lastUpdate < config.interval*1000) return; + lastUpdate = now; + if(!ESPRandom::isValidV4Uuid(config.clientId)) { + if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("(CloudConnector) Client ID is not valid\n")); + return; + } + if(data.getListType() < 2) return; + + memset(clearBuffer, 0, CC_BUF_SIZE); + + int pos = 0; + if(initialized) { + float vcc = hw->getVcc(); + int rssi = hw->getWifiRssi(); + + uint8_t espStatus; + #if defined(ESP8266) + if(vcc < 2.0) { // Voltage not correct, ESP would not run on this voltage + espStatus = 1; + } else if(vcc > 2.8 && vcc < 3.5) { + espStatus = 1; + } else if(vcc > 2.7 && vcc < 3.6) { + espStatus = 2; + } else { + espStatus = 3; + } + #elif defined(ESP32) + if(vcc < 2.0) { // Voltage not correct, ESP would not run on this voltage + espStatus = 1; + } else if(vcc > 3.1 && vcc < 3.5) { + espStatus = 1; + } else if(vcc > 3.0 && vcc < 3.6) { + espStatus = 2; + } else { + espStatus = 3; + } + #endif + + uint8_t hanStatus; + if(data.getLastError() != 0) { + hanStatus = 3; + } else if(data.getLastUpdateMillis() == 0 && now < 30000) { + hanStatus = 0; + } else if(now - data.getLastUpdateMillis() < 15000) { + hanStatus = 1; + } else if(now - data.getLastUpdateMillis() < 30000) { + hanStatus = 2; + } else { + hanStatus = 3; + } + + uint8_t wifiStatus; + if(rssi > -75) { + wifiStatus = 1; + } else if(rssi > -95) { + wifiStatus = 2; + } else { + wifiStatus = 3; + } - CloudData data = {65, 127}; - unsigned char toEncrypt[4096] = {0}; + uint8_t mqttStatus; + if(mqttHandler == NULL) { + mqttStatus = 0; + } else if(mqttHandler->connected()) { + mqttStatus = 1; + } else if(mqttHandler->lastError() == 0) { + mqttStatus = 2; + } else { + mqttStatus = 3; + } - debugger->println("RSA clear data: "); - debugPrint(toEncrypt, 0, 256); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("{\"id\":\"%s\",\"data\":{\"clock\":%lu,\"up\":%lu,\"lastUpdate\":%lu,\"est\":%s"), + uuid.c_str(), + (uint32_t) time(nullptr), + (uint32_t) (millis64()/1000), + (uint32_t) (data.getLastUpdateMillis()/1000), + data.isCounterEstimated() ? "true" : "false" + ); + if(data.getListType() > 2) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER_LIST3, "import", data.getActiveImportPower(), data.getReactiveImportPower(), data.getActiveImportCounter(), data.getReactiveImportCounter()); + } else { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER, "import", data.getActiveImportPower(), data.getReactiveImportPower()); + } + if(data.getListType() > 2) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER_LIST3, "export", data.getActiveExportPower(), data.getReactiveExportPower(), data.getActiveExportCounter(), data.getReactiveExportCounter()); + } else { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER, "export", data.getActiveExportPower(), data.getReactiveExportPower()); + } + + if(data.getListType() > 1) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"phases\":{")); + bool first = true; + if(data.getL1Voltage() > 0.0) { + if(data.getListType() > 3) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 1, data.getL1Voltage(), String(data.getL1Current(), 2).c_str(), data.getL1ActiveImportPower(), data.getL1ActiveExportPower(), data.getL1PowerFactor()); + } else { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 1, data.getL1Voltage(), String(data.getL1Current(), 2).c_str()); + } + first = false; + } + if(data.getL2Voltage() > 0.0) { + if(data.getListType() > 3) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 2, data.getL2Voltage(), String(data.getL2Current(), 2).c_str(), data.getL2ActiveImportPower(), data.getL2ActiveExportPower(), data.getL2PowerFactor()); + } else { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 2, data.getL2Voltage(), data.isL2currentMissing() ? "null" : String(data.getL2Current(), 2).c_str()); + } + first = false; + } + if(data.getL3Voltage() > 0.0) { + if(data.getListType() > 3) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 3, data.getL3Voltage(), String(data.getL3Current(), 2).c_str(), data.getL3ActiveImportPower(), data.getL3ActiveExportPower(), data.getL3PowerFactor()); + } else { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 3, data.getL3Voltage(), String(data.getL3Current(), 2).c_str()); + } + first = false; + } + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("}")); + } + if(data.getListType() > 3) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"pf\":%.2f"), data.getPowerFactor()); + } - mbedtls_rsa_rsaes_pkcs1_v15_encrypt(rsa, NULL, NULL, MBEDTLS_RSA_PUBLIC, 256, toEncrypt, buf); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"realtime\":{\"import\":%.3f,\"export\":%.3f}"), ea.getUseThisHour(), ea.getProducedThisHour()); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"vcc\":%.2f,\"temp\":%.2f,\"rssi\":%d,\"free\":%d"), vcc, hw->getTemperature(), hw->getWifiRssi(), ESP.getFreeHeap()); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_STATUS, + espStatus, 0, + hanStatus, data.getLastError(), + wifiStatus, 0, + mqttStatus, mqttHandler == NULL ? 0 : mqttHandler->lastError() + ); - //byte hashResult[32]; - //mbedtls_sha256(toEncrypt, strlen((char*) toEncrypt), hashResult, 0); - //int success = mbedtls_rsa_rsassa_pkcs1_v15_sign(rsa, NULL, NULL, MBEDTLS_RSA_PUBLIC, MBEDTLS_MD_SHA256, strlen((char*) hashResult), hashResult, buf); - debugger->println("RSA encrypted data: "); - debugPrint(buf, 0, 256); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("}")); } else { - debugger->println("RSA key is invalid"); + if(!init()) { + if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("Unable to initialize cloud connector\n")); + return; + } + + if(mainFuse > 0 && distributionSystem > 0) { + int voltage = distributionSystem == 2 ? 400 : 230; + if(data.isThreePhase()) { + maxPwr = mainFuse * sqrt(3) * voltage; + } else if(data.isTwoPhase()) { + maxPwr = mainFuse * voltage; + } else { + maxPwr = mainFuse * 230; + } + } + + + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_INIT, + uuid.c_str(), + mac, + apmac, + FirmwareVersion::VersionString, + data.getMeterType(), + meterManufacturer(data.getMeterType()).c_str(), + data.getMeterModel().c_str(), + data.getMeterId().c_str(), + distributionSystemStr(distributionSystem).c_str(), + mainFuse, + maxPwr, + productionCapacity + ); + initialized = true; + } + uint16_t crc = crc16((uint8_t*) clearBuffer, pos); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"crc\":\"%04X\"}"), crc); + + if(rsa == nullptr) return; + int ret = mbedtls_rsa_check_pubkey(rsa); + if(ret != 0) { + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("mbedtls_rsa_pkcs1_encrypt return code: %d\n"), ret); + mbedtls_strerror(ret, clearBuffer, CC_BUF_SIZE); + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("%s\n"), clearBuffer); + return; } + memset(encryptedBuffer, 0, rsa->len); + + int maxlen = 100 * (rsa->len/128); + if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf("(CloudConnector) Sending %d bytes and maxlen %d\n", pos, maxlen); + udp.beginPacket(config.hostname,7443); + for(int i = 0; i < pos; i += maxlen) { + int size = min(maxlen, pos-i); + int ret = mbedtls_rsa_pkcs1_encrypt(rsa, mbedtls_ctr_drbg_random, &ctr_drbg, MBEDTLS_RSA_PUBLIC, size, (unsigned char*) (clearBuffer+i), encryptedBuffer); + if(ret == 0) { + udp.write(encryptedBuffer, rsa->len); + delay(1); + } else { + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("mbedtls_rsa_pkcs1_encrypt return code: %d\n"), ret); + mbedtls_strerror(ret, clearBuffer, CC_BUF_SIZE); + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("%s\n"), clearBuffer); + } + } + udp.endPacket(); } + +void CloudConnector::forceUpdate() { + lastUpdate = 0; +} + void CloudConnector::debugPrint(byte *buffer, int start, int length) { for (int i = start; i < start + length; i++) { if (buffer[i] < 0x10) diff --git a/lib/ConnectionHandler/include/ConnectionHandler.h b/lib/ConnectionHandler/include/ConnectionHandler.h new file mode 100644 index 00000000..e1fa1e8d --- /dev/null +++ b/lib/ConnectionHandler/include/ConnectionHandler.h @@ -0,0 +1,48 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#ifndef _CONNECTIONHANDLER_H +#define _CONNECTIONHANDLER_H + +#include "AmsConfiguration.h" +#if defined(ESP8266) +#include +#elif defined(ESP32) +#include +esp_netif_t* get_esp_interface_netif(esp_interface_t interface); +#endif + +#define NETWORK_MODE_WIFI_CLIENT 1 +#define NETWORK_MODE_WIFI_AP 2 +#define NETWORK_MODE_ETH_CLIENT 3 + +class ConnectionHandler { +public: + virtual ~ConnectionHandler() {}; + virtual bool connect(NetworkConfig config, SystemConfig sys); + virtual void disconnect(unsigned long reconnectDelay); + virtual bool isConnected(); + virtual bool isConfigChanged(); + virtual void getCurrentConfig(NetworkConfig& networkConfig); + virtual IPAddress getIP(); + virtual IPAddress getSubnetMask(); + virtual IPAddress getGateway(); + virtual IPAddress getDns(uint8_t idx); + #if defined(ESP32) + virtual IPv6Address getIPv6(); + virtual IPv6Address getDNSv6(uint8_t idx); + virtual void eventHandler(WiFiEvent_t event, WiFiEventInfo_t info); + #endif + + uint8_t getMode() { + return this->mode; + } + +protected: + uint8_t mode; +}; + +#endif diff --git a/lib/ConnectionHandler/include/EthernetConnectionHandler.h b/lib/ConnectionHandler/include/EthernetConnectionHandler.h new file mode 100644 index 00000000..0ccb09c9 --- /dev/null +++ b/lib/ConnectionHandler/include/EthernetConnectionHandler.h @@ -0,0 +1,49 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#ifndef _ETHERNETCONNECTIONHANDLER_H +#define _ETHERNETCONNECTIONHANDLER_H + +#include "ConnectionHandler.h" +#include +#include "RemoteDebug.h" + +#define CONNECTION_TIMEOUT 30000 + +class EthernetConnectionHandler : public ConnectionHandler { +public: + EthernetConnectionHandler(RemoteDebug* debugger); + + bool connect(NetworkConfig config, SystemConfig sys); + void disconnect(unsigned long reconnectDelay); + bool isConnected(); + bool isConfigChanged(); + void getCurrentConfig(NetworkConfig& networkConfig); + IPAddress getIP(); + IPAddress getSubnetMask(); + IPAddress getGateway(); + IPAddress getDns(uint8_t idx); + #if defined(ESP32) + IPv6Address getIPv6(); + IPv6Address getDNSv6(uint8_t idx); + void eventHandler(WiFiEvent_t event, WiFiEventInfo_t info); + #endif + +private: + RemoteDebug* debugger; + NetworkConfig config; + + bool connected = false; + bool configChanged = false; + unsigned long timeout = CONNECTION_TIMEOUT; + unsigned long lastRetry = 0; + + int8_t ethPowerPin = -1; + uint8_t ethEnablePin = 0; + +}; + +#endif diff --git a/lib/ConnectionHandler/include/WiFiAccessPointConnectionHandler.h b/lib/ConnectionHandler/include/WiFiAccessPointConnectionHandler.h new file mode 100644 index 00000000..8f366fff --- /dev/null +++ b/lib/ConnectionHandler/include/WiFiAccessPointConnectionHandler.h @@ -0,0 +1,44 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#ifndef _WIFIACCESSPOINTCONNECTIONHANDLER_H +#define _WIFIACCESSPOINTCONNECTIONHANDLER_H + +#include "ConnectionHandler.h" +#include +#include "RemoteDebug.h" +#include + +class WiFiAccessPointConnectionHandler : public ConnectionHandler { +public: + WiFiAccessPointConnectionHandler(RemoteDebug* debugger); + + bool connect(NetworkConfig config, SystemConfig sys); + void disconnect(unsigned long reconnectDelay); + bool isConnected(); + bool isConfigChanged(); + void getCurrentConfig(NetworkConfig& networkConfig); + IPAddress getIP(); + IPAddress getSubnetMask(); + IPAddress getGateway(); + IPAddress getDns(uint8_t idx); + #if defined(ESP32) + IPv6Address getIPv6(); + IPv6Address getDNSv6(uint8_t idx); + void eventHandler(WiFiEvent_t event, WiFiEventInfo_t info); + #endif + +private: + RemoteDebug* debugger; + NetworkConfig config; + + DNSServer dnsServer; + + bool connected = false; + bool configChanged = false; +}; + +#endif diff --git a/lib/ConnectionHandler/include/WiFiClientConnectionHandler.h b/lib/ConnectionHandler/include/WiFiClientConnectionHandler.h new file mode 100644 index 00000000..4b9b51f9 --- /dev/null +++ b/lib/ConnectionHandler/include/WiFiClientConnectionHandler.h @@ -0,0 +1,56 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#ifndef _WIFICLIENTCONNECTIONHANDLER_H +#define _WIFICLIENTCONNECTIONHANDLER_H + +#include "ConnectionHandler.h" +#include +#include "RemoteDebug.h" + +#define CONNECTION_TIMEOUT 30000 +#define RECONNECT_TIMEOUT 5000 + +#if defined(ESP32) +esp_err_t set_esp_interface_ip(esp_interface_t interface, IPAddress local_ip=INADDR_NONE, IPAddress gateway=INADDR_NONE, IPAddress subnet=INADDR_NONE, IPAddress dhcp_lease_start=INADDR_NONE); +#endif + +class WiFiClientConnectionHandler : public ConnectionHandler { +public: + WiFiClientConnectionHandler(RemoteDebug* debugger); + + bool connect(NetworkConfig config, SystemConfig sys); + void disconnect(unsigned long reconnectDelay); + bool isConnected(); + bool isConfigChanged(); + void getCurrentConfig(NetworkConfig& networkConfig); + IPAddress getIP(); + IPAddress getSubnetMask(); + IPAddress getGateway(); + IPAddress getDns(uint8_t idx); + #if defined(ESP32) + IPv6Address getIPv6(); + IPv6Address getDNSv6(uint8_t idx); + void eventHandler(WiFiEvent_t event, WiFiEventInfo_t info); + #endif + +private: + RemoteDebug* debugger; + NetworkConfig config; + bool busPowered = false; + bool firstConnect = true; + bool configChanged = false; + + unsigned long timeout = CONNECTION_TIMEOUT; + unsigned long lastRetry = 0; + + wl_status_t begin(const char* ssid, const char* psk); + #if defined(ESP32) + void wifi_sta_config(wifi_config_t * wifi_config, const char * ssid=NULL, const char * password=NULL, const uint8_t * bssid=NULL, uint8_t channel=0, wifi_auth_mode_t min_security=WIFI_AUTH_WPA2_PSK, wifi_scan_method_t scan_method=WIFI_ALL_CHANNEL_SCAN, wifi_sort_method_t sort_method=WIFI_CONNECT_AP_BY_SIGNAL, uint16_t listen_interval=0, bool pmf_required=false); + #endif +}; + +#endif diff --git a/lib/ConnectionHandler/src/EthernetConnectionHandler.cpp b/lib/ConnectionHandler/src/EthernetConnectionHandler.cpp new file mode 100644 index 00000000..472894d7 --- /dev/null +++ b/lib/ConnectionHandler/src/EthernetConnectionHandler.cpp @@ -0,0 +1,223 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#include "EthernetConnectionHandler.h" + +#if defined(ESP32) +#include +#include +#include +#endif + +EthernetConnectionHandler::EthernetConnectionHandler(RemoteDebug* debugger) { + this->debugger = debugger; + this->mode = NETWORK_MODE_ETH_CLIENT; +} + +bool EthernetConnectionHandler::connect(NetworkConfig config, SystemConfig sys) { + if(lastRetry > 0 && (millis() - lastRetry) < timeout) { + delay(50); + return false; + } + lastRetry = millis(); + + #if defined(ESP32) + if (!connected) { + eth_phy_type_t ethType = ETH_PHY_LAN8720; + eth_clock_mode_t ethClkMode = ETH_CLOCK_GPIO0_IN; + uint8_t ethAddr = 0; + uint8_t ethMdc = 0; + uint8_t ethMdio = 0; + + if(sys.boardType == 241) { // LilyGO T-ETH-POE + ethType = ETH_PHY_LAN8720; + ethEnablePin = -1; + ethAddr = 0; + ethClkMode = ETH_CLOCK_GPIO17_OUT; + ethPowerPin = 5; + ethMdc = 23; + ethMdio = 18; + } else if(sys.boardType == 242) { // M5 PoESP32 + ethType = ETH_PHY_IP101; + ethEnablePin = -1; + ethAddr = 1; + ethClkMode = ETH_CLOCK_GPIO0_IN; + ethPowerPin = 5; + ethMdc = 23; + ethMdio = 18; + } else if(sys.boardType == 243) { // WT32-ETH01 + ethType = ETH_PHY_LAN8720; + ethEnablePin = -1; + ethAddr = 1; + ethClkMode = ETH_CLOCK_GPIO17_OUT; + ethPowerPin = 16; + ethMdc = 23; + ethMdio = 18; + } else if(sys.boardType == 244) { + if (debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("LilyGO T-ETH-Lite\n")); + return false; // TODO + } else { + if (debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Board type %d incompatible with ETH\n"), sys.boardType); + return false; + } + + if(ethEnablePin > 0) { + pinMode(ethEnablePin, OUTPUT); + digitalWrite(ethEnablePin, 1); + } + + if (debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Connecting to Ethernet\n")); + + if(ETH.begin(ethAddr, ethPowerPin, ethMdc, ethMdio, ethType, ethClkMode)) { + #if defined(ESP32) + if(strlen(config.hostname) > 0) { + ETH.setHostname(config.hostname); + } + #endif + + if(strlen(config.ip) > 0) { + IPAddress ip, gw, sn(255,255,255,0), dns1, dns2; + ip.fromString(config.ip); + gw.fromString(config.gateway); + sn.fromString(config.subnet); + if(strlen(config.dns1) > 0) { + dns1.fromString(config.dns1); + } else if(strlen(config.gateway) > 0) { + dns1.fromString(config.gateway); // If no DNS, set gateway by default + } + if(strlen(config.dns2) > 0) { + dns2.fromString(config.dns2); + } else if(dns1.toString().isEmpty()) { + dns2.fromString(F("208.67.220.220")); // Add OpenDNS as second by default if nothing is configured + } + if(!ETH.config(ip, gw, sn, dns1, dns2)) { + debugger->printf_P(PSTR("Static IP configuration is invalid, not using\n")); + } + } + } else { + if (debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Unable to start Ethernet\n")); + } + } + #endif + return false; +} + +void EthernetConnectionHandler::disconnect(unsigned long reconnectDelay) { + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Disconnecting!\n")); +} + +bool EthernetConnectionHandler::isConnected() { + return connected; +} + +#if defined(ESP32) +void EthernetConnectionHandler::eventHandler(WiFiEvent_t event, WiFiEventInfo_t info) { + switch(event) { + case ARDUINO_EVENT_ETH_CONNECTED: + connected = true; + if(debugger->isActive(RemoteDebug::INFO)) { + debugger->printf_P(PSTR("Successfully connected to Ethernet!\n")); + } + break; + case ARDUINO_EVENT_ETH_GOT_IP: + if(debugger->isActive(RemoteDebug::INFO)) { + debugger->printf_P(PSTR("IP: %s\n"), getIP().toString().c_str()); + debugger->printf_P(PSTR("GW: %s\n"), getGateway().toString().c_str()); + for(uint8_t i = 0; i < 3; i++) { + IPAddress dns4 = getDns(i); + if(!dns4.isAny()) debugger->printf_P(PSTR("DNS: %s\n"), dns4.toString().c_str()); + } + } + break; + case ARDUINO_EVENT_ETH_GOT_IP6: { + if(debugger->isActive(RemoteDebug::INFO)) { + IPv6Address ipv6 = getIPv6(); + if(ipv6 == IPv6Address()) { + // No IP + } else { + debugger->printf_P(PSTR("IPv6: %s\n"), ipv6.toString().c_str()); + } + + for(uint8_t i = 0; i < 3; i++) { + IPv6Address dns6 = getDNSv6(i); + if(dns6 == IPv6Address()) { + // No IP + } else { + debugger->printf_P(PSTR("DNSv6: %s\n"), dns6.toString().c_str()); + } + } + } + break; + } + case ARDUINO_EVENT_ETH_DISCONNECTED: + connected = false; + if(debugger->isActive(RemoteDebug::WARNING)) { + debugger->printf_P(PSTR("Ethernet was disconnected!\n")); + } + break; + } +} +#endif + +bool EthernetConnectionHandler::isConfigChanged() { + return configChanged; +} + +void EthernetConnectionHandler::getCurrentConfig(NetworkConfig& networkConfig) { + networkConfig = this->config; +} + +IPAddress EthernetConnectionHandler::getIP() { + #if defined(ESP32) + return ETH.localIP(); + #else + return NULL; + #endif +} + +IPAddress EthernetConnectionHandler::getSubnetMask() { + #if defined(ESP32) + return ETH.subnetMask(); + #else + return NULL; + #endif +} + +IPAddress EthernetConnectionHandler::getGateway() { + #if defined(ESP32) + return ETH.gatewayIP(); + #else + return NULL; + #endif +} + +IPAddress EthernetConnectionHandler::getDns(uint8_t idx) { + #if defined(ESP32) + return ETH.dnsIP(idx); + #else + return NULL; + #endif +} + +#if defined(ESP32) +IPv6Address EthernetConnectionHandler::getIPv6() { + esp_ip6_addr_t addr; + if(esp_netif_get_ip6_global(get_esp_interface_netif(ESP_IF_ETH), &addr) == ESP_OK) { + return IPv6Address(addr.addr); + } + return IPv6Address(); +} + +IPv6Address EthernetConnectionHandler::getDNSv6(uint8_t idx) { + for(uint8_t i = 0; i < 3; i++) { + const ip_addr_t * dns = dns_getserver(i); + if(dns->type == IPADDR_TYPE_V6) { + if(idx-- == 0) return IPv6Address(dns->u_addr.ip6.addr); + } + } + return IPv6Address(); +} +#endif \ No newline at end of file diff --git a/lib/ConnectionHandler/src/WiFiAccessPointConnectionHandler.cpp b/lib/ConnectionHandler/src/WiFiAccessPointConnectionHandler.cpp new file mode 100644 index 00000000..7b1809a3 --- /dev/null +++ b/lib/ConnectionHandler/src/WiFiAccessPointConnectionHandler.cpp @@ -0,0 +1,102 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#include "WiFiAccessPointConnectionHandler.h" + +WiFiAccessPointConnectionHandler::WiFiAccessPointConnectionHandler(RemoteDebug* debugger) { + this->debugger = debugger; + this->mode = NETWORK_MODE_WIFI_AP; +} + +bool WiFiAccessPointConnectionHandler::connect(NetworkConfig config, SystemConfig sys) { + //wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, 0); // Disable default gw + + WiFi.mode(WIFI_AP); + WiFi.softAP(config.ssid, config.psk); + + dnsServer.setErrorReplyCode(DNSReplyCode::NoError); + dnsServer.start(53, PSTR("*"), WiFi.softAPIP()); + connected = true; + + return true; +} + +void WiFiAccessPointConnectionHandler::disconnect(unsigned long reconnectDelay) { + WiFi.disconnect(true); + WiFi.softAPdisconnect(true); + WiFi.enableAP(false); + WiFi.mode(WIFI_OFF); + yield(); +} + +bool WiFiAccessPointConnectionHandler::isConnected() { + return connected; +} + +#if defined(ESP32) +void WiFiAccessPointConnectionHandler::eventHandler(WiFiEvent_t event, WiFiEventInfo_t info) { + uint8_t mac[6]; + IPAddress stationIP; + switch(event) { + case ARDUINO_EVENT_WIFI_AP_START: + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("WiFi access point started with SSID %s\n"), config.ssid); + break; + case ARDUINO_EVENT_WIFI_AP_STOP: + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("WiFi access point stopped!\n")); + break; + case ARDUINO_EVENT_WIFI_AP_STACONNECTED: + memcpy(mac, info.wifi_ap_staconnected.mac, 6); + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Client connected to AP, client MAC: %02x:%02x:%02x:%02x:%02x:%02x\n"), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + break; + case ARDUINO_EVENT_WIFI_AP_STADISCONNECTED: + memcpy(mac, info.wifi_ap_staconnected.mac, 6); + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Client disconnected from AP, client MAC: %02x:%02x:%02x:%02x:%02x:%02x\n"), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + break; + case ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED: + stationIP = info.wifi_ap_staipassigned.ip.addr; + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Client was assigned IP %s\n"), stationIP.toString().c_str()); + break; + } +} +#endif + +bool WiFiAccessPointConnectionHandler::isConfigChanged() { + return configChanged; +} + +void WiFiAccessPointConnectionHandler::getCurrentConfig(NetworkConfig& networkConfig) { + networkConfig = this->config; +} + +IPAddress WiFiAccessPointConnectionHandler::getIP() { + return WiFi.softAPIP(); +} + +IPAddress WiFiAccessPointConnectionHandler::getSubnetMask() { + #if defined(ESP32) + return WiFi.softAPSubnetMask(); + #else + return IPAddress(255,255,255,0); + #endif +} + +IPAddress WiFiAccessPointConnectionHandler::getGateway() { + return WiFi.softAPIP(); +} + +IPAddress WiFiAccessPointConnectionHandler::getDns(uint8_t idx) { + return WiFi.softAPIP(); +} + +#if defined(ESP32) +IPv6Address WiFiAccessPointConnectionHandler::getIPv6() { + return IPv6Address(); +} + +IPv6Address WiFiAccessPointConnectionHandler::getDNSv6(uint8_t idx) { + return IPv6Address(); +} +#endif diff --git a/lib/ConnectionHandler/src/WiFiClientConnectionHandler.cpp b/lib/ConnectionHandler/src/WiFiClientConnectionHandler.cpp new file mode 100644 index 00000000..5fa4d483 --- /dev/null +++ b/lib/ConnectionHandler/src/WiFiClientConnectionHandler.cpp @@ -0,0 +1,389 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#include "WiFiClientConnectionHandler.h" +#if defined(ESP32) +#include +#include +#endif + +WiFiClientConnectionHandler::WiFiClientConnectionHandler(RemoteDebug* debugger) { + this->debugger = debugger; + this->mode = NETWORK_MODE_WIFI_CLIENT; +} + +bool WiFiClientConnectionHandler::connect(NetworkConfig config, SystemConfig sys) { + if(lastRetry > 0 && (millis() - lastRetry) < timeout) { + delay(50); + return false; + } + lastRetry = millis(); + + if (WiFi.status() != WL_CONNECTED) { + if(config.mode != this->mode || strlen(config.ssid) == 0) { + return false; + } + + if(WiFi.getMode() != WIFI_OFF) { + if (debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Not connected to WiFi, closing resources\n")); + + disconnect(RECONNECT_TIMEOUT); + return false; + } + timeout = CONNECTION_TIMEOUT; + + if (debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Connecting to WiFi network: %s\n"), config.ssid); + switch(sys.boardType) { + case 2: // spenceme + case 3: // Pow-K UART0 + case 4: // Pow-U UART0 + case 5: // Pow-K+ + case 6: // Pow-P1 + case 7: // Pow-U+ + case 8: // dbeinder: HAN mosquito + busPowered = true; + break; + default: + busPowered = false; + } + firstConnect = sys.dataCollectionConsent == 0; + + #if defined(ESP32) + if(strlen(config.hostname) > 0) { + WiFi.setHostname(config.hostname); + } + #endif + WiFi.mode(WIFI_STA); + + if(strlen(config.ip) > 0) { + IPAddress ip, gw, sn(255,255,255,0), dns1, dns2; + ip.fromString(config.ip); + gw.fromString(config.gateway); + sn.fromString(config.subnet); + if(strlen(config.dns1) > 0) { + dns1.fromString(config.dns1); + } else if(strlen(config.gateway) > 0) { + dns1.fromString(config.gateway); // If no DNS, set gateway by default + } + if(strlen(config.dns2) > 0) { + dns2.fromString(config.dns2); + } else if(dns1.toString().isEmpty()) { + dns2.fromString(F("208.67.220.220")); // Add OpenDNS as second by default if nothing is configured + } + if(!WiFi.config(ip, gw, sn, dns1, dns2)) { + debugger->printf_P(PSTR("Static IP configuration is invalid, not using\n")); + } + } + #if defined(ESP8266) + if(strlen(config.hostname) > 0) { + WiFi.hostname(config.hostname); + } + //wifi_set_phy_mode(PHY_MODE_11N); + if(!config.use11b) { + wifi_set_user_sup_rate(RATE_11G6M, RATE_11G54M); + wifi_set_user_rate_limit(RC_LIMIT_11G, 0x00, RATE_11G_G54M, RATE_11G_G6M); + wifi_set_user_rate_limit(RC_LIMIT_11N, 0x00, RATE_11N_MCS7S, RATE_11N_MCS0); + wifi_set_user_limit_rate_mask(LIMIT_RATE_MASK_ALL); + } + #endif + WiFi.setAutoReconnect(true); + #if defined(ESP32) + if(begin(config.ssid, config.psk)) { + #else + if(WiFi.begin(config.ssid, config.psk)) { + #endif + if(config.sleep <= 2) { + switch(config.sleep) { + case 0: + WiFi.setSleep(WIFI_PS_NONE); + break; + case 1: + WiFi.setSleep(WIFI_PS_MIN_MODEM); + break; + case 2: + WiFi.setSleep(WIFI_PS_MAX_MODEM); + break; + } + } + yield(); + } else { + if (debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Unable to start WiFi\n")); + } + this->config = config; + return true; + } + return false; +} + +#if defined(ESP32) +wl_status_t WiFiClientConnectionHandler::begin(const char* ssid, const char* passphrase) { + if(!WiFi.enableSTA(true)) { + log_e("STA enable failed!"); + return WL_CONNECT_FAILED; + } + + if(!ssid || *ssid == 0x00 || strlen(ssid) > 32) { + log_e("SSID too long or missing!"); + return WL_CONNECT_FAILED; + } + + if(passphrase && strlen(passphrase) > 64) { + log_e("passphrase too long!"); + return WL_CONNECT_FAILED; + } + + wifi_config_t conf; + memset(&conf, 0, sizeof(wifi_config_t)); + + wifi_sta_config(&conf, ssid, passphrase, NULL, 0, WIFI_AUTH_WPA2_PSK, WIFI_ALL_CHANNEL_SCAN, WIFI_CONNECT_AP_BY_SIGNAL); + + wifi_config_t current_conf; + if(esp_wifi_get_config((wifi_interface_t)ESP_IF_WIFI_STA, ¤t_conf) != ESP_OK){ + log_e("get current config failed!"); + return WL_CONNECT_FAILED; + } + if(memcmp(¤t_conf, &conf, sizeof(wifi_config_t)) == 0) { + if(esp_wifi_disconnect()){ + log_e("disconnect failed!"); + return WL_CONNECT_FAILED; + } + + if(esp_wifi_set_config((wifi_interface_t)ESP_IF_WIFI_STA, &conf) != ESP_OK){ + log_e("set config failed!"); + return WL_CONNECT_FAILED; + } + } else if(WiFi.status() == WL_CONNECTED){ + return WL_CONNECTED; + } else { + if(esp_wifi_set_config((wifi_interface_t)ESP_IF_WIFI_STA, &conf) != ESP_OK){ + log_e("set config failed!"); + return WL_CONNECT_FAILED; + } + } + + if(strlen(config.ip) > 0){ + if(set_esp_interface_ip(ESP_IF_WIFI_STA) != ESP_OK) { + return WL_CONNECT_FAILED; + } + } + + if(esp_wifi_connect() != ESP_OK) { + log_e("connect failed!"); + return WL_CONNECT_FAILED; + } + return WiFi.status(); +} + +void WiFiClientConnectionHandler::wifi_sta_config(wifi_config_t * wifi_config, const char * ssid, const char * password, const uint8_t * bssid, uint8_t channel, wifi_auth_mode_t min_security, wifi_scan_method_t scan_method, wifi_sort_method_t sort_method, uint16_t listen_interval, bool pmf_required){ + wifi_config->sta.channel = channel; + wifi_config->sta.listen_interval = listen_interval; + wifi_config->sta.scan_method = scan_method;//WIFI_ALL_CHANNEL_SCAN or WIFI_FAST_SCAN + wifi_config->sta.sort_method = sort_method;//WIFI_CONNECT_AP_BY_SIGNAL or WIFI_CONNECT_AP_BY_SECURITY + wifi_config->sta.threshold.rssi = -127; + wifi_config->sta.pmf_cfg.capable = true; + wifi_config->sta.pmf_cfg.required = pmf_required; + wifi_config->sta.bssid_set = 0; + memset(wifi_config->sta.bssid, 0, 6); + wifi_config->sta.threshold.authmode = WIFI_AUTH_OPEN; + wifi_config->sta.ssid[0] = 0; + wifi_config->sta.password[0] = 0; + if(ssid != NULL && ssid[0] != 0){ + strncpy((char*)wifi_config->sta.ssid, ssid, 32); + if(password != NULL && password[0] != 0){ + wifi_config->sta.threshold.authmode = min_security; + strncpy((char*)wifi_config->sta.password, password, 64); + } + if(bssid != NULL){ + wifi_config->sta.bssid_set = 1; + memcpy(wifi_config->sta.bssid, bssid, 6); + } + } + wifi_config->sta.rm_enabled = true; + wifi_config->sta.btm_enabled = true; + wifi_config->sta.mbo_enabled = true; +} +#endif + +void WiFiClientConnectionHandler::disconnect(unsigned long reconnectDelay) { + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Disconnecting!\n")); + #if defined(ESP8266) + WiFiClient::stopAll(); + #endif + + WiFi.disconnect(true); + WiFi.softAPdisconnect(true); + WiFi.enableAP(false); + WiFi.mode(WIFI_OFF); + yield(); + timeout = reconnectDelay; +} + +bool WiFiClientConnectionHandler::isConnected() { + return WiFi.status() == WL_CONNECTED; +} + +#if defined(ESP32) +void WiFiClientConnectionHandler::eventHandler(WiFiEvent_t event, WiFiEventInfo_t info) { + switch(event) { + case ARDUINO_EVENT_WIFI_READY: + if (!config.use11b) { + esp_wifi_config_11b_rate(WIFI_IF_AP, true); + esp_wifi_config_11b_rate(WIFI_IF_STA, true); + } + break; + case ARDUINO_EVENT_WIFI_STA_CONNECTED: + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Successfully connected to WiFi!\n")); + if(config.ipv6 && !WiFi.enableIpV6()) { + debugger->printf_P(PSTR("Unable to enable IPv6\n")); + } + #if defined(ESP32) + if(firstConnect && config.use11b) { + // If first boot and phyMode is better than 11b, disable 11b for BUS powered devices + if(busPowered) { + wifi_phy_mode_t phyMode; + if(esp_wifi_sta_get_negotiated_phymode(&phyMode) == ESP_OK) { + if(phyMode > WIFI_PHY_MODE_11B) { + if (debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("WiFi supports better rates than 802.11b, disabling\n")); + config.use11b = false; + configChanged = true; + return; + } + } + } + } + + if(config.power >= 195) + WiFi.setTxPower(WIFI_POWER_19_5dBm); + else if(config.power >= 190) + WiFi.setTxPower(WIFI_POWER_19dBm); + else if(config.power >= 185) + WiFi.setTxPower(WIFI_POWER_18_5dBm); + else if(config.power >= 170) + WiFi.setTxPower(WIFI_POWER_17dBm); + else if(config.power >= 150) + WiFi.setTxPower(WIFI_POWER_15dBm); + else if(config.power >= 130) + WiFi.setTxPower(WIFI_POWER_13dBm); + else if(config.power >= 110) + WiFi.setTxPower(WIFI_POWER_11dBm); + else if(config.power >= 85) + WiFi.setTxPower(WIFI_POWER_8_5dBm); + else if(config.power >= 70) + WiFi.setTxPower(WIFI_POWER_7dBm); + else if(config.power >= 50) + WiFi.setTxPower(WIFI_POWER_5dBm); + else if(config.power >= 20) + WiFi.setTxPower(WIFI_POWER_2dBm); + else + WiFi.setTxPower(WIFI_POWER_MINUS_1dBm); + #elif defined(ESP8266) + WiFi.setOutputPower(config.power / 10.0); + #endif + break; + case ARDUINO_EVENT_WIFI_STA_GOT_IP: { + if(debugger->isActive(RemoteDebug::INFO)) { + debugger->printf_P(PSTR("IP: %s\n"), getIP().toString().c_str()); + debugger->printf_P(PSTR("GW: %s\n"), getGateway().toString().c_str()); + for(uint8_t i = 0; i < 3; i++) { + IPAddress dns4 = getDns(i); + if(!dns4.isAny()) debugger->printf_P(PSTR("DNS: %s\n"), dns4.toString().c_str()); + } + } + break; + } + case ARDUINO_EVENT_WIFI_STA_GOT_IP6: { + if(debugger->isActive(RemoteDebug::INFO)) { + IPv6Address ipv6 = getIPv6(); + if(ipv6 == IPv6Address()) { + // No IP + } else { + debugger->printf_P(PSTR("IPv6: %s\n"), ipv6.toString().c_str()); + } + + for(uint8_t i = 0; i < 3; i++) { + IPv6Address dns6 = getDNSv6(i); + if(dns6 == IPv6Address()) { + // No IP + } else { + debugger->printf_P(PSTR("DNSv6: %s\n"), dns6.toString().c_str()); + } + } + } + break; + } + case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: { + wifi_err_reason_t reason = (wifi_err_reason_t) info.wifi_sta_disconnected.reason; + const char* descr = WiFi.disconnectReasonName(reason); + switch(reason) { + case WIFI_REASON_ASSOC_LEAVE: + break; + default: + if(strlen(descr) > 0) { + if(debugger->isActive(RemoteDebug::WARNING)) { + debugger->printf_P(PSTR("WiFi disconnected, reason %s\n"), descr); + } + disconnect(RECONNECT_TIMEOUT); + } + } + break; + } + } +} +#endif + +bool WiFiClientConnectionHandler::isConfigChanged() { + return configChanged; +} + +void WiFiClientConnectionHandler::getCurrentConfig(NetworkConfig& networkConfig) { + networkConfig = this->config; +} + +IPAddress WiFiClientConnectionHandler::getIP() { + return WiFi.localIP(); +} + +IPAddress WiFiClientConnectionHandler::getSubnetMask() { + return WiFi.subnetMask(); +} + +IPAddress WiFiClientConnectionHandler::getGateway() { + return WiFi.gatewayIP(); +} + +IPAddress WiFiClientConnectionHandler::getDns(uint8_t idx) { + #if defined(ESP32) + for(uint8_t i = 0; i < 3; i++) { + const ip_addr_t * dns = dns_getserver(i); + if(dns->type == IPADDR_TYPE_V4) { + if(idx-- == 0) return IPAddress(dns->u_addr.ip4.addr); + } + } + #else + return WiFi.dnsIP(idx); + #endif + return IPAddress(); +} + +#if defined(ESP32) +IPv6Address WiFiClientConnectionHandler::getIPv6() { + esp_ip6_addr_t addr; + if(esp_netif_get_ip6_global(get_esp_interface_netif(ESP_IF_WIFI_STA), &addr) == ESP_OK) { + return IPv6Address(addr.addr); + } + return IPv6Address(); +} + +IPv6Address WiFiClientConnectionHandler::getDNSv6(uint8_t idx) { + for(uint8_t i = 0; i < 3; i++) { + const ip_addr_t * dns = dns_getserver(i); + if(dns->type == IPADDR_TYPE_V6) { + if(idx-- == 0) return IPv6Address(dns->u_addr.ip6.addr); + } + } + return IPv6Address(); +} +#endif diff --git a/lib/DomoticzMqttHandler/include/DomoticzMqttHandler.h b/lib/DomoticzMqttHandler/include/DomoticzMqttHandler.h index 05e0fb79..ec3f141d 100644 --- a/lib/DomoticzMqttHandler/include/DomoticzMqttHandler.h +++ b/lib/DomoticzMqttHandler/include/DomoticzMqttHandler.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _DOMOTICZMQTTHANDLER_H #define _DOMOTICZMQTTHANDLER_H @@ -9,10 +15,10 @@ class DomoticzMqttHandler : public AmsMqttHandler { DomoticzMqttHandler(MqttConfig& mqttConfig, RemoteDebug* debugger, char* buf, DomoticzConfig config) : AmsMqttHandler(mqttConfig, debugger, buf) { this->config = config; }; - bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, EntsoeApi* eapi); + bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, PriceService* ps); bool publishTemperatures(AmsConfiguration*, HwTools*); - bool publishPrices(EntsoeApi*); - bool publishSystem(HwTools* hw, EntsoeApi* eapi, EnergyAccounting* ea); + bool publishPrices(PriceService*); + bool publishSystem(HwTools* hw, PriceService* ps, EnergyAccounting* ea); bool publishRaw(String data); void onMessage(String &topic, String &payload); diff --git a/lib/DomoticzMqttHandler/src/DomoticzMqttHandler.cpp b/lib/DomoticzMqttHandler/src/DomoticzMqttHandler.cpp index eb1aaee4..55ec2eb9 100644 --- a/lib/DomoticzMqttHandler/src/DomoticzMqttHandler.cpp +++ b/lib/DomoticzMqttHandler/src/DomoticzMqttHandler.cpp @@ -1,7 +1,13 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "DomoticzMqttHandler.h" #include "json/domoticz_json.h" -bool DomoticzMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, EntsoeApi* eapi) { +bool DomoticzMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, PriceService* ps) { bool ret = false; if (config.elidx > 0) { if(data->getActiveImportCounter() > 1.0) { @@ -67,11 +73,11 @@ bool DomoticzMqttHandler::publishTemperatures(AmsConfiguration* config, HwTools* return false; } -bool DomoticzMqttHandler::publishPrices(EntsoeApi* eapi) { +bool DomoticzMqttHandler::publishPrices(PriceService* ps) { return false; } -bool DomoticzMqttHandler::publishSystem(HwTools* hw, EntsoeApi* eapi, EnergyAccounting* ea) { +bool DomoticzMqttHandler::publishSystem(HwTools* hw, PriceService* ps, EnergyAccounting* ea) { return false; } diff --git a/lib/EnergyAccounting/include/EnergyAccounting.h b/lib/EnergyAccounting/include/EnergyAccounting.h index 10ee6817..bd4d68be 100644 --- a/lib/EnergyAccounting/include/EnergyAccounting.h +++ b/lib/EnergyAccounting/include/EnergyAccounting.h @@ -1,10 +1,16 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _ENERGYACCOUNTING_H #define _ENERGYACCOUNTING_H #include "Arduino.h" #include "AmsData.h" #include "AmsDataStorage.h" -#include "EntsoeApi.h" +#include "PriceService.h" struct EnergyAccountingPeak { uint8_t day; @@ -76,7 +82,7 @@ class EnergyAccounting { public: EnergyAccounting(RemoteDebug*, EnergyAccountingRealtimeData*); void setup(AmsDataStorage *ds, EnergyAccountingConfig *config); - void setEapi(EntsoeApi *eapi); + void setPriceService(PriceService *ps); void setTimezone(Timezone*); EnergyAccountingConfig* getConfig(); bool update(AmsData* amsData); @@ -113,19 +119,18 @@ class EnergyAccounting { EnergyAccountingData getData(); void setData(EnergyAccountingData&); - void setFixedPrice(float price, String currency); - float getPriceForHour(uint8_t h); + void setCurrency(String currency); + float getPriceForHour(uint8_t d, uint8_t h); private: RemoteDebug* debugger = NULL; bool init = false, initPrice = false; AmsDataStorage *ds = NULL; - EntsoeApi *eapi = NULL; + PriceService *ps = NULL; EnergyAccountingConfig *config = NULL; Timezone *tz = NULL; EnergyAccountingData data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; EnergyAccountingRealtimeData* realtimeData = NULL; - float fixedPrice = 0; String currency = ""; void calcDayCost(); diff --git a/lib/EnergyAccounting/src/EnergyAccounting.cpp b/lib/EnergyAccounting/src/EnergyAccounting.cpp index f93e2cdf..e1bec18a 100644 --- a/lib/EnergyAccounting/src/EnergyAccounting.cpp +++ b/lib/EnergyAccounting/src/EnergyAccounting.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "EnergyAccounting.h" #include "LittleFS.h" #include "AmsStorage.h" @@ -28,8 +34,8 @@ void EnergyAccounting::setup(AmsDataStorage *ds, EnergyAccountingConfig *config) this->config = config; } -void EnergyAccounting::setEapi(EntsoeApi *eapi) { - this->eapi = eapi; +void EnergyAccounting::setPriceService(PriceService *ps) { + this->ps = ps; } EnergyAccountingConfig* EnergyAccounting::getConfig() { @@ -49,7 +55,6 @@ bool EnergyAccounting::update(AmsData* amsData) { time_t now = time(nullptr); if(now < FirmwareVersion::BuildEpoch) return false; if(tz == NULL) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(EnergyAccounting) Timezone is missing\n")); return false; } @@ -62,9 +67,7 @@ bool EnergyAccounting::update(AmsData* amsData) { this->realtimeData->lastExportUpdateMillis = 0; this->realtimeData->currentHour = local.Hour; this->realtimeData->currentDay = local.Day; - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EnergyAccounting) Initializing data at %lu\n"), (int32_t) now); if(!load()) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(EnergyAccounting) Unable to load existing data\n")); data = { 6, local.Month, 0, 0, 0, // Cost 0, 0, 0, // Income @@ -75,28 +78,19 @@ bool EnergyAccounting::update(AmsData* amsData) { 0, 0, // Peak 4 0, 0 // Peak 5 }; - } else if(debugger->isActive(RemoteDebug::DEBUG)) { - for(uint8_t i = 0; i < 5; i++) { - debugger->printf_P(PSTR("(EnergyAccounting) Peak hour from day %d: %d\n"), data.peaks[i].day, data.peaks[i].value*10); - } - debugger->printf_P(PSTR("(EnergyAccounting) Loaded cost yesterday: %.2f, this month: %d, last month: %d\n"), data.costYesterday / 100.0, data.costThisMonth / 100.0, data.costLastMonth / 100.0); - debugger->printf_P(PSTR("(EnergyAccounting) Loaded income yesterday: %.2f, this month: %d, last month: %d\n"), data.incomeYesterday / 100.0, data.incomeThisMonth / 100.0, data.incomeLastMonth / 100.0); } init = true; } - float price = getPriceForHour(0); - if(!initPrice && price != ENTSOE_NO_VALUE) { - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EnergyAccounting) Initializing prices at %lu\n"), (int32_t) now); + float price = getPriceForHour(PRICE_DIRECTION_IMPORT, 0); + if(!initPrice && price != PRICE_NO_VALUE) { calcDayCost(); } if(local.Hour != this->realtimeData->currentHour && (amsData->getListType() >= 3 || local.Minute == 1)) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(EnergyAccounting) New local hour %d\n"), local.Hour); - tmElements_t oneHrAgo, oneHrAgoLocal; breakTime(now-3600, oneHrAgo); - uint16_t val = ds->getHourImport(oneHrAgo.Hour) / 10; + uint16_t val = round(ds->getHourImport(oneHrAgo.Hour) / 10.0); breakTime(tz->toLocal(now-3600), oneHrAgoLocal); ret |= updateMax(val, oneHrAgoLocal.Day); @@ -113,7 +107,6 @@ bool EnergyAccounting::update(AmsData* amsData) { uint8_t prevDay = this->realtimeData->currentDay; if(local.Day != this->realtimeData->currentDay) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(EnergyAccounting) New day %d\n"), local.Day); data.costYesterday = this->realtimeData->costDay * 100; data.costThisMonth += this->realtimeData->costDay * 100; this->realtimeData->costDay = 0; @@ -127,7 +120,6 @@ bool EnergyAccounting::update(AmsData* amsData) { } if(local.Month != data.month) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(EnergyAccounting) New month %d\n"), local.Month); data.costLastMonth = data.costThisMonth; data.costThisMonth = 0; data.incomeLastMonth = data.incomeThisMonth; @@ -162,11 +154,9 @@ bool EnergyAccounting::update(AmsData* amsData) { unsigned long ms = amsData->getLastUpdateMillis() - this->realtimeData->lastImportUpdateMillis; float kwhi = (amsData->getActiveImportPower() * (((float) ms) / 3600000.0)) / 1000.0; if(kwhi > 0) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(EnergyAccounting) Adding %.4f kWh import\n"), kwhi); this->realtimeData->use += kwhi; - if(price != ENTSOE_NO_VALUE) { + if(price != PRICE_NO_VALUE) { float cost = price * kwhi; - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(EnergyAccounting) and %.4f %s\n"), cost / 100.0, currency.c_str()); this->realtimeData->costHour += cost; this->realtimeData->costDay += cost; } @@ -178,11 +168,9 @@ bool EnergyAccounting::update(AmsData* amsData) { unsigned long ms = amsData->getLastUpdateMillis() - this->realtimeData->lastExportUpdateMillis; float kwhe = (amsData->getActiveExportPower() * (((float) ms) / 3600000.0)) / 1000.0; if(kwhe > 0) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(EnergyAccounting) Adding %.4f kWh export\n"), kwhe); this->realtimeData->produce += kwhe; - if(price != ENTSOE_NO_VALUE) { + if(price != PRICE_NO_VALUE) { float income = price * kwhe; - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(EnergyAccounting) and %.4f %s\n"), income / 100.0, currency.c_str()); this->realtimeData->incomeHour += income; this->realtimeData->incomeDay += income; } @@ -191,9 +179,7 @@ bool EnergyAccounting::update(AmsData* amsData) { } if(config != NULL) { - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(EnergyAccounting) calculating threshold, currently at %d\n"), this->realtimeData->currentThresholdIdx); while(getMonthMax() > config->thresholds[this->realtimeData->currentThresholdIdx] && this->realtimeData->currentThresholdIdx < 10) this->realtimeData->currentThresholdIdx++; - if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf_P(PSTR("(EnergyAccounting) new threshold %d\n"), this->realtimeData->currentThresholdIdx); } return ret; @@ -205,20 +191,25 @@ void EnergyAccounting::calcDayCost() { if(tz == NULL) return; breakTime(tz->toLocal(now), local); - if(getPriceForHour(0) != ENTSOE_NO_VALUE) { + if(getPriceForHour(PRICE_DIRECTION_IMPORT, 0) != PRICE_NO_VALUE) { if(initPrice) { this->realtimeData->costDay = 0; this->realtimeData->incomeDay = 0; } for(uint8_t i = 0; i < this->realtimeData->currentHour; i++) { - float price = getPriceForHour(i - local.Hour); - if(price == ENTSOE_NO_VALUE) break; breakTime(now - ((local.Hour - i) * 3600), utc); - int16_t wh = ds->getHourImport(utc.Hour); - this->realtimeData->costDay += price * (wh / 1000.0); - wh = ds->getHourExport(utc.Hour); - this->realtimeData->incomeDay += price * (wh / 1000.0); + float priceIn = getPriceForHour(PRICE_DIRECTION_IMPORT, i - local.Hour); + if(priceIn != PRICE_NO_VALUE) { + int16_t wh = ds->getHourImport(utc.Hour); + this->realtimeData->costDay += priceIn * (wh / 1000.0); + } + + float priceOut = getPriceForHour(PRICE_DIRECTION_EXPORT, i - local.Hour); + if(priceOut != PRICE_NO_VALUE) { + int16_t wh = ds->getHourExport(utc.Hour); + this->realtimeData->incomeDay += priceOut * (wh / 1000.0); + } } initPrice = true; } @@ -402,9 +393,6 @@ EnergyAccountingPeak EnergyAccounting::getPeak(uint8_t num) { bool EnergyAccounting::load() { if(!LittleFS.begin()) { - if(debugger->isActive(RemoteDebug::ERROR)) { - debugger->printf_P(PSTR("(EnergyAccounting) Unable to load LittleFS\n")); - } return false; } @@ -414,7 +402,6 @@ bool EnergyAccounting::load() { char buf[file.size()]; file.readBytes(buf, file.size()); - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EnergyAccounting) Data version %d\n"), buf[0]); if(buf[0] == 6) { EnergyAccountingData* data = (EnergyAccountingData*) buf; memcpy(&this->data, data, sizeof(this->data)); @@ -492,14 +479,11 @@ bool EnergyAccounting::load() { } ret = true; } else { - if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("(EnergyAccounting) Unknown version\n")); ret = false; } } file.close(); - } else { - if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("(EnergyAccounting) File not found\n")); } return ret; @@ -507,9 +491,6 @@ bool EnergyAccounting::load() { bool EnergyAccounting::save() { if(!LittleFS.begin()) { - if(debugger->isActive(RemoteDebug::ERROR)) { - debugger->printf_P(PSTR("(EnergyAccounting) Unable to load LittleFS\n")); - } return false; } { @@ -536,7 +517,6 @@ bool EnergyAccounting::updateMax(uint16_t val, uint8_t day) { for(uint8_t i = 0; i < 5; i++) { if(data.peaks[i].day == day || data.peaks[i].day == 0) { if(val > data.peaks[i].value) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(EnergyAccounting) Adding new max %d for day %d which is larger than %d\n"), val*10, day, data.peaks[i].value*10); data.peaks[i].day = day; data.peaks[i].value = val; return true; @@ -555,7 +535,6 @@ bool EnergyAccounting::updateMax(uint16_t val, uint8_t day) { } } if(idx < 5) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(EnergyAccounting) Adding new max %d for day %d\n"), val*10, day); data.peaks[idx].value = val; data.peaks[idx].day = day; return true; @@ -563,13 +542,11 @@ bool EnergyAccounting::updateMax(uint16_t val, uint8_t day) { return false; } -void EnergyAccounting::setFixedPrice(float price, String currency) { - this->fixedPrice = price; +void EnergyAccounting::setCurrency(String currency) { this->currency = currency; } -float EnergyAccounting::getPriceForHour(uint8_t h) { - if(fixedPrice > 0.0) return fixedPrice; - if(eapi == NULL) return ENTSOE_NO_VALUE; - return eapi->getValueForHour(h); +float EnergyAccounting::getPriceForHour(uint8_t d, uint8_t h) { + if(ps == NULL) return PRICE_NO_VALUE; + return ps->getValueForHour(d, h); } \ No newline at end of file diff --git a/lib/EntsoePriceApi/include/EntsoeApi.h b/lib/EntsoePriceApi/include/EntsoeApi.h deleted file mode 100644 index 80a5902c..00000000 --- a/lib/EntsoePriceApi/include/EntsoeApi.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _ENTSOEAPI_H -#define _ENTSOEAPI_H - -#include "TimeLib.h" -#include "Timezone.h" -#include "RemoteDebug.h" -#include "AmsConfiguration.h" -#include "EntsoeA44Parser.h" - -#if defined(ESP8266) - #include -#elif defined(ESP32) // ARDUINO_ARCH_ESP32 - #include -#else - #warning "Unsupported board type" -#endif - -#define SSL_BUF_SIZE 512 - -class EntsoeApi { -public: - EntsoeApi(RemoteDebug*); - void setup(EntsoeConfig&); - bool loop(); - - char* getToken(); - char* getCurrency(); - char* getArea(); - char* getSource(); - float getValueForHour(int8_t); - float getValueForHour(time_t, int8_t); - - int16_t getLastError(); - -private: - RemoteDebug* debugger; - EntsoeConfig* config = NULL; - HTTPClient* http = NULL; - - uint8_t currentDay = 0, currentHour = 0; - uint8_t tomorrowFetchMinute = 15; // How many minutes over 13:00 should it fetch prices - uint8_t nextFetchDelayMinutes = 15; - uint64_t lastTodayFetch = 0; - uint64_t lastTomorrowFetch = 0; - uint64_t lastCurrencyFetch = 0; - PricesContainer* today = NULL; - PricesContainer* tomorrow = NULL; - - Timezone* tz = NULL; - - static const uint16_t BufferSize = 256; - char* buf; - - bool hub = false; - uint8_t* key = NULL; - uint8_t* auth = NULL; - - float currencyMultiplier = 0; - - int16_t lastError = 0; - - PricesContainer* fetchPrices(time_t); - bool retrieve(const char* url, Stream* doc); - float getCurrencyMultiplier(const char* from, const char* to, time_t t); - - void debugPrint(byte *buffer, int start, int length); -}; -#endif diff --git a/lib/FirmwareVersion/include/FirmwareVersion.h b/lib/FirmwareVersion/include/FirmwareVersion.h index 291e2668..d6487f25 100644 --- a/lib/FirmwareVersion/include/FirmwareVersion.h +++ b/lib/FirmwareVersion/include/FirmwareVersion.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _FIRMWARE_VERSION_h #define _FIRMWARE_VERSION_h diff --git a/lib/FirmwareVersion/src/FirmwareVersion.cpp b/lib/FirmwareVersion/src/FirmwareVersion.cpp index b8386871..7155a617 100644 --- a/lib/FirmwareVersion/src/FirmwareVersion.cpp +++ b/lib/FirmwareVersion/src/FirmwareVersion.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "FirmwareVersion.h" #include "generated_version.h" diff --git a/lib/HomeAssistantMqttHandler/include/HomeAssistantMqttHandler.h b/lib/HomeAssistantMqttHandler/include/HomeAssistantMqttHandler.h index 8e48d440..f30c4ca7 100644 --- a/lib/HomeAssistantMqttHandler/include/HomeAssistantMqttHandler.h +++ b/lib/HomeAssistantMqttHandler/include/HomeAssistantMqttHandler.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _HOMEASSISTANTMQTTHANDLER_H #define _HOMEASSISTANTMQTTHANDLER_H @@ -58,11 +64,10 @@ class HomeAssistantMqttHandler : public AmsMqttHandler { } strcpy(this->mqttConfig.subscribeTopic, statusTopic.c_str()); }; - - bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, EntsoeApi* eapi); + bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, PriceService* ps); bool publishTemperatures(AmsConfiguration*, HwTools*); - bool publishPrices(EntsoeApi*); - bool publishSystem(HwTools* hw, EntsoeApi* eapi, EnergyAccounting* ea); + bool publishPrices(PriceService*); + bool publishSystem(HwTools* hw, PriceService* ps, EnergyAccounting* ea); bool publishRaw(String data); void onMessage(String &topic, String &payload); @@ -93,7 +98,7 @@ class HomeAssistantMqttHandler : public AmsMqttHandler { bool publishList3(AmsData* data, EnergyAccounting* ea); bool publishList4(AmsData* data, EnergyAccounting* ea); String getMeterModel(AmsData* data); - bool publishRealtime(AmsData* data, EnergyAccounting* ea, EntsoeApi* eapi); + bool publishRealtime(AmsData* data, EnergyAccounting* ea, PriceService* ps); void publishSensor(const HomeAssistantSensor sensor); void publishList1Sensors(); void publishList1ExportSensors(); @@ -103,10 +108,10 @@ class HomeAssistantMqttHandler : public AmsMqttHandler { void publishList3ExportSensors(); void publishList4Sensors(); void publishList4ExportSensors(); - void publishRealtimeSensors(EnergyAccounting* ea, EntsoeApi* eapi); - void publishRealtimeExportSensors(EnergyAccounting* ea, EntsoeApi* eapi); + void publishRealtimeSensors(EnergyAccounting* ea, PriceService* ps); + void publishRealtimeExportSensors(EnergyAccounting* ea, PriceService* ps); void publishTemperatureSensor(uint8_t index, String id); - void publishPriceSensors(EntsoeApi* eapi); + void publishPriceSensors(PriceService* ps); void publishSystemSensors(); String boardTypeToString(uint8_t b) { @@ -155,6 +160,8 @@ class HomeAssistantMqttHandler : public AmsMqttHandler { return F("ESP32-C3"); case 71: return F("ESP32-C3-DevKitM-1"); + case 80: + return F("ESP32-S3"); } #if defined(ESP8266) return F("ESP8266"); diff --git a/lib/HomeAssistantMqttHandler/include/HomeAssistantStatic.h b/lib/HomeAssistantMqttHandler/include/HomeAssistantStatic.h index be7079e6..2b0566ab 100644 --- a/lib/HomeAssistantMqttHandler/include/HomeAssistantStatic.h +++ b/lib/HomeAssistantMqttHandler/include/HomeAssistantStatic.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _HOMEASSISTANTSTATIC_H #define _HOMEASSISTANTSTATIC_H diff --git a/lib/HomeAssistantMqttHandler/json/ha4.json b/lib/HomeAssistantMqttHandler/json/ha4.json index c6c85791..4504f945 100644 --- a/lib/HomeAssistantMqttHandler/json/ha4.json +++ b/lib/HomeAssistantMqttHandler/json/ha4.json @@ -3,14 +3,14 @@ "id" : "%s", "type" : "%s", "P" : %d, - "P1" : %.2f, - "P2" : %.2f, - "P3" : %.2f, + "P1" : %d, + "P2" : %d, + "P3" : %d, "Q" : %d, "PO" : %d, - "PO1" : %.2f, - "PO2" : %.2f, - "PO3" : %.2f, + "PO1" : %d, + "PO2" : %d, + "PO3" : %d, "QO" : %d, "I1" : %.2f, "I2" : %.2f, diff --git a/lib/HomeAssistantMqttHandler/src/HomeAssistantMqttHandler.cpp b/lib/HomeAssistantMqttHandler/src/HomeAssistantMqttHandler.cpp index e8e9f754..a553bcda 100644 --- a/lib/HomeAssistantMqttHandler/src/HomeAssistantMqttHandler.cpp +++ b/lib/HomeAssistantMqttHandler/src/HomeAssistantMqttHandler.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "HomeAssistantMqttHandler.h" #include "hexutils.h" #include "Uptime.h" @@ -6,8 +12,6 @@ #include "json/ha2_json.h" #include "json/ha3_json.h" #include "json/ha4_json.h" -#include "json/jsonsys_json.h" -#include "json/jsonprices_json.h" #include "json/hadiscover_json.h" #include "json/realtime_json.h" #include "FirmwareVersion.h" @@ -16,7 +20,7 @@ #include #endif -bool HomeAssistantMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, EntsoeApi* eapi) { +bool HomeAssistantMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, PriceService* ps) { if(topic.isEmpty() || !mqtt.connected()) return false; @@ -38,7 +42,7 @@ bool HomeAssistantMqttHandler::publish(AmsData* data, AmsData* previousState, En loop(); if(ea->isInitialized()) { - publishRealtime(data, ea, eapi); + publishRealtime(data, ea, ps); loop(); } return true; @@ -127,9 +131,9 @@ String HomeAssistantMqttHandler::getMeterModel(AmsData* data) { return meterModel; } -bool HomeAssistantMqttHandler::publishRealtime(AmsData* data, EnergyAccounting* ea, EntsoeApi* eapi) { - publishRealtimeSensors(ea, eapi); - if(ea->getProducedThisHour() > 0.0 || ea->getProducedToday() > 0.0 || ea->getProducedThisMonth() > 0.0) publishRealtimeExportSensors(ea, eapi); +bool HomeAssistantMqttHandler::publishRealtime(AmsData* data, EnergyAccounting* ea, PriceService* ps) { + publishRealtimeSensors(ea, ps); + if(ea->getProducedThisHour() > 0.0 || ea->getProducedToday() > 0.0 || ea->getProducedThisMonth() > 0.0) publishRealtimeExportSensors(ea, ps); String peaks = ""; uint8_t peakCount = ea->getConfig()->hours; if(peakCount > 5) peakCount = 5; @@ -187,13 +191,13 @@ bool HomeAssistantMqttHandler::publishTemperatures(AmsConfiguration* config, HwT return ret; } -bool HomeAssistantMqttHandler::publishPrices(EntsoeApi* eapi) { +bool HomeAssistantMqttHandler::publishPrices(PriceService* ps) { if(topic.isEmpty() || !mqtt.connected()) return false; - if(eapi->getValueForHour(0) == ENTSOE_NO_VALUE) + if(ps->getValueForHour(PRICE_DIRECTION_IMPORT, 0) == PRICE_NO_VALUE) return false; - publishPriceSensors(eapi); + publishPriceSensors(ps); time_t now = time(nullptr); @@ -201,12 +205,12 @@ bool HomeAssistantMqttHandler::publishPrices(EntsoeApi* eapi) { int8_t min1hrIdx = -1, min3hrIdx = -1, min6hrIdx = -1; float min = INT16_MAX, max = INT16_MIN; float values[38]; - for(int i = 0;i < 38; i++) values[i] = ENTSOE_NO_VALUE; + for(int i = 0;i < 38; i++) values[i] = PRICE_NO_VALUE; for(uint8_t i = 0; i < 38; i++) { - float val = eapi->getValueForHour(now, i); + float val = ps->getValueForHour(PRICE_DIRECTION_IMPORT, now, i); values[i] = val; - if(val == ENTSOE_NO_VALUE) break; + if(val == PRICE_NO_VALUE) break; if(val < min) min = val; if(val > max) max = val; @@ -221,7 +225,7 @@ bool HomeAssistantMqttHandler::publishPrices(EntsoeApi* eapi) { float val1 = values[i++]; float val2 = values[i++]; float val3 = val; - if(val1 == ENTSOE_NO_VALUE || val2 == ENTSOE_NO_VALUE || val3 == ENTSOE_NO_VALUE) continue; + if(val1 == PRICE_NO_VALUE || val2 == PRICE_NO_VALUE || val3 == PRICE_NO_VALUE) continue; float val3hr = val1+val2+val3; if(min3hrIdx == -1 || min3hr > val3hr) { min3hr = val3hr; @@ -237,7 +241,7 @@ bool HomeAssistantMqttHandler::publishPrices(EntsoeApi* eapi) { float val4 = values[i++]; float val5 = values[i++]; float val6 = val; - if(val1 == ENTSOE_NO_VALUE || val2 == ENTSOE_NO_VALUE || val3 == ENTSOE_NO_VALUE || val4 == ENTSOE_NO_VALUE || val5 == ENTSOE_NO_VALUE || val6 == ENTSOE_NO_VALUE) continue; + if(val1 == PRICE_NO_VALUE || val2 == PRICE_NO_VALUE || val3 == PRICE_NO_VALUE || val4 == PRICE_NO_VALUE || val5 == PRICE_NO_VALUE || val6 == PRICE_NO_VALUE) continue; float val6hr = val1+val2+val3+val4+val5+val6; if(min6hrIdx == -1 || min6hr > val6hr) { min6hr = val6hr; @@ -271,65 +275,37 @@ bool HomeAssistantMqttHandler::publishPrices(EntsoeApi* eapi) { breakTime(ts, tm); sprintf_P(ts6hr, PSTR("%04d-%02d-%02dT%02d:00:00Z"), tm.Year+1970, tm.Month, tm.Day, tm.Hour); } - snprintf_P(json, BufferSize, JSONPRICES_JSON, - WiFi.macAddress().c_str(), - values[0] == ENTSOE_NO_VALUE ? "null" : String(values[0], 4).c_str(), - values[1] == ENTSOE_NO_VALUE ? "null" : String(values[1], 4).c_str(), - values[2] == ENTSOE_NO_VALUE ? "null" : String(values[2], 4).c_str(), - values[3] == ENTSOE_NO_VALUE ? "null" : String(values[3], 4).c_str(), - values[4] == ENTSOE_NO_VALUE ? "null" : String(values[4], 4).c_str(), - values[5] == ENTSOE_NO_VALUE ? "null" : String(values[5], 4).c_str(), - values[6] == ENTSOE_NO_VALUE ? "null" : String(values[6], 4).c_str(), - values[7] == ENTSOE_NO_VALUE ? "null" : String(values[7], 4).c_str(), - values[8] == ENTSOE_NO_VALUE ? "null" : String(values[8], 4).c_str(), - values[9] == ENTSOE_NO_VALUE ? "null" : String(values[9], 4).c_str(), - values[10] == ENTSOE_NO_VALUE ? "null" : String(values[10], 4).c_str(), - values[11] == ENTSOE_NO_VALUE ? "null" : String(values[11], 4).c_str(), - values[12] == ENTSOE_NO_VALUE ? "null" : String(values[12], 4).c_str(), - values[13] == ENTSOE_NO_VALUE ? "null" : String(values[13], 4).c_str(), - values[14] == ENTSOE_NO_VALUE ? "null" : String(values[14], 4).c_str(), - values[15] == ENTSOE_NO_VALUE ? "null" : String(values[15], 4).c_str(), - values[16] == ENTSOE_NO_VALUE ? "null" : String(values[16], 4).c_str(), - values[17] == ENTSOE_NO_VALUE ? "null" : String(values[17], 4).c_str(), - values[18] == ENTSOE_NO_VALUE ? "null" : String(values[18], 4).c_str(), - values[19] == ENTSOE_NO_VALUE ? "null" : String(values[19], 4).c_str(), - values[20] == ENTSOE_NO_VALUE ? "null" : String(values[20], 4).c_str(), - values[21] == ENTSOE_NO_VALUE ? "null" : String(values[21], 4).c_str(), - values[22] == ENTSOE_NO_VALUE ? "null" : String(values[22], 4).c_str(), - values[23] == ENTSOE_NO_VALUE ? "null" : String(values[23], 4).c_str(), - values[24] == ENTSOE_NO_VALUE ? "null" : String(values[24], 4).c_str(), - values[25] == ENTSOE_NO_VALUE ? "null" : String(values[25], 4).c_str(), - values[26] == ENTSOE_NO_VALUE ? "null" : String(values[26], 4).c_str(), - values[27] == ENTSOE_NO_VALUE ? "null" : String(values[27], 4).c_str(), - values[28] == ENTSOE_NO_VALUE ? "null" : String(values[28], 4).c_str(), - values[29] == ENTSOE_NO_VALUE ? "null" : String(values[29], 4).c_str(), - values[30] == ENTSOE_NO_VALUE ? "null" : String(values[30], 4).c_str(), - values[31] == ENTSOE_NO_VALUE ? "null" : String(values[31], 4).c_str(), - values[32] == ENTSOE_NO_VALUE ? "null" : String(values[32], 4).c_str(), - values[33] == ENTSOE_NO_VALUE ? "null" : String(values[33], 4).c_str(), - values[34] == ENTSOE_NO_VALUE ? "null" : String(values[34], 4).c_str(), - values[35] == ENTSOE_NO_VALUE ? "null" : String(values[35], 4).c_str(), - values[36] == ENTSOE_NO_VALUE ? "null" : String(values[36], 4).c_str(), - values[37] == ENTSOE_NO_VALUE ? "null" : String(values[37], 4).c_str(), + + uint16_t pos = snprintf_P(json, BufferSize, PSTR("{\"id\":\"%s\",\"prices\":{"), WiFi.macAddress().c_str()); + for(uint8_t i = 0;i < 38; i++) { + if(values[i] == PRICE_NO_VALUE) { + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"%d\":null,"), i); + } else { + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"%d\":%.4f,"), i, values[i]); + } + } + + snprintf_P(json+pos, BufferSize-pos, PSTR("\"min\":%.4f,\"max\":%.4f,\"cheapest1hr\":\"%s\",\"cheapest3hr\":\"%s\",\"cheapest6hr\":\"%s\"}}"), min == INT16_MAX ? 0.0 : min, max == INT16_MIN ? 0.0 : max, ts1hr, ts3hr, ts6hr ); + bool ret = mqtt.publish(topic + "/prices", json, true, 0); loop(); return ret; } -bool HomeAssistantMqttHandler::publishSystem(HwTools* hw, EntsoeApi* eapi, EnergyAccounting* ea) { +bool HomeAssistantMqttHandler::publishSystem(HwTools* hw, PriceService* ps, EnergyAccounting* ea) { if(topic.isEmpty() || !mqtt.connected()) return false; publishSystemSensors(); if(hw->getTemperature() > -50) publishTemperatureSensor(0, ""); - snprintf_P(json, BufferSize, JSONSYS_JSON, + snprintf_P(json, BufferSize, PSTR("{\"id\":\"%s\",\"name\":\"%s\",\"up\":%d,\"vcc\":%.3f,\"rssi\":%d,\"temp\":%.2f,\"version\":\"%s\"}"), WiFi.macAddress().c_str(), mqttConfig.clientId, (uint32_t) (millis64()/1000), @@ -436,13 +412,13 @@ void HomeAssistantMqttHandler::publishList4ExportSensors() { l4eInit = true; } -void HomeAssistantMqttHandler::publishRealtimeSensors(EnergyAccounting* ea, EntsoeApi* eapi) { +void HomeAssistantMqttHandler::publishRealtimeSensors(EnergyAccounting* ea, PriceService* ps) { if(rtInit) return; for(uint8_t i = 0; i < RealtimeSensorCount; i++) { HomeAssistantSensor sensor = RealtimeSensors[i]; if(strncmp_P(sensor.devcl, PSTR("monetary"), 8) == 0) { - if(eapi == NULL) continue; - sensor.uom = eapi->getCurrency(); + if(ps == NULL) continue; + sensor.uom = ps->getCurrency(); } publishSensor(sensor); } @@ -467,13 +443,13 @@ void HomeAssistantMqttHandler::publishRealtimeSensors(EnergyAccounting* ea, Ents rtInit = true; } -void HomeAssistantMqttHandler::publishRealtimeExportSensors(EnergyAccounting* ea, EntsoeApi* eapi) { +void HomeAssistantMqttHandler::publishRealtimeExportSensors(EnergyAccounting* ea, PriceService* ps) { if(rteInit) return; for(uint8_t i = 0; i < RealtimeExportSensorCount; i++) { HomeAssistantSensor sensor = RealtimeExportSensors[i]; if(strncmp_P(sensor.devcl, PSTR("monetary"), 8) == 0) { - if(eapi == NULL) continue; - sensor.uom = eapi->getCurrency(); + if(ps == NULL) continue; + sensor.uom = ps->getCurrency(); } publishSensor(sensor); } @@ -505,9 +481,9 @@ void HomeAssistantMqttHandler::publishTemperatureSensor(uint8_t index, String id tInit[index] = true; } -void HomeAssistantMqttHandler::publishPriceSensors(EntsoeApi* eapi) { - if(eapi == NULL) return; - String uom = String(eapi->getCurrency()) + "/kWh"; +void HomeAssistantMqttHandler::publishPriceSensors(PriceService* ps) { + if(ps == NULL) return; + String uom = String(ps->getCurrency()) + "/kWh"; if(!pInit) { for(uint8_t i = 0; i < PriceSensorCount; i++) { @@ -521,8 +497,8 @@ void HomeAssistantMqttHandler::publishPriceSensors(EntsoeApi* eapi) { } for(uint8_t i = 0; i < 38; i++) { if(prInit[i]) continue; - float val = eapi->getValueForHour(i); - if(val == ENTSOE_NO_VALUE) continue; + float val = ps->getValueForHour(PRICE_DIRECTION_IMPORT, i); + if(val == PRICE_NO_VALUE) continue; char name[strlen(PriceSensor.name)+2]; snprintf(name, strlen(PriceSensor.name)+2, PriceSensor.name, i, i == 1 ? "hour" : "hours"); diff --git a/lib/HwTools/include/HwTools.h b/lib/HwTools/include/HwTools.h index 29085a02..ab297659 100644 --- a/lib/HwTools/include/HwTools.h +++ b/lib/HwTools/include/HwTools.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _HWTOOLS_H #define _HWTOOLS_H @@ -36,7 +42,8 @@ struct AdcConfig { class HwTools { public: - void setup(GpioConfig*, AmsConfiguration*); + bool applyBoardConfig(uint8_t boardType, GpioConfig& gpioConfig, MeterConfig& meterConfig, uint8_t hanPin); + void setup(GpioConfig*); float getVcc(); uint8_t getTempSensorCount(); TempSensorData* getTempSensorData(uint8_t); @@ -48,6 +55,7 @@ class HwTools { bool ledOn(uint8_t color); bool ledOff(uint8_t color); bool ledBlink(uint8_t color, uint8_t blink); + void setBootSuccessful(bool value); HwTools() {}; private: @@ -57,13 +65,14 @@ class HwTools { esp_adc_cal_characteristics_t* voltAdcChar, tempAdcChar; #endif GpioConfig* config; - AmsConfiguration* amsConf; bool tempSensorInit; OneWire *oneWire = NULL; DallasTemperature *sensorApi = NULL; uint8_t sensorCount = 0; TempSensorData** tempSensors = NULL; + bool bootSuccessful = false; + bool writeLedPin(uint8_t color, uint8_t state); bool isSensorAddressEqual(uint8_t a[8], uint8_t b[8]); void getAdcChannel(uint8_t pin, AdcConfig&); diff --git a/lib/HwTools/src/HwTools.cpp b/lib/HwTools/src/HwTools.cpp index a6ab2ec2..63b3e081 100644 --- a/lib/HwTools/src/HwTools.cpp +++ b/lib/HwTools/src/HwTools.cpp @@ -1,8 +1,151 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "HwTools.h" -void HwTools::setup(GpioConfig* config, AmsConfiguration* amsConf) { +bool HwTools::applyBoardConfig(uint8_t boardType, GpioConfig& gpioConfig, MeterConfig& meterConfig, uint8_t hanPin) { + #if defined(CONFIG_IDF_TARGET_ESP32S2) + switch(boardType) { + case 5: // Pow-K+ + meterConfig.txPin = 9; + case 7: // Pow-U+ + case 6: // Pow-P1 + meterConfig.rxPin = 16; + gpioConfig.apPin = 0; + gpioConfig.ledPinRed = 13; + gpioConfig.ledPinGreen = 14; + gpioConfig.ledRgbInverted = true; + gpioConfig.vccPin = 10; + gpioConfig.vccResistorGnd = 22; + gpioConfig.vccResistorVcc = 33; + gpioConfig.ledDisablePin = 6; + return true; + case 51: // Wemos S2 mini + gpioConfig.ledPin = 15; + gpioConfig.ledInverted = false; + gpioConfig.apPin = 0; + meterConfig.rxPin = hanPin > 0 ? hanPin : 18; + if(meterConfig.rxPin != 18) { + gpioConfig.vccPin = 18; + gpioConfig.vccResistorGnd = 45; + gpioConfig.vccResistorVcc = 10; + } + return true; + case 50: // Generic ESP32-S2 + meterConfig.rxPin = hanPin > 0 ? hanPin : 18; + return true; + } + #elif defined(CONFIG_IDF_TARGET_ESP32C3) + switch(boardType) { + case 8: // dbeinder: HAN mosquito + meterConfig.rxPin = 7; + meterConfig.rxPinPullup = false; + gpioConfig.apPin = 9; + gpioConfig.ledRgbInverted = true; + gpioConfig.ledPinRed = 5; + gpioConfig.ledPinGreen = 6; + gpioConfig.ledPinBlue = 4; + return true; + case 71: // ESP32-C3-DevKitM-1 + gpioConfig.apPin = 9; + case 70: // Generic ESP32-C3 + meterConfig.rxPin = hanPin > 0 ? hanPin : 7; + return true; + } + #elif defined(CONFIG_IDF_TARGET_ESP32S3) + switch(boardType) { + case 80: // Generic ESP32-S3 + meterConfig.rxPin = hanPin > 0 ? hanPin : 18; + return true; + } + #elif defined(ESP32) + switch(boardType) { + case 241: // LilyGO T-ETH-POE + gpioConfig.apPin = 0; + meterConfig.rxPin = hanPin > 0 ? hanPin : 39; + gpioConfig.ledPin = 2; + gpioConfig.ledInverted = true; + return true; + case 242: // M5 PoESP32 + meterConfig.rxPin = hanPin > 0 ? hanPin : 16; + return true; + case 243: // WT32-ETH01 + meterConfig.rxPin = hanPin > 0 ? hanPin : 39; + return true; + case 201: // D32 + meterConfig.rxPin = hanPin > 0 ? hanPin : 16; + gpioConfig.apPin = 4; + gpioConfig.ledPin = 5; + gpioConfig.ledInverted = true; + return true; + case 202: // Feather + case 203: // DevKitC + case 200: // ESP32 + meterConfig.rxPin = hanPin > 0 ? hanPin : 16; + gpioConfig.ledPin = 2; + gpioConfig.ledInverted = false; + return true; + } + #elif defined(ESP8266) + switch(boardType) { + case 2: // spenceme + gpioConfig.vccBootLimit = 32; + meterConfig.rxPin = 3; + gpioConfig.apPin = 0; + gpioConfig.ledPin = 2; + gpioConfig.ledInverted = true; + gpioConfig.tempSensorPin = 5; + return true; + case 0: // roarfred + meterConfig.rxPin = 3; + gpioConfig.apPin = 0; + gpioConfig.ledPin = 2; + gpioConfig.ledInverted = true; + gpioConfig.tempSensorPin = 5; + return true; + case 1: // Arnio Kamstrup + case 3: // Pow-K UART0 + case 4: // Pow-U UART0 + meterConfig.rxPin = 3; + gpioConfig.apPin = 0; + gpioConfig.ledPin = 2; + gpioConfig.ledInverted = true; + gpioConfig.ledPinRed = 13; + gpioConfig.ledPinGreen = 14; + gpioConfig.ledRgbInverted = true; + return true; + case 5: // Pow-K GPIO12 + case 7: // Pow-U GPIO12 + meterConfig.rxPin = 12; + gpioConfig.apPin = 0; + gpioConfig.ledPin = 2; + gpioConfig.ledInverted = true; + gpioConfig.ledPinRed = 13; + gpioConfig.ledPinGreen = 14; + gpioConfig.ledRgbInverted = true; + return true; + case 101: // D1 + meterConfig.rxPin = hanPin > 0 ? hanPin : 5; + gpioConfig.apPin = 4; + gpioConfig.ledPin = 2; + gpioConfig.ledInverted = true; + gpioConfig.vccMultiplier = 1100; + return true; + case 100: // ESP8266 + meterConfig.rxPin = hanPin > 0 ? hanPin : 3; + gpioConfig.ledPin = 2; + gpioConfig.ledInverted = true; + return true; + } + #endif + return false; +} + +void HwTools::setup(GpioConfig* config) { this->config = config; - this->amsConf = amsConf; this->tempSensorInit = false; if(sensorApi != NULL) delete sensorApi; @@ -92,6 +235,10 @@ void HwTools::setup(GpioConfig* config, AmsConfiguration* amsConf) { } else { config->ledPinBlue = 0xFF; } + if(config->ledDisablePin > 0 && config->ledDisablePin < 40) { + pinMode(config->ledDisablePin, OUTPUT_OPEN_DRAIN); + setBootSuccessful(false); + } } void HwTools::getAdcChannel(uint8_t pin, AdcConfig& config) { @@ -358,8 +505,7 @@ float HwTools::getTemperature() { } for(int x = 0; x < sensorCount; x++) { TempSensorData data = *tempSensors[x]; - TempSensorConfig* conf = amsConf->getTempSensorConfig(data.address); - if((conf == NULL || conf->common) && data.lastValidRead > -85) { + if(data.lastValidRead > -85) { ret += data.lastValidRead; c++; } @@ -380,7 +526,33 @@ int HwTools::getWifiRssi() { return isnan(rssi) ? -100.0 : rssi; } +void HwTools::setBootSuccessful(bool value) { + if(bootSuccessful && value) return; + bootSuccessful = value; + if(config->ledDisablePin > 0 && config->ledDisablePin < 40) { + switch(config->ledBehaviour) { + case LED_BEHAVIOUR_ERROR_ONLY: + case LED_BEHAVIOUR_OFF: + digitalWrite(config->ledDisablePin, LOW); + break; + case LED_BEHAVIOUR_BOOT: + if(bootSuccessful) { + digitalWrite(config->ledDisablePin, LOW); + } else { + digitalWrite(config->ledDisablePin, HIGH); + } + break; + default: + digitalWrite(config->ledDisablePin, HIGH); + } + } +} + bool HwTools::ledOn(uint8_t color) { + if(config->ledBehaviour == LED_BEHAVIOUR_OFF) return false; + if(config->ledBehaviour == LED_BEHAVIOUR_ERROR_ONLY && color != LED_RED) return false; + if(config->ledBehaviour == LED_BEHAVIOUR_BOOT && color != LED_RED && bootSuccessful) return false; + if(color == LED_INTERNAL) { return writeLedPin(color, config->ledInverted ? LOW : HIGH); } else { diff --git a/lib/JsonMqttHandler/include/.gitignore b/lib/JsonMqttHandler/include/.gitignore deleted file mode 100644 index 1907c991..00000000 --- a/lib/JsonMqttHandler/include/.gitignore +++ /dev/null @@ -1 +0,0 @@ -json/*.h diff --git a/lib/JsonMqttHandler/include/JsonMqttHandler.h b/lib/JsonMqttHandler/include/JsonMqttHandler.h index 4b475e71..3e9d73bb 100644 --- a/lib/JsonMqttHandler/include/JsonMqttHandler.h +++ b/lib/JsonMqttHandler/include/JsonMqttHandler.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _JSONMQTTHANDLER_H #define _JSONMQTTHANDLER_H @@ -8,10 +14,10 @@ class JsonMqttHandler : public AmsMqttHandler { JsonMqttHandler(MqttConfig& mqttConfig, RemoteDebug* debugger, char* buf, HwTools* hw) : AmsMqttHandler(mqttConfig, debugger, buf) { this->hw = hw; }; - bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, EntsoeApi* eapi); + bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, PriceService* ps); bool publishTemperatures(AmsConfiguration*, HwTools*); - bool publishPrices(EntsoeApi*); - bool publishSystem(HwTools* hw, EntsoeApi* eapi, EnergyAccounting* ea); + bool publishPrices(PriceService*); + bool publishSystem(HwTools* hw, PriceService* ps, EnergyAccounting* ea); bool publishRaw(String data); void onMessage(String &topic, String &payload); @@ -20,7 +26,8 @@ class JsonMqttHandler : public AmsMqttHandler { private: HwTools* hw; - + uint16_t appendJsonHeader(AmsData* data); + uint16_t appendJsonFooter(EnergyAccounting* ea, uint16_t pos); bool publishList1(AmsData* data, EnergyAccounting* ea); bool publishList2(AmsData* data, EnergyAccounting* ea); bool publishList3(AmsData* data, EnergyAccounting* ea); diff --git a/lib/JsonMqttHandler/json/json1.json b/lib/JsonMqttHandler/json/json1.json deleted file mode 100644 index 9885be7f..00000000 --- a/lib/JsonMqttHandler/json/json1.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "id" : "%s", - "name" : "%s", - "up" : %u, - "t" : %lu, - "vcc" : %.3f, - "rssi": %d, - "temp": %.2f, - "data" : { - "P" : %d - }, - "realtime" : { - "h" : %.2f, - "d" : %.1f, - "t" : %d, - "x" : %.2f, - "he" : %.2f, - "de" : %.1f - } -} diff --git a/lib/JsonMqttHandler/json/json2.json b/lib/JsonMqttHandler/json/json2.json deleted file mode 100644 index 05e3c483..00000000 --- a/lib/JsonMqttHandler/json/json2.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "id" : "%s", - "name" : "%s", - "up" : %u, - "t" : %lu, - "vcc" : %.3f, - "rssi": %d, - "temp": %.2f, - "data" : { - "lv" : "%s", - "id" : "%s", - "type" : "%s", - "P" : %d, - "Q" : %d, - "PO" : %d, - "QO" : %d, - "I1" : %.2f, - "I2" : %.2f, - "I3" : %.2f, - "U1" : %.2f, - "U2" : %.2f, - "U3" : %.2f - }, - "realtime" : { - "h" : %.2f, - "d" : %.1f, - "t" : %d, - "x" : %.2f, - "he" : %.2f, - "de" : %.1f - } -} diff --git a/lib/JsonMqttHandler/json/json3.json b/lib/JsonMqttHandler/json/json3.json deleted file mode 100644 index c1409594..00000000 --- a/lib/JsonMqttHandler/json/json3.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id" : "%s", - "name" : "%s", - "up" : %u, - "t" : %lu, - "vcc" : %.3f, - "rssi": %d, - "temp": %.2f, - "data" : { - "lv" : "%s", - "id" : "%s", - "type" : "%s", - "P" : %d, - "Q" : %d, - "PO" : %d, - "QO" : %d, - "I1" : %.2f, - "I2" : %.2f, - "I3" : %.2f, - "U1" : %.2f, - "U2" : %.2f, - "U3" : %.2f, - "tPI" : %.3f, - "tPO" : %.3f, - "tQI" : %.3f, - "tQO" : %.3f, - "rtc" : %lu - }, - "realtime" : { - "h" : %.2f, - "d" : %.1f, - "t" : %d, - "x" : %.2f, - "he" : %.2f, - "de" : %.1f - } -} diff --git a/lib/JsonMqttHandler/json/json4.json b/lib/JsonMqttHandler/json/json4.json deleted file mode 100644 index 5c50f7de..00000000 --- a/lib/JsonMqttHandler/json/json4.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "id" : "%s", - "name" : "%s", - "up" : %u, - "t" : %lu, - "vcc" : %.3f, - "rssi": %d, - "temp": %.2f, - "data" : { - "lv" : "%s", - "id" : "%s", - "type" : "%s", - "P" : %d, - "P1" : %.2f, - "P2" : %.2f, - "P3" : %.2f, - "Q" : %d, - "PO" : %d, - "PO1" : %.2f, - "PO2" : %.2f, - "PO3" : %.2f, - "QO" : %d, - "I1" : %.2f, - "I2" : %.2f, - "I3" : %.2f, - "U1" : %.2f, - "U2" : %.2f, - "U3" : %.2f, - "PF" : %.2f, - "PF1" : %.2f, - "PF2" : %.2f, - "PF3" : %.2f, - "tPI" : %.3f, - "tPO" : %.3f, - "tQI" : %.3f, - "tQO" : %.3f, - "tPI1" : %.3f, - "tPI2" : %.3f, - "tPI3" : %.3f, - "tPO1" : %.3f, - "tPO2" : %.3f, - "tPO3" : %.3f, - "rtc" : %lu - }, - "realtime" : { - "h" : %.2f, - "d" : %.1f, - "t" : %d, - "x" : %.2f, - "he" : %.2f, - "de" : %.1f - } -} diff --git a/lib/JsonMqttHandler/json/jsonprices.json b/lib/JsonMqttHandler/json/jsonprices.json deleted file mode 100644 index 988d734a..00000000 --- a/lib/JsonMqttHandler/json/jsonprices.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "id" : "%s", - "prices" : { - "0" : %s, - "1" : %s, - "2" : %s, - "3" : %s, - "4" : %s, - "5" : %s, - "6" : %s, - "7" : %s, - "8" : %s, - "9" : %s, - "10" : %s, - "11" : %s, - "12" : %s, - "13" : %s, - "14" : %s, - "15" : %s, - "16" : %s, - "17" : %s, - "18" : %s, - "19" : %s, - "20" : %s, - "21" : %s, - "22" : %s, - "23" : %s, - "24" : %s, - "25" : %s, - "26" : %s, - "27" : %s, - "28" : %s, - "29" : %s, - "30" : %s, - "31" : %s, - "32" : %s, - "33" : %s, - "34" : %s, - "35" : %s, - "36" : %s, - "37" : %s, - "min" : %.4f, - "max" : %.4f, - "cheapest1hr" : "%s", - "cheapest3hr" : "%s", - "cheapest6hr" : "%s" - } -} diff --git a/lib/JsonMqttHandler/json/jsonsys.json b/lib/JsonMqttHandler/json/jsonsys.json deleted file mode 100644 index da4d5987..00000000 --- a/lib/JsonMqttHandler/json/jsonsys.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "id" : "%s", - "name" : "%s", - "up" : %d, - "vcc" : %.3f, - "rssi" : %d, - "temp" : %.2f, - "version" : "%s" -} diff --git a/lib/JsonMqttHandler/scripts/generate_includes.py b/lib/JsonMqttHandler/scripts/generate_includes.py deleted file mode 100644 index 285e8fb7..00000000 --- a/lib/JsonMqttHandler/scripts/generate_includes.py +++ /dev/null @@ -1,76 +0,0 @@ -import os -import re -import shutil -import subprocess - -try: - from css_html_js_minify import js_minify -except: - from SCons.Script import ( - ARGUMENTS, - COMMAND_LINE_TARGETS, - DefaultEnvironment, - ) - env = DefaultEnvironment() - - env.Execute( - env.VerboseAction( - '$PYTHONEXE -m pip install "css_html_js_minify" ', - "Installing Python dependencies", - ) - ) - try: - from css_html_js_minify import js_minify - except: - print("WARN: Unable to load minifier") - - -webroot = "lib/JsonMqttHandler/json" -srcroot = "lib/JsonMqttHandler/include/json" - -version = os.environ.get('GITHUB_TAG') -if version == None: - try: - result = subprocess.run(['git','rev-parse','--short','HEAD'], capture_output=True, check=False) - if result.returncode == 0: - version = result.stdout.decode('utf-8').strip() - else: - version = "SNAPSHOT" - except: - version = "SNAPSHOT" - -if os.path.exists(srcroot): - shutil.rmtree(srcroot) - os.mkdir(srcroot) -else: - os.mkdir(srcroot) - -for filename in os.listdir(webroot): - basename = re.sub("[^0-9a-zA-Z]+", "_", filename) - - srcfile = webroot + "/" + filename - dstfile = srcroot + "/" + basename + ".h" - - varname = basename.upper() - - with open(srcfile, encoding="utf-8") as f: - content = f.read().replace("${version}", version) - - try: - if (filename.endswith(".js") and filename != 'gaugemeter.js') or filename.endswith(".json"): - content = js_minify(content) - except: - print("WARN: Unable to minify") - - with open(dstfile, "w") as dst: - dst.write("static const char ") - dst.write(varname) - dst.write("[] PROGMEM = R\"==\"==(") - dst.write(content) - dst.write(")==\"==\";\n") - dst.write("const int "); - dst.write(varname) - dst.write("_LEN PROGMEM = "); - dst.write(str(len(content))) - dst.write(";"); - \ No newline at end of file diff --git a/lib/JsonMqttHandler/src/JsonMqttHandler.cpp b/lib/JsonMqttHandler/src/JsonMqttHandler.cpp index d3c8eacc..3bc33090 100644 --- a/lib/JsonMqttHandler/src/JsonMqttHandler.cpp +++ b/lib/JsonMqttHandler/src/JsonMqttHandler.cpp @@ -1,15 +1,15 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "JsonMqttHandler.h" #include "FirmwareVersion.h" #include "hexutils.h" #include "Uptime.h" -#include "json/json1_json.h" -#include "json/json2_json.h" -#include "json/json3_json.h" -#include "json/json4_json.h" -#include "json/jsonsys_json.h" -#include "json/jsonprices_json.h" -bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, EntsoeApi* eapi) { +bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, PriceService* ps) { if(strlen(mqttConfig.publishTopic) == 0) { if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Unable to publish data, no publish topic\n")); return false; @@ -20,6 +20,7 @@ bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccou } bool ret = false; + memset(json, 0, BufferSize); if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Publishing list ID %d!\n"), data->getListType()); if(data->getListType() == 1) { @@ -35,35 +36,67 @@ bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccou return ret; } -bool JsonMqttHandler::publishList1(AmsData* data, EnergyAccounting* ea) { - snprintf_P(json, BufferSize, JSON1_JSON, +uint16_t JsonMqttHandler::appendJsonHeader(AmsData* data) { + return snprintf_P(json, BufferSize, PSTR("{\"id\":\"%s\",\"name\":\"%s\",\"up\":%u,\"t\":%lu,\"vcc\":%.3f,\"rssi\":%d,\"temp\":%.2f,"), WiFi.macAddress().c_str(), mqttConfig.clientId, (uint32_t) (millis64()/1000), data->getPackageTimestamp(), hw->getVcc(), hw->getWifiRssi(), - hw->getTemperature(), - data->getActiveImportPower(), + hw->getTemperature() + ); +} + +uint16_t JsonMqttHandler::appendJsonFooter(EnergyAccounting* ea, uint16_t pos) { + char pf[4]; + if(mqttConfig.payloadFormat == 6) { + strcpy_P(pf, PSTR("rt_")); + } else { + memset(pf, 0, 4); + } + + return snprintf_P(json+pos, BufferSize-pos, PSTR("%s\"%sh\":%.2f,\"%sd\":%.1f,\"%st\":%d,\"%sx\":%.2f,\"%she\":%.2f,\"%sde\":%.1f%s"), + strlen(pf) == 0 ? "},\"realtime\":{" : ",", + pf, ea->getUseThisHour(), + pf, ea->getUseToday(), + pf, ea->getCurrentThreshold(), + pf, ea->getMonthMax(), + pf, ea->getProducedThisHour(), - ea->getProducedToday() + pf, + ea->getProducedToday(), + strlen(pf) == 0 ? "}" : "" ); - return mqtt.publish(mqttConfig.publishTopic, json); +} + +bool JsonMqttHandler::publishList1(AmsData* data, EnergyAccounting* ea) { + uint16_t pos = appendJsonHeader(data); + if(mqttConfig.payloadFormat != 6) { + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"data\":{")); + } + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"P\":%d"), data->getActiveImportPower()); + pos += appendJsonFooter(ea, pos); + json[pos] = '}'; + if(mqttConfig.payloadFormat == 5) { + char topic[192]; + snprintf_P(topic, 192, PSTR("%s/list1"), mqttConfig.publishTopic); + return mqtt.publish(topic, json); + } else { + return mqtt.publish(mqttConfig.publishTopic, json); + } } bool JsonMqttHandler::publishList2(AmsData* data, EnergyAccounting* ea) { - snprintf_P(json, BufferSize, JSON2_JSON, - WiFi.macAddress().c_str(), - mqttConfig.clientId, - (uint32_t) (millis64()/1000), - data->getPackageTimestamp(), - hw->getVcc(), - hw->getWifiRssi(), - hw->getTemperature(), + uint16_t pos = appendJsonHeader(data); + if(mqttConfig.payloadFormat != 6) { + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"data\":{")); + } + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"lv\":\"%s\",\"meterId\":\"%s\",\"type\":\"%s\",\"P\":%d,\"Q\":%d,\"PO\":%d,\"QO\":%d,\"I1\":%.2f,\"I2\":%.2f,\"I3\":%.2f,\"U1\":%.2f,\"U2\":%.2f,\"U3\":%.2f"), data->getListId().c_str(), data->getMeterId().c_str(), getMeterModel(data).c_str(), @@ -76,26 +109,25 @@ bool JsonMqttHandler::publishList2(AmsData* data, EnergyAccounting* ea) { data->getL3Current(), data->getL1Voltage(), data->getL2Voltage(), - data->getL3Voltage(), - ea->getUseThisHour(), - ea->getUseToday(), - ea->getCurrentThreshold(), - ea->getMonthMax(), - ea->getProducedThisHour(), - ea->getProducedToday() + data->getL3Voltage() ); - return mqtt.publish(mqttConfig.publishTopic, json); + pos += appendJsonFooter(ea, pos); + json[pos] = '}'; + if(mqttConfig.payloadFormat == 5) { + char topic[192]; + snprintf_P(topic, 192, PSTR("%s/list2"), mqttConfig.publishTopic); + return mqtt.publish(topic, json); + } else { + return mqtt.publish(mqttConfig.publishTopic, json); + } } bool JsonMqttHandler::publishList3(AmsData* data, EnergyAccounting* ea) { - snprintf_P(json, BufferSize, JSON3_JSON, - WiFi.macAddress().c_str(), - mqttConfig.clientId, - (uint32_t) (millis64()/1000), - data->getPackageTimestamp(), - hw->getVcc(), - hw->getWifiRssi(), - hw->getTemperature(), + uint16_t pos = appendJsonHeader(data); + if(mqttConfig.payloadFormat != 6) { + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"data\":{")); + } + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"lv\":\"%s\",\"meterId\":\"%s\",\"type\":\"%s\",\"P\":%d,\"Q\":%d,\"PO\":%d,\"QO\":%d,\"I1\":%.2f,\"I2\":%.2f,\"I3\":%.2f,\"U1\":%.2f,\"U2\":%.2f,\"U3\":%.2f,\"tPI\":%.3f,\"tPO\":%.3f,\"tQI\":%.3f,\"tQO\":%.3f,\"rtc\":%lu"), data->getListId().c_str(), data->getMeterId().c_str(), getMeterModel(data).c_str(), @@ -113,26 +145,25 @@ bool JsonMqttHandler::publishList3(AmsData* data, EnergyAccounting* ea) { data->getActiveExportCounter(), data->getReactiveImportCounter(), data->getReactiveExportCounter(), - data->getMeterTimestamp(), - ea->getUseThisHour(), - ea->getUseToday(), - ea->getCurrentThreshold(), - ea->getMonthMax(), - ea->getProducedThisHour(), - ea->getProducedToday() + data->getMeterTimestamp() ); - return mqtt.publish(mqttConfig.publishTopic, json); + pos += appendJsonFooter(ea, pos); + json[pos] = '}'; + if(mqttConfig.payloadFormat == 5) { + char topic[192]; + snprintf_P(topic, 192, PSTR("%s/list3"), mqttConfig.publishTopic); + return mqtt.publish(topic, json); + } else { + return mqtt.publish(mqttConfig.publishTopic, json); + } } bool JsonMqttHandler::publishList4(AmsData* data, EnergyAccounting* ea) { - snprintf_P(json, BufferSize, JSON4_JSON, - WiFi.macAddress().c_str(), - mqttConfig.clientId, - (uint32_t) (millis64()/1000), - data->getPackageTimestamp(), - hw->getVcc(), - hw->getWifiRssi(), - hw->getTemperature(), + uint16_t pos = appendJsonHeader(data); + if(mqttConfig.payloadFormat != 6) { + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"data\":{")); + } + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"lv\":\"%s\",\"meterId\":\"%s\",\"type\":\"%s\",\"P\":%d,\"P1\":%d,\"P2\":%d,\"P3\":%d,\"Q\":%d,\"PO\":%d,\"PO1\":%d,\"PO2\":%d,\"PO3\":%d,\"QO\":%d,\"I1\":%.2f,\"I2\":%.2f,\"I3\":%.2f,\"U1\":%.2f,\"U2\":%.2f,\"U3\":%.2f,\"PF\":%.2f,\"PF1\":%.2f,\"PF2\":%.2f,\"PF3\":%.2f,\"tPI\":%.3f,\"tPO\":%.3f,\"tQI\":%.3f,\"tQO\":%.3f,\"tPI1\":%.3f,\"tPI2\":%.3f,\"tPI3\":%.3f,\"tPO1\":%.3f,\"tPO2\":%.3f,\"tPO3\":%.3f,\"rtc\":%lu"), data->getListId().c_str(), data->getMeterId().c_str(), getMeterModel(data).c_str(), @@ -166,15 +197,17 @@ bool JsonMqttHandler::publishList4(AmsData* data, EnergyAccounting* ea) { data->getL1ActiveExportCounter(), data->getL2ActiveExportCounter(), data->getL3ActiveExportCounter(), - data->getMeterTimestamp(), - ea->getUseThisHour(), - ea->getUseToday(), - ea->getCurrentThreshold(), - ea->getMonthMax(), - ea->getProducedThisHour(), - ea->getProducedToday() + data->getMeterTimestamp() ); - return mqtt.publish(mqttConfig.publishTopic, json); + pos += appendJsonFooter(ea, pos); + json[pos] = '}'; + if(mqttConfig.payloadFormat == 5) { + char topic[192]; + snprintf_P(topic, 192, PSTR("%s/list4"), mqttConfig.publishTopic); + return mqtt.publish(topic, json); + } else { + return mqtt.publish(mqttConfig.publishTopic, json); + } } String JsonMqttHandler::getMeterModel(AmsData* data) { @@ -189,30 +222,42 @@ bool JsonMqttHandler::publishTemperatures(AmsConfiguration* config, HwTools* hw) return false; } - snprintf_P(json, 24, PSTR("{\"temperatures\":{")); - + uint16_t pos = 0; + if(mqttConfig.payloadFormat == 6) { + json[pos++] = '{'; + } else { + pos = snprintf_P(json, 24, PSTR("{\"temperatures\":{")); + } for(int i = 0; i < count; i++) { TempSensorData* data = hw->getTempSensorData(i); if(data != NULL) { - char* pos = json+strlen(json); - snprintf_P(pos, 26, PSTR("\"%s\":%.2f,"), + pos += snprintf_P(json+pos, 26, PSTR("\"%s\":%.2f,"), toHex(data->address, 8).c_str(), data->lastRead ); data->changed = false; } } - char* pos = json+strlen(json); - snprintf_P(count == 0 ? pos : pos-1, 8, PSTR("}}")); - bool ret = mqtt.publish(mqttConfig.publishTopic, json); + bool ret = false; + json[pos-1] = '}'; + if(mqttConfig.payloadFormat != 6) { + json[pos] = '}'; + } + if(mqttConfig.payloadFormat == 5) { + char topic[192]; + snprintf_P(topic, 192, PSTR("%s/temperatures"), mqttConfig.publishTopic); + ret = mqtt.publish(topic, json); + } else { + ret = mqtt.publish(mqttConfig.publishTopic, json); + } loop(); return ret; } -bool JsonMqttHandler::publishPrices(EntsoeApi* eapi) { +bool JsonMqttHandler::publishPrices(PriceService* ps) { if(strlen(mqttConfig.publishTopic) == 0 || !mqtt.connected()) return false; - if(eapi->getValueForHour(0) == ENTSOE_NO_VALUE) + if(ps->getValueForHour(PRICE_DIRECTION_IMPORT, 0) == PRICE_NO_VALUE) return false; time_t now = time(nullptr); @@ -221,12 +266,12 @@ bool JsonMqttHandler::publishPrices(EntsoeApi* eapi) { int8_t min1hrIdx = -1, min3hrIdx = -1, min6hrIdx = -1; float min = INT16_MAX, max = INT16_MIN; float values[38]; - for(int i = 0;i < 38; i++) values[i] = ENTSOE_NO_VALUE; + for(int i = 0;i < 38; i++) values[i] = PRICE_NO_VALUE; for(uint8_t i = 0; i < 38; i++) { - float val = eapi->getValueForHour(now, i); + float val = ps->getValueForHour(PRICE_DIRECTION_IMPORT, now, i); values[i] = val; - if(val == ENTSOE_NO_VALUE) break; + if(val == PRICE_NO_VALUE) break; if(val < min) min = val; if(val > max) max = val; @@ -241,7 +286,7 @@ bool JsonMqttHandler::publishPrices(EntsoeApi* eapi) { float val1 = values[i++]; float val2 = values[i++]; float val3 = val; - if(val1 == ENTSOE_NO_VALUE || val2 == ENTSOE_NO_VALUE || val3 == ENTSOE_NO_VALUE) continue; + if(val1 == PRICE_NO_VALUE || val2 == PRICE_NO_VALUE || val3 == PRICE_NO_VALUE) continue; float val3hr = val1+val2+val3; if(min3hrIdx == -1 || min3hr > val3hr) { min3hr = val3hr; @@ -257,7 +302,7 @@ bool JsonMqttHandler::publishPrices(EntsoeApi* eapi) { float val4 = values[i++]; float val5 = values[i++]; float val6 = val; - if(val1 == ENTSOE_NO_VALUE || val2 == ENTSOE_NO_VALUE || val3 == ENTSOE_NO_VALUE || val4 == ENTSOE_NO_VALUE || val5 == ENTSOE_NO_VALUE || val6 == ENTSOE_NO_VALUE) continue; + if(val1 == PRICE_NO_VALUE || val2 == PRICE_NO_VALUE || val3 == PRICE_NO_VALUE || val4 == PRICE_NO_VALUE || val5 == PRICE_NO_VALUE || val6 == PRICE_NO_VALUE) continue; float val6hr = val1+val2+val3+val4+val5+val6; if(min6hrIdx == -1 || min6hr > val6hr) { min6hr = val6hr; @@ -292,62 +337,55 @@ bool JsonMqttHandler::publishPrices(EntsoeApi* eapi) { sprintf_P(ts6hr, PSTR("%04d-%02d-%02dT%02d:00:00Z"), tm.Year+1970, tm.Month, tm.Day, tm.Hour); } - snprintf_P(json, BufferSize, JSONPRICES_JSON, - WiFi.macAddress().c_str(), - values[0] == ENTSOE_NO_VALUE ? "null" : String(values[0], 4).c_str(), - values[1] == ENTSOE_NO_VALUE ? "null" : String(values[1], 4).c_str(), - values[2] == ENTSOE_NO_VALUE ? "null" : String(values[2], 4).c_str(), - values[3] == ENTSOE_NO_VALUE ? "null" : String(values[3], 4).c_str(), - values[4] == ENTSOE_NO_VALUE ? "null" : String(values[4], 4).c_str(), - values[5] == ENTSOE_NO_VALUE ? "null" : String(values[5], 4).c_str(), - values[6] == ENTSOE_NO_VALUE ? "null" : String(values[6], 4).c_str(), - values[7] == ENTSOE_NO_VALUE ? "null" : String(values[7], 4).c_str(), - values[8] == ENTSOE_NO_VALUE ? "null" : String(values[8], 4).c_str(), - values[9] == ENTSOE_NO_VALUE ? "null" : String(values[9], 4).c_str(), - values[10] == ENTSOE_NO_VALUE ? "null" : String(values[10], 4).c_str(), - values[11] == ENTSOE_NO_VALUE ? "null" : String(values[11], 4).c_str(), - values[12] == ENTSOE_NO_VALUE ? "null" : String(values[12], 4).c_str(), - values[13] == ENTSOE_NO_VALUE ? "null" : String(values[13], 4).c_str(), - values[14] == ENTSOE_NO_VALUE ? "null" : String(values[14], 4).c_str(), - values[15] == ENTSOE_NO_VALUE ? "null" : String(values[15], 4).c_str(), - values[16] == ENTSOE_NO_VALUE ? "null" : String(values[16], 4).c_str(), - values[17] == ENTSOE_NO_VALUE ? "null" : String(values[17], 4).c_str(), - values[18] == ENTSOE_NO_VALUE ? "null" : String(values[18], 4).c_str(), - values[19] == ENTSOE_NO_VALUE ? "null" : String(values[19], 4).c_str(), - values[20] == ENTSOE_NO_VALUE ? "null" : String(values[20], 4).c_str(), - values[21] == ENTSOE_NO_VALUE ? "null" : String(values[21], 4).c_str(), - values[22] == ENTSOE_NO_VALUE ? "null" : String(values[22], 4).c_str(), - values[23] == ENTSOE_NO_VALUE ? "null" : String(values[23], 4).c_str(), - values[24] == ENTSOE_NO_VALUE ? "null" : String(values[24], 4).c_str(), - values[25] == ENTSOE_NO_VALUE ? "null" : String(values[25], 4).c_str(), - values[26] == ENTSOE_NO_VALUE ? "null" : String(values[26], 4).c_str(), - values[27] == ENTSOE_NO_VALUE ? "null" : String(values[27], 4).c_str(), - values[28] == ENTSOE_NO_VALUE ? "null" : String(values[28], 4).c_str(), - values[29] == ENTSOE_NO_VALUE ? "null" : String(values[29], 4).c_str(), - values[30] == ENTSOE_NO_VALUE ? "null" : String(values[30], 4).c_str(), - values[31] == ENTSOE_NO_VALUE ? "null" : String(values[31], 4).c_str(), - values[32] == ENTSOE_NO_VALUE ? "null" : String(values[32], 4).c_str(), - values[33] == ENTSOE_NO_VALUE ? "null" : String(values[33], 4).c_str(), - values[34] == ENTSOE_NO_VALUE ? "null" : String(values[34], 4).c_str(), - values[35] == ENTSOE_NO_VALUE ? "null" : String(values[35], 4).c_str(), - values[36] == ENTSOE_NO_VALUE ? "null" : String(values[36], 4).c_str(), - values[37] == ENTSOE_NO_VALUE ? "null" : String(values[37], 4).c_str(), + char pf[4]; + uint16_t pos = snprintf_P(json, BufferSize, PSTR("{\"id\":\"%s\","), WiFi.macAddress().c_str()); + if(mqttConfig.payloadFormat != 6) { + memset(pf, 0, 4); + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"prices\":{")); + } else { + strcpy_P(pf, PSTR("pr_")); + } + + for(uint8_t i = 0;i < 38; i++) { + if(values[i] == PRICE_NO_VALUE) { + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"%s%d\":null,"), pf, i); + } else { + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"%s%d\":%.4f,"), pf, i, values[i]); + } + } + + pos += snprintf_P(json+pos, BufferSize-pos, PSTR("\"%smin\":%.4f,\"%smax\":%.4f,\"%scheapest1hr\":\"%s\",\"%scheapest3hr\":\"%s\",\"%scheapest6hr\":\"%s\"}"), + pf, min == INT16_MAX ? 0.0 : min, + pf, max == INT16_MIN ? 0.0 : max, + pf, ts1hr, + pf, ts3hr, + pf, ts6hr ); - bool ret = mqtt.publish(mqttConfig.publishTopic, json); + if(mqttConfig.payloadFormat != 6) { + json[pos] = '}'; + } + bool ret = false; + if(mqttConfig.payloadFormat == 5) { + char topic[192]; + snprintf_P(topic, 192, PSTR("%s/prices"), mqttConfig.publishTopic); + ret = mqtt.publish(topic, json); + } else { + ret = mqtt.publish(mqttConfig.publishTopic, json); + } loop(); return ret; } -bool JsonMqttHandler::publishSystem(HwTools* hw, EntsoeApi* eapi, EnergyAccounting* ea) { +bool JsonMqttHandler::publishSystem(HwTools* hw, PriceService* ps, EnergyAccounting* ea) { if(strlen(mqttConfig.publishTopic) == 0 || !mqtt.connected()) return false; - snprintf_P(json, BufferSize, JSONSYS_JSON, + snprintf_P(json, BufferSize, PSTR("{\"id\":\"%s\",\"name\":\"%s\",\"up\":%d,\"vcc\":%.3f,\"rssi\":%d,\"temp\":%.2f,\"version\":\"%s\"}"), WiFi.macAddress().c_str(), mqttConfig.clientId, (uint32_t) (millis64()/1000), @@ -356,7 +394,14 @@ bool JsonMqttHandler::publishSystem(HwTools* hw, EntsoeApi* eapi, EnergyAccounti hw->getTemperature(), FirmwareVersion::VersionString ); - bool ret = mqtt.publish(mqttConfig.publishTopic, json); + bool ret = false; + if(mqttConfig.payloadFormat == 5) { + char topic[192]; + snprintf_P(topic, 192, PSTR("%s/system"), mqttConfig.publishTopic); + ret = mqtt.publish(topic, json); + } else { + ret = mqtt.publish(mqttConfig.publishTopic, json); + } loop(); return ret; } diff --git a/lib/EntsoePriceApi/include/DnbCurrParser.h b/lib/PriceService/include/DnbCurrParser.h similarity index 86% rename from lib/EntsoePriceApi/include/DnbCurrParser.h rename to lib/PriceService/include/DnbCurrParser.h index c8be5fbb..184ac8d5 100644 --- a/lib/EntsoePriceApi/include/DnbCurrParser.h +++ b/lib/PriceService/include/DnbCurrParser.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _DNBCURRPARSER_H #define _DNBCURRPARSER_H diff --git a/lib/EntsoePriceApi/include/EntsoeA44Parser.h b/lib/PriceService/include/EntsoeA44Parser.h similarity index 92% rename from lib/EntsoePriceApi/include/EntsoeA44Parser.h rename to lib/PriceService/include/EntsoeA44Parser.h index bc144a59..30bf0da6 100644 --- a/lib/EntsoePriceApi/include/EntsoeA44Parser.h +++ b/lib/PriceService/include/EntsoeA44Parser.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _ENTSOEA44PARSER_H #define _ENTSOEA44PARSER_H @@ -10,8 +16,6 @@ #define DOCPOS_POSITION 3 #define DOCPOS_AMOUNT 4 -#define ENTSOE_NO_VALUE -127 - class EntsoeA44Parser: public Stream { public: EntsoeA44Parser(); diff --git a/lib/PriceService/include/PriceService.h b/lib/PriceService/include/PriceService.h new file mode 100644 index 00000000..043a6e3c --- /dev/null +++ b/lib/PriceService/include/PriceService.h @@ -0,0 +1,125 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#ifndef _PRICESERVICE_H +#define _PRICESERVICE_H + +#include + +#include "TimeLib.h" +#include "Timezone.h" +#include "RemoteDebug.h" +#include "AmsConfiguration.h" +#include "EntsoeA44Parser.h" + +#if defined(ESP8266) + #include +#elif defined(ESP32) // ARDUINO_ARCH_ESP32 + #include +#else + #warning "Unsupported board type" +#endif + +#define SSL_BUF_SIZE 512 + +#define PRICE_DIRECTION_IMPORT 0x01 +#define PRICE_DIRECTION_EXPORT 0x02 +#define PRICE_DIRECTION_BOTH 0x03 + +#define PRICE_DAY_MO 0x01 +#define PRICE_DAY_TU 0x02 +#define PRICE_DAY_WE 0x04 +#define PRICE_DAY_TH 0x08 +#define PRICE_DAY_FR 0x10 +#define PRICE_DAY_SA 0x12 +#define PRICE_DAY_SU 0x14 + +#define PRICE_TYPE_FIXED 0x00 +#define PRICE_TYPE_ADD 0x01 +#define PRICE_TYPE_PCT 0x02 +#define PRICE_TYPE_SUBTRACT 0x03 + +struct PriceConfig { + char name[32]; + uint8_t direction; + uint8_t days; + uint32_t hours; + uint8_t type; + uint32_t value; + uint8_t start_month; + uint8_t start_dayofmonth; + uint8_t end_month; + uint8_t end_dayofmonth; +}; + +struct PricePart { + char name[32]; + char description[32]; + uint32_t value; +}; + +class PriceService { +public: + PriceService(RemoteDebug*); + void setup(PriceServiceConfig&); + bool loop(); + + char* getToken(); + char* getCurrency(); + char* getArea(); + char* getSource(); + float getValueForHour(uint8_t direction, int8_t hour); + float getValueForHour(uint8_t direction, time_t ts, int8_t hour); + + float getEnergyPriceForHour(uint8_t direction, time_t ts, int8_t hour); + + std::vector& getPriceConfig(); + void setPriceConfig(uint8_t index, PriceConfig &priceConfig); + void cropPriceConfig(uint8_t size); + + PricePart getPricePart(uint8_t index); + + int16_t getLastError(); + + bool load(); + bool save(); + +private: + RemoteDebug* debugger; + PriceServiceConfig* config = NULL; + HTTPClient* http = NULL; + + uint8_t currentDay = 0, currentHour = 0; + uint8_t tomorrowFetchMinute = 15; // How many minutes over 13:00 should it fetch prices + uint8_t nextFetchDelayMinutes = 15; + uint64_t lastTodayFetch = 0; + uint64_t lastTomorrowFetch = 0; + uint64_t lastCurrencyFetch = 0; + PricesContainer* today = NULL; + PricesContainer* tomorrow = NULL; + + std::vector priceConfig; + + Timezone* tz = NULL; + + static const uint16_t BufferSize = 256; + char* buf; + + bool hub = false; + uint8_t* key = NULL; + uint8_t* auth = NULL; + + float currencyMultiplier = 0; + + int16_t lastError = 0; + + PricesContainer* fetchPrices(time_t); + bool retrieve(const char* url, Stream* doc); + float getCurrencyMultiplier(const char* from, const char* to, time_t t); + + void debugPrint(byte *buffer, int start, int length); +}; +#endif diff --git a/lib/EntsoePriceApi/include/PricesContainer.h b/lib/PriceService/include/PricesContainer.h similarity index 65% rename from lib/EntsoePriceApi/include/PricesContainer.h rename to lib/PriceService/include/PricesContainer.h index dea3050f..0bd35bde 100644 --- a/lib/EntsoePriceApi/include/PricesContainer.h +++ b/lib/PriceService/include/PricesContainer.h @@ -1,5 +1,14 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _PRICESCONTAINER_H #define _PRICESCONTAINER_H + +#define PRICE_NO_VALUE -127 + struct PricesContainer { char currency[4]; char measurementUnit[4]; diff --git a/lib/EntsoePriceApi/src/DnbCurrParser.cpp b/lib/PriceService/src/DnbCurrParser.cpp similarity index 96% rename from lib/EntsoePriceApi/src/DnbCurrParser.cpp rename to lib/PriceService/src/DnbCurrParser.cpp index 4c576ef1..3233e7a9 100644 --- a/lib/EntsoePriceApi/src/DnbCurrParser.cpp +++ b/lib/PriceService/src/DnbCurrParser.cpp @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "DnbCurrParser.h" #include "Arduino.h" diff --git a/lib/EntsoePriceApi/src/EntsoeA44Parser.cpp b/lib/PriceService/src/EntsoeA44Parser.cpp similarity index 91% rename from lib/EntsoePriceApi/src/EntsoeA44Parser.cpp rename to lib/PriceService/src/EntsoeA44Parser.cpp index 51bda13e..ec326d36 100644 --- a/lib/EntsoePriceApi/src/EntsoeA44Parser.cpp +++ b/lib/PriceService/src/EntsoeA44Parser.cpp @@ -1,8 +1,14 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "EntsoeA44Parser.h" #include "HardwareSerial.h" EntsoeA44Parser::EntsoeA44Parser() { - for(int i = 0; i < 25; i++) points[i] = ENTSOE_NO_VALUE; + for(int i = 0; i < 25; i++) points[i] = PRICE_NO_VALUE; } EntsoeA44Parser::~EntsoeA44Parser() { @@ -18,7 +24,7 @@ char* EntsoeA44Parser::getMeasurementUnit() { } float EntsoeA44Parser::getPoint(uint8_t position) { - if(position >= 25) return ENTSOE_NO_VALUE; + if(position >= 25) return PRICE_NO_VALUE; return points[position]; } @@ -115,6 +121,6 @@ void EntsoeA44Parser::get(PricesContainer* container) { strcpy(container->source, "EOE"); for(uint8_t i = 0; i < 25; i++) { - container->points[i] = points[i] == ENTSOE_NO_VALUE ? ENTSOE_NO_VALUE : points[i] * 10000; + container->points[i] = points[i] == PRICE_NO_VALUE ? PRICE_NO_VALUE : points[i] * 10000; } } \ No newline at end of file diff --git a/lib/EntsoePriceApi/src/EntsoeApi.cpp b/lib/PriceService/src/PriceService.cpp similarity index 63% rename from lib/EntsoePriceApi/src/EntsoeApi.cpp rename to lib/PriceService/src/PriceService.cpp index 5039364e..2fc6e32d 100644 --- a/lib/EntsoePriceApi/src/EntsoeApi.cpp +++ b/lib/PriceService/src/PriceService.cpp @@ -1,9 +1,18 @@ -#include "EntsoeApi.h" +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#include "PriceService.h" #include #include "Uptime.h" #include "TimeLib.h" #include "DnbCurrParser.h" #include "FirmwareVersion.h" +#include +#include "AmsStorage.h" +#include "hexutils.h" #include "GcmParser.h" @@ -11,7 +20,7 @@ #include #endif -EntsoeApi::EntsoeApi(RemoteDebug* Debug) { +PriceService::PriceService(RemoteDebug* Debug) : priceConfig(std::vector()) { this->buf = (char*) malloc(BufferSize); debugger = Debug; @@ -24,9 +33,9 @@ EntsoeApi::EntsoeApi(RemoteDebug* Debug) { tomorrowFetchMinute = 15 + random(45); // Random between 13:15 and 14:00 } -void EntsoeApi::setup(EntsoeConfig& config) { +void PriceService::setup(PriceServiceConfig& config) { if(this->config == NULL) { - this->config = new EntsoeConfig(); + this->config = new PriceServiceConfig(); } memcpy(this->config, &config, sizeof(config)); lastTodayFetch = lastTomorrowFetch = lastCurrencyFetch = 0; @@ -56,21 +65,22 @@ void EntsoeApi::setup(EntsoeConfig& config) { hub = false; #endif + load(); } -char* EntsoeApi::getToken() { - return this->config->token; +char* PriceService::getToken() { + return this->config->entsoeToken; } -char* EntsoeApi::getCurrency() { +char* PriceService::getCurrency() { return this->config->currency; } -char* EntsoeApi::getArea() { +char* PriceService::getArea() { return this->config->area; } -char* EntsoeApi::getSource() { +char* PriceService::getSource() { if(this->today != NULL && this->tomorrow != NULL) { if(strcmp(this->today->source, this->tomorrow->source) == 0) { return this->today->source; @@ -85,13 +95,71 @@ char* EntsoeApi::getSource() { return ""; } -float EntsoeApi::getValueForHour(int8_t hour) { +float PriceService::getValueForHour(uint8_t direction, int8_t hour) { time_t cur = time(nullptr); - return getValueForHour(cur, hour); + return getValueForHour(direction, cur, hour); } -float EntsoeApi::getValueForHour(time_t ts, int8_t hour) { +float PriceService::getValueForHour(uint8_t direction, time_t ts, int8_t hour) { + float ret = getEnergyPriceForHour(direction, ts, hour); + if(ret == PRICE_NO_VALUE) + return ret; + tmElements_t tm; + breakTime(tz->toLocal(ts + (hour) * SECS_PER_HOUR), tm); + uint8_t day = 0x01 << (tm.Wday - 2); + uint32_t hrs = 0x01 << tm.Hour; + + for (uint8_t i = 0; i < priceConfig.size(); i++) { + PriceConfig pc = priceConfig.at(i); + if(pc.type == PRICE_TYPE_FIXED) continue; + uint8_t start_month = pc.start_month == 0 || pc.start_month > 12 ? 1 : pc.start_month; + uint8_t start_dayofmonth = pc.start_dayofmonth == 0 || pc.start_dayofmonth > 31 ? 1 : pc.start_dayofmonth; + uint8_t end_month = pc.end_month == 0 || pc.end_month > 12 ? 12 : pc.end_month; + uint8_t end_dayofmonth = pc.end_dayofmonth == 0 || pc.end_dayofmonth > 31 ? 31 : pc.end_dayofmonth; + + if((pc.direction & direction) == direction && (pc.days & day) == day && (pc.hours & hrs) == hrs && tm.Month >= start_month && tm.Day >= start_dayofmonth && tm.Month <= end_month && tm.Day <= end_dayofmonth) { + switch(pc.type) { + case PRICE_TYPE_ADD: + ret += pc.value / 10000.0; + break; + case PRICE_TYPE_SUBTRACT: + ret -= pc.value / 10000.0; + break; + case PRICE_TYPE_PCT: + ret += ((pc.value / 10000.0) * ret) / 100.0; + break; + } + } + } + return ret; +} + +float PriceService::getEnergyPriceForHour(uint8_t direction, time_t ts, int8_t hour) { + tmElements_t tm; + breakTime(tz->toLocal(ts + (hour) * SECS_PER_HOUR), tm); + uint8_t day = 0x01 << (tm.Wday - 2); + uint32_t hrs = 0x01 << tm.Hour; + + float value = PRICE_NO_VALUE; + for (uint8_t i = 0; i < priceConfig.size(); i++) { + PriceConfig pc = priceConfig.at(i); + if(pc.type != PRICE_TYPE_FIXED) continue; + uint8_t start_month = pc.start_month == 0 || pc.start_month > 12 ? 1 : pc.start_month; + uint8_t start_dayofmonth = pc.start_dayofmonth == 0 || pc.start_dayofmonth > 31 ? 1 : pc.start_dayofmonth; + uint8_t end_month = pc.end_month == 0 || pc.end_month > 12 ? 12 : pc.end_month; + uint8_t end_dayofmonth = pc.end_dayofmonth == 0 || pc.end_dayofmonth > 31 ? 31 : pc.end_dayofmonth; + + if((pc.direction & direction) == direction && (pc.days & day) == day && (pc.hours & hrs) == hrs && tm.Month >= start_month && tm.Day >= start_dayofmonth && tm.Month <= end_month && tm.Day <= end_dayofmonth) { + if(value == PRICE_NO_VALUE) { + value = pc.value / 10000.0; + } else { + value += pc.value / 10000.0; + } + } + } + if(value != PRICE_NO_VALUE) return value; + int8_t pos = hour; breakTime(tz->toLocal(ts), tm); @@ -108,47 +176,46 @@ float EntsoeApi::getValueForHour(time_t ts, int8_t hour) { hoursToday++; } if(pos > 49) - return ENTSOE_NO_VALUE; + return PRICE_NO_VALUE; - float value = ENTSOE_NO_VALUE; - float multiplier = config->multiplier / 1000.0; + float multiplier = 1.0; if(pos >= hoursToday) { if(tomorrow == NULL) - return ENTSOE_NO_VALUE; - if(tomorrow->points[pos-hoursToday] == ENTSOE_NO_VALUE) - return ENTSOE_NO_VALUE; + return PRICE_NO_VALUE; + if(tomorrow->points[pos-hoursToday] == PRICE_NO_VALUE) + return PRICE_NO_VALUE; value = tomorrow->points[pos-hoursToday] / 10000.0; if(strcmp(tomorrow->measurementUnit, "KWH") == 0) { // Multiplier is 1 } else if(strcmp(tomorrow->measurementUnit, "MWH") == 0) { multiplier *= 0.001; } else { - return ENTSOE_NO_VALUE; + return PRICE_NO_VALUE; } float mult = getCurrencyMultiplier(tomorrow->currency, config->currency, time(nullptr)); - if(mult == 0) return ENTSOE_NO_VALUE; + if(mult == 0) return PRICE_NO_VALUE; multiplier *= mult; } else if(pos >= 0) { if(today == NULL) - return ENTSOE_NO_VALUE; - if(today->points[pos] == ENTSOE_NO_VALUE) - return ENTSOE_NO_VALUE; + return PRICE_NO_VALUE; + if(today->points[pos] == PRICE_NO_VALUE) + return PRICE_NO_VALUE; value = today->points[pos] / 10000.0; if(strcmp(today->measurementUnit, "KWH") == 0) { // Multiplier is 1 } else if(strcmp(today->measurementUnit, "MWH") == 0) { multiplier *= 0.001; } else { - return ENTSOE_NO_VALUE; + return PRICE_NO_VALUE; } float mult = getCurrencyMultiplier(today->currency, config->currency, time(nullptr)); - if(mult == 0) return ENTSOE_NO_VALUE; + if(mult == 0) return PRICE_NO_VALUE; multiplier *= mult; } return value * multiplier; } -bool EntsoeApi::loop() { +bool PriceService::loop() { uint64_t now = millis64(); if(now < 10000) return false; // Grace period @@ -176,7 +243,6 @@ bool EntsoeApi::loop() { } if(currentDay != tm.Day) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(EntsoeApi) Rotating price objects at %lu\n"), t); if(today != NULL) delete today; if(tomorrow != NULL) { today = tomorrow; @@ -225,11 +291,9 @@ bool EntsoeApi::loop() { return false; } -bool EntsoeApi::retrieve(const char* url, Stream* doc) { +bool PriceService::retrieve(const char* url, Stream* doc) { #if defined(ESP32) if(http->begin(url)) { - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Connection established\n")); - #if defined(ESP32) esp_task_wdt_reset(); #elif defined(ESP8266) @@ -245,7 +309,6 @@ bool EntsoeApi::retrieve(const char* url, Stream* doc) { #endif if(status == HTTP_CODE_OK) { - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Receiving data\n")); http->writeToStream(doc); http->end(); lastError = 0; @@ -260,7 +323,7 @@ bool EntsoeApi::retrieve(const char* url, Stream* doc) { } else { nextFetchDelayMinutes = 2; } - if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("(EntsoeApi) Communication error, returned status: %d\n"), status); + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("(PriceService) Communication error, returned status: %d\n"), status); if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf(http->errorToString(status).c_str()); if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf(http->getString().c_str()); @@ -274,7 +337,7 @@ bool EntsoeApi::retrieve(const char* url, Stream* doc) { return false; } -float EntsoeApi::getCurrencyMultiplier(const char* from, const char* to, time_t t) { +float PriceService::getCurrencyMultiplier(const char* from, const char* to, time_t t) { if(strcmp(from, to) == 0) return 1.00; @@ -292,17 +355,13 @@ float EntsoeApi::getCurrencyMultiplier(const char* from, const char* to, time_t float currencyMultiplier = 0; snprintf_P(buf, BufferSize, PSTR("https://data.norges-bank.no/api/data/EXR/B.%s.NOK.SP?lastNObservations=1"), from); - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(EntsoeApi) Retrieving %s to NOK conversion\n"), from); - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EntsoeApi) url: %s\n"), buf); if(retrieve(buf, &p)) { - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EntsoeApi) got exchange rate %.4f\n"), p.getValue()); + if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(PriceService) got exchange rate %.4f\n"), p.getValue()); currencyMultiplier = p.getValue(); if(strncmp(to, "NOK", 3) != 0) { snprintf_P(buf, BufferSize, PSTR("https://data.norges-bank.no/api/data/EXR/B.%s.NOK.SP?lastNObservations=1"), to); - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(EntsoeApi) Retrieving %s to NOK conversion\n"), to); - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EntsoeApi) url: %s\n"), buf); if(retrieve(buf, &p)) { - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EntsoeApi) got exchange rate %.4f\n"), p.getValue()); + if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(PriceService) got exchange rate %.4f\n"), p.getValue()); if(p.getValue() > 0.0) { currencyMultiplier /= p.getValue(); } else { @@ -314,13 +373,13 @@ float EntsoeApi::getCurrencyMultiplier(const char* from, const char* to, time_t } } if(currencyMultiplier != 0) { - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EntsoeApi) Resulting currency multiplier: %.4f\n"), currencyMultiplier); + if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(PriceService) Resulting currency multiplier: %.4f\n"), currencyMultiplier); tmElements_t tm; breakTime(t, tm); lastCurrencyFetch = now + (SECS_PER_DAY * 1000) - (((((tm.Hour * 60) + tm.Minute) * 60) + tm.Second) * 1000) + (3600000 * 6) + (tomorrowFetchMinute * 60); this->currencyMultiplier = currencyMultiplier; } else { - if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("(EntsoeApi) Multiplier ended in success, but without value\n")); + if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("(PriceService) Multiplier ended in success, but without value\n")); lastCurrencyFetch = now + (SECS_PER_HOUR * 1000); if(this->currencyMultiplier == 1) return 0; } @@ -328,7 +387,7 @@ float EntsoeApi::getCurrencyMultiplier(const char* from, const char* to, time_t return currencyMultiplier; } -PricesContainer* EntsoeApi::fetchPrices(time_t t) { +PricesContainer* PriceService::fetchPrices(time_t t) { if(strlen(getToken()) > 0) { tmElements_t tm; breakTime(tz->toLocal(t), tm); @@ -350,10 +409,10 @@ PricesContainer* EntsoeApi::fetchPrices(time_t t) { ESP.wdtFeed(); #endif - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(EntsoeApi) Fetching prices for %d.%d.%d\n"), tm.Day, tm.Month, tm.Year+1970); - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EntsoeApi) url: %s\n"), buf); + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(PriceService) Fetching prices for %02d.%02d.%04d\n"), tm.Day, tm.Month, tm.Year+1970); + if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(PriceService) url: %s\n"), buf); EntsoeA44Parser a44; - if(retrieve(buf, &a44) && a44.getPoint(0) != ENTSOE_NO_VALUE) { + if(retrieve(buf, &a44) && a44.getPoint(0) != PRICE_NO_VALUE) { PricesContainer* ret = new PricesContainer(); a44.get(ret); return ret; @@ -372,6 +431,8 @@ PricesContainer* EntsoeApi::fetchPrices(time_t t) { tm.Day, config->currency ); + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(PriceService) Fetching prices for %02d.%02d.%04d\n"), tm.Day, tm.Month, tm.Year+1970); + if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(PriceService) url: %s\n"), buf); #if defined(ESP8266) WiFiClient client; client.setTimeout(5000); @@ -388,29 +449,19 @@ PricesContainer* EntsoeApi::fetchPrices(time_t t) { #endif if(status == HTTP_CODE_OK) { - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Receiving data\n")); data = http->getString(); http->end(); uint8_t* content = (uint8_t*) (data.c_str()); - if(debugger->isActive(RemoteDebug::DEBUG)) { - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Received content for prices:\n")); - debugPrint(content, 0, data.length()); - } DataParserContext ctx = {0,0,0,0}; ctx.length = data.length(); GCMParser gcm(key, auth); int8_t gcmRet = gcm.parse(content, ctx); - if(debugger->isActive(RemoteDebug::DEBUG)) { - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Decrypted content for prices:\n")); - debugPrint(content, 0, data.length()); - } if(gcmRet > 0) { - if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EntsoeApi) Price data starting at: %d\n"), gcmRet); PricesContainer* ret = new PricesContainer(); for(uint8_t i = 0; i < 25; i++) { - ret->points[i] = ENTSOE_NO_VALUE; + ret->points[i] = PRICE_NO_VALUE; } memcpy(ret, content+gcmRet, sizeof(*ret)); for(uint8_t i = 0; i < 25; i++) { @@ -422,7 +473,7 @@ PricesContainer* EntsoeApi::fetchPrices(time_t t) { } else { lastError = gcmRet; nextFetchDelayMinutes = 60; - if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("(EntsoeApi) Error code while decrypting prices: %d\n"), gcmRet); + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("(PriceService) Error code while decrypting prices: %d\n"), gcmRet); } } else { lastError = status; @@ -433,7 +484,7 @@ PricesContainer* EntsoeApi::fetchPrices(time_t t) { } else { nextFetchDelayMinutes = 5; } - if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("(EntsoeApi) Communication error, returned status: %d\n"), status); + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("(PriceService) Communication error, returned status: %d\n"), status); if(debugger->isActive(RemoteDebug::ERROR)) { debugger->printf(http->errorToString(status).c_str()); debugger->println(); @@ -447,7 +498,7 @@ PricesContainer* EntsoeApi::fetchPrices(time_t t) { return NULL; } -void EntsoeApi::debugPrint(byte *buffer, int start, int length) { +void PriceService::debugPrint(byte *buffer, int start, int length) { for (int i = start; i < start + length; i++) { if (buffer[i] < 0x10) debugger->print(F("0")); @@ -463,6 +514,78 @@ void EntsoeApi::debugPrint(byte *buffer, int start, int length) { debugger->println(F("")); } -int16_t EntsoeApi::getLastError() { +int16_t PriceService::getLastError() { return lastError; +} + +std::vector& PriceService::getPriceConfig() { + return this->priceConfig; +} + +void PriceService::setPriceConfig(uint8_t index, PriceConfig &priceConfig) { + stripNonAscii((uint8_t*) priceConfig.name, 32); + + if(this->priceConfig.capacity() != index+1) + this->priceConfig.resize(index+1); + if(this->priceConfig.size() > index) + this->priceConfig[index] = priceConfig; + else + this->priceConfig.push_back(priceConfig); +} + +void PriceService::cropPriceConfig(uint8_t size) { + this->priceConfig.resize(size); + this->priceConfig.shrink_to_fit(); + +} + +bool PriceService::save() { + if(!LittleFS.begin()) { + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("(PriceService) Unable to load LittleFS\n")); + return false; + } + + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(PriceService) Saving price config\n")); + + PriceConfig pc; + File file = LittleFS.open(FILE_PRICE_CONF, "w"); + uint8_t count = priceConfig.size(); + uint16_t bytes = 1 + (count * sizeof(pc)); + char buf[bytes]; + buf[0] = count; + for(uint8_t i = 0; i < count; i++) { + pc = priceConfig.at(i); + memcpy(buf + 1 + (i * sizeof(pc)), &pc, sizeof(pc)); + } + for(unsigned long i = 0; i < bytes; i++) { + file.write(buf[i]); + } + file.close(); + + return true; +} + +bool PriceService::load() { + if(!LittleFS.begin()) { + if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("(PriceService) Unable to load LittleFS\n")); + return false; + } + if(!LittleFS.exists(FILE_PRICE_CONF)) { + if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(PriceService) No price config file\n")); + return false; + } + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(PriceService) Loading price config\n")); + + this->priceConfig.clear(); + + PriceConfig pc; + File file = LittleFS.open(FILE_PRICE_CONF, "r"); + uint8_t count = file.read(); + for(uint8_t i = 0; i < count; i++) { + file.readBytes((char*) &pc, sizeof(pc)); + this->priceConfig.push_back(pc); + } + file.close(); + + return true; } \ No newline at end of file diff --git a/lib/RawMqttHandler/include/RawMqttHandler.h b/lib/RawMqttHandler/include/RawMqttHandler.h index 2f2bffe9..8833ce12 100644 --- a/lib/RawMqttHandler/include/RawMqttHandler.h +++ b/lib/RawMqttHandler/include/RawMqttHandler.h @@ -1,3 +1,9 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #ifndef _RAWMQTTHANDLER_H #define _RAWMQTTHANDLER_H @@ -9,10 +15,10 @@ class RawMqttHandler : public AmsMqttHandler { full = mqttConfig.payloadFormat == 2; topic = String(mqttConfig.publishTopic); }; - bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, EntsoeApi* eapi); + bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, PriceService* ps); bool publishTemperatures(AmsConfiguration*, HwTools*); - bool publishPrices(EntsoeApi*); - bool publishSystem(HwTools* hw, EntsoeApi* eapi, EnergyAccounting* ea); + bool publishPrices(PriceService*); + bool publishSystem(HwTools* hw, PriceService* ps, EnergyAccounting* ea); bool publishRaw(String data); void onMessage(String &topic, String &payload); diff --git a/lib/RawMqttHandler/src/RawMqttHandler.cpp b/lib/RawMqttHandler/src/RawMqttHandler.cpp index 6e3d362a..82d78109 100644 --- a/lib/RawMqttHandler/src/RawMqttHandler.cpp +++ b/lib/RawMqttHandler/src/RawMqttHandler.cpp @@ -1,8 +1,14 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + #include "RawMqttHandler.h" #include "hexutils.h" #include "Uptime.h" -bool RawMqttHandler::publish(AmsData* data, AmsData* meterState, EnergyAccounting* ea, EntsoeApi* eapi) { +bool RawMqttHandler::publish(AmsData* data, AmsData* meterState, EnergyAccounting* ea, PriceService* ps) { if(topic.isEmpty() || !mqtt.connected()) return false; @@ -89,22 +95,22 @@ bool RawMqttHandler::publishList3(AmsData* data, AmsData* meterState) { bool RawMqttHandler::publishList4(AmsData* data, AmsData* meterState) { if(full || meterState->getL1ActiveImportPower() != data->getL1ActiveImportPower()) { - mqtt.publish(topic + "/meter/import/l1", String(data->getL1ActiveImportPower(), 2)); + mqtt.publish(topic + "/meter/import/l1", String(data->getL1ActiveImportPower())); } if(full || meterState->getL2ActiveImportPower() != data->getL2ActiveImportPower()) { - mqtt.publish(topic + "/meter/import/l2", String(data->getL2ActiveImportPower(), 2)); + mqtt.publish(topic + "/meter/import/l2", String(data->getL2ActiveImportPower())); } if(full || meterState->getL3ActiveImportPower() != data->getL3ActiveImportPower()) { - mqtt.publish(topic + "/meter/import/l3", String(data->getL3ActiveImportPower(), 2)); + mqtt.publish(topic + "/meter/import/l3", String(data->getL3ActiveImportPower())); } if(full || meterState->getL1ActiveExportPower() != data->getL1ActiveExportPower()) { - mqtt.publish(topic + "/meter/export/l1", String(data->getL1ActiveExportPower(), 2)); + mqtt.publish(topic + "/meter/export/l1", String(data->getL1ActiveExportPower())); } if(full || meterState->getL2ActiveExportPower() != data->getL2ActiveExportPower()) { - mqtt.publish(topic + "/meter/export/l2", String(data->getL2ActiveExportPower(), 2)); + mqtt.publish(topic + "/meter/export/l2", String(data->getL2ActiveExportPower())); } if(full || meterState->getL3ActiveExportPower() != data->getL3ActiveExportPower()) { - mqtt.publish(topic + "/meter/export/l3", String(data->getL3ActiveExportPower(), 2)); + mqtt.publish(topic + "/meter/export/l3", String(data->getL3ActiveExportPower())); } if(full || meterState->getL1ActiveImportCounter() != data->getL1ActiveImportCounter()) { mqtt.publish(topic + "/meter/import/l1/accumulated", String(data->getL1ActiveImportCounter(), 2)); @@ -170,10 +176,10 @@ bool RawMqttHandler::publishTemperatures(AmsConfiguration* config, HwTools* hw) return c > 0; } -bool RawMqttHandler::publishPrices(EntsoeApi* eapi) { +bool RawMqttHandler::publishPrices(PriceService* ps) { if(topic.isEmpty() || !mqtt.connected()) return false; - if(eapi->getValueForHour(0) == ENTSOE_NO_VALUE) + if(ps->getValueForHour(PRICE_DIRECTION_IMPORT, 0) == PRICE_NO_VALUE) return false; time_t now = time(nullptr); @@ -182,13 +188,13 @@ bool RawMqttHandler::publishPrices(EntsoeApi* eapi) { int8_t min1hrIdx = -1, min3hrIdx = -1, min6hrIdx = -1; float min = INT16_MAX, max = INT16_MIN; float values[34]; - for(int i = 0;i < 34; i++) values[i] = ENTSOE_NO_VALUE; + for(int i = 0;i < 34; i++) values[i] = PRICE_NO_VALUE; for(uint8_t i = 0; i < 34; i++) { - float val = eapi->getValueForHour(now, i); + float val = ps->getValueForHour(PRICE_DIRECTION_IMPORT, now, i); values[i] = val; if(i > 23) continue; - if(val == ENTSOE_NO_VALUE) break; + if(val == PRICE_NO_VALUE) break; if(val < min) min = val; if(val > max) max = val; @@ -203,7 +209,7 @@ bool RawMqttHandler::publishPrices(EntsoeApi* eapi) { float val1 = values[i++]; float val2 = values[i++]; float val3 = val; - if(val1 == ENTSOE_NO_VALUE || val2 == ENTSOE_NO_VALUE || val3 == ENTSOE_NO_VALUE) continue; + if(val1 == PRICE_NO_VALUE || val2 == PRICE_NO_VALUE || val3 == PRICE_NO_VALUE) continue; float val3hr = val1+val2+val3; if(min3hrIdx == -1 || min3hr > val3hr) { min3hr = val3hr; @@ -219,7 +225,7 @@ bool RawMqttHandler::publishPrices(EntsoeApi* eapi) { float val4 = values[i++]; float val5 = values[i++]; float val6 = val; - if(val1 == ENTSOE_NO_VALUE || val2 == ENTSOE_NO_VALUE || val3 == ENTSOE_NO_VALUE || val4 == ENTSOE_NO_VALUE || val5 == ENTSOE_NO_VALUE || val6 == ENTSOE_NO_VALUE) continue; + if(val1 == PRICE_NO_VALUE || val2 == PRICE_NO_VALUE || val3 == PRICE_NO_VALUE || val4 == PRICE_NO_VALUE || val5 == PRICE_NO_VALUE || val6 == PRICE_NO_VALUE) continue; float val6hr = val1+val2+val3+val4+val5+val6; if(min6hrIdx == -1 || min6hr > val6hr) { min6hr = val6hr; @@ -253,7 +259,7 @@ bool RawMqttHandler::publishPrices(EntsoeApi* eapi) { for(int i = 0; i < 34; i++) { float val = values[i]; - if(val == ENTSOE_NO_VALUE) { + if(val == PRICE_NO_VALUE) { mqtt.publish(topic + "/price/" + String(i), "", true, 0); } else { mqtt.publish(topic + "/price/" + String(i), String(val, 4), true, 0); @@ -280,7 +286,7 @@ bool RawMqttHandler::publishPrices(EntsoeApi* eapi) { return true; } -bool RawMqttHandler::publishSystem(HwTools* hw, EntsoeApi* eapi, EnergyAccounting* ea) { +bool RawMqttHandler::publishSystem(HwTools* hw, PriceService* ps, EnergyAccounting* ea) { if(topic.isEmpty() || !mqtt.connected()) return false; diff --git a/lib/RealtimePlot/include/RealtimePlot.h b/lib/RealtimePlot/include/RealtimePlot.h new file mode 100644 index 00000000..fc73c426 --- /dev/null +++ b/lib/RealtimePlot/include/RealtimePlot.h @@ -0,0 +1,31 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#ifndef _REALTIMEPLOT_H +#define _REALTIMEPLOT_H + +#include +#include "AmsData.h" + +#define REALTIME_SAMPLE 10000 +#define REALTIME_SIZE 360 + +class RealtimePlot { +public: + RealtimePlot(); + void update(AmsData& data); + int32_t getValue(uint16_t req); + int16_t getSize(); + +private: + int8_t* values; + uint8_t* scaling; + + unsigned long lastMillis = 0; + double lastReading = 0; + uint16_t lastPos = 0; +}; +#endif diff --git a/lib/RealtimePlot/src/RealtimePlot.cpp b/lib/RealtimePlot/src/RealtimePlot.cpp new file mode 100644 index 00000000..684d15fc --- /dev/null +++ b/lib/RealtimePlot/src/RealtimePlot.cpp @@ -0,0 +1,82 @@ +/** + * @copyright Utilitech AS 2023 + * License: Fair Source + * + */ + +#include "RealtimePlot.h" +#include + +RealtimePlot::RealtimePlot() { + values = (int8_t*) malloc(REALTIME_SIZE); + scaling = (uint8_t*) malloc(REALTIME_SIZE); + memset(values, 0, REALTIME_SIZE); + memset(scaling, 0, REALTIME_SIZE); +} + +void RealtimePlot::update(AmsData& data) { + unsigned long now = millis(); + uint16_t pos = (now / REALTIME_SAMPLE) % REALTIME_SIZE; + if(lastMillis == 0) { + lastMillis = now; + lastReading = data.getActiveImportCounter() - data.getActiveExportCounter(); + lastPos = pos; + return; + } + if(pos == lastPos && data.isCounterEstimated()) return; + + unsigned long ms = now - lastMillis; + int32_t val; // A bit hacky this one, but just to avoid spikes at end of hour. Will mostly be correct + if(data.isCounterEstimated()) { + val = ((data.getActiveImportCounter() - data.getActiveExportCounter() - lastReading) * 1000) / (((float) ms) / 3600000.0); + } else { + val = data.getActiveImportPower() - data.getActiveExportPower(); + } + uint8_t scale = 0; + int32_t update = val / pow(10, scale); + while(update > INT8_MAX || update < INT8_MIN) { + update = val / pow(10, ++scale); + } + if(pos < lastPos) { + for(uint16_t i = lastPos+1; i < REALTIME_SIZE; i++) { + values[i] = update; + scaling[i] = scale; + } + for(uint16_t i = 0; i <= pos; i++) { + values[i] = update; + scaling[i] = scale; + } + } else { + for(uint16_t i = lastPos+1; i <= pos; i++) { + values[i] = update; + scaling[i] = scale; + } + } + + lastMillis = now; + lastReading = data.getActiveImportCounter() - data.getActiveExportCounter(); + lastPos = pos; +} + +int32_t RealtimePlot::getValue(uint16_t req) { + if(req > REALTIME_SAMPLE) return 0; + + unsigned long now = millis(); + if(req * REALTIME_SAMPLE > now) return 0; + unsigned long reqTime = now - (req * REALTIME_SAMPLE); + + uint16_t pos = (now / REALTIME_SAMPLE) % REALTIME_SIZE; + uint16_t getPos; + if(reqTime > lastMillis) { + getPos = lastPos; + } else if(req > pos) { + getPos = REALTIME_SIZE + pos - req; + } else { + getPos = pos - req; + } + return values[getPos] * pow(10, scaling[getPos]); +} + +int16_t RealtimePlot::getSize() { + return REALTIME_SIZE; +} diff --git a/lib/SvelteUi/app/.gitignore b/lib/SvelteUi/app/.gitignore index 234f2f1b..23fe4cad 100644 --- a/lib/SvelteUi/app/.gitignore +++ b/lib/SvelteUi/app/.gitignore @@ -10,6 +10,8 @@ lerna-debug.log* node_modules *.local +vite.config.local.js + # Editor directories and files .vscode/* !.vscode/extensions.json diff --git a/lib/SvelteUi/app/dist/github.svg b/lib/SvelteUi/app/dist/github.svg deleted file mode 100644 index f25b68d5..00000000 --- a/lib/SvelteUi/app/dist/github.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - GitHub - - diff --git a/lib/SvelteUi/app/dist/index.css b/lib/SvelteUi/app/dist/index.css index d2d1001f..2a92cda9 100644 --- a/lib/SvelteUi/app/dist/index.css +++ b/lib/SvelteUi/app/dist/index.css @@ -1 +1 @@ -/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-radius:0;border-width:1px;font-size:1rem;line-height:1.5rem;padding:.5rem .75rem}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);border-color:#2563eb;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-bottom:0;padding-top:0}select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;background-origin:border-box;border-color:#6b7280;border-width:1px;color:#2563eb;display:inline-block;flex-shrink:0;height:1rem;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1rem}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=radio]:checked:focus,[type=radio]:checked:hover{background-color:currentColor;border-color:transparent}[type=checkbox]:indeterminate{background-color:currentColor;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{background-color:currentColor;border-color:transparent}[type=file]{background:unset;border-color:inherit;border-radius:0;border-width:0;font-size:unset;line-height:inherit;padding:0}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.static{position:static}.fixed{position:fixed}.inset-0{inset:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.float-right{float:right}.clear-both{clear:both}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-3{margin:.75rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.my-3{margin-bottom:.75rem;margin-top:.75rem}.my-auto{margin-bottom:auto;margin-top:auto}.mb-1{margin-bottom:.25rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-4{height:1rem}.h-6{height:1.5rem}.h-64{height:16rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-1\/4{width:25%}.w-3\/4{width:75%}.w-4{width:1rem}.w-40{width:10rem}.w-6{width:1.5rem}.w-96{width:24rem}.w-full{width:100%}.flex-auto{flex:1 1 auto}.flex-none{flex:none}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.rounded-l-md{border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}.rounded-r-md{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.bg-violet-600{--tw-bg-opacity:1;background-color:rgb(124 58 237/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity:.5}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.pb-4{padding-bottom:1rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-green-100{--tw-text-opacity:1;color:rgb(220 252 231/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-red-100{--tw-text-opacity:1;color:rgb(254 226 226/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity))}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.gh-logo{height:2rem;width:2rem}.cnt{--tw-bg-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-radius:.25rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);margin:.5rem;min-height:268px;padding:.5rem}.gwf{height:16rem}@media (min-width:640px){.gwf{grid-column:span 2/span 2}}@media (min-width:768px){.gwf{grid-column:span 3/span 3}}@media (min-width:1024px){.gwf{grid-column:span 4/span 4}}@media (min-width:1280px){.gwf{grid-column:span 5/span 5}}@media (min-width:1536px){.gwf{grid-column:span 6/span 6}}.in-pre{border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;border-width:1px 0 1px 1px}.in-post,.in-pre{--tw-border-opacity:1;--tw-bg-opacity:1;align-items:center;background-color:rgb(243 244 246/var(--tw-bg-opacity));display:flex;font-size:.875rem;line-height:1.25rem;padding-left:.75rem;padding-right:.75rem;white-space:nowrap}.in-post{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem;border-width:1px 1px 1px 0}.in-post,.in-txt{border-color:rgb(209 213 219/var(--tw-border-opacity))}.in-txt{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-txt:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-f{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-f:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-m{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-m:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-l{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-right-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;border-top-right-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-l:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-s{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem;width:100%}.in-s:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.tr{text-align:right}.bd-green{background-color:rgb(34 197 94/var(--tw-bg-opacity));color:rgb(220 252 231/var(--tw-text-opacity))}.bd-green,.bd-yellow{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-yellow{background-color:rgb(234 179 8/var(--tw-bg-opacity));color:rgb(254 249 195/var(--tw-text-opacity))}.bd-red{background-color:rgb(239 68 68/var(--tw-bg-opacity));color:rgb(254 226 226/var(--tw-text-opacity))}.bd-blue,.bd-red{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-blue{background-color:rgb(59 130 246/var(--tw-bg-opacity));color:rgb(219 234 254/var(--tw-text-opacity))}.bd-gray{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(243 244 246/var(--tw-text-opacity));font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.btn-pri{padding:.5rem 1rem}.btn-pri,.btn-pri-sm{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(255 255 255/var(--tw-text-opacity));margin-right:.75rem}.btn-pri-sm{font-size:.75rem;line-height:1rem;padding:.25rem .5rem}.pl-root{position:relative}.pl-ov{left:25%;position:absolute;text-align:center;top:27%;width:50%}.pl-val{font-size:1.7rem}.pl-unt{color:gray;font-size:1rem}.pl-sub{font-size:1rem;padding-top:10px}.pl-snt{color:gray;font-size:.7rem}.pl-lab{font-size:1rem}.chart{height:100%;margin:0 auto;width:100%}svg{position:relative;width:100%}.tick{font-family:Helvetica,Arial;font-size:.85em;font-weight:200}.tick line{stroke:#e2e2e2;stroke-dasharray:2}.tick text{fill:#999;text-anchor:start}.tick.tick-0 line{stroke-dasharray:0}.tick.tick-green line{stroke:#32d900!important}.tick.tick-green text{fill:#32d900!important}.tick.tick-orange line{stroke:#d95600!important}.tick.tick-orange text{fill:#d95600!important}.x-axis .tick text{text-anchor:middle}.bars rect{stroke:#000;stroke-opacity:.25;opacity:.9}.bars text{display:block;font-family:Helvetica,Arial;font-size:.85em;text-align:center}.hover\:text-blue-800:hover{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity))}@media (min-width:640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width:1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width:1280px){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width:1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}} +/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-radius:0;border-width:1px;font-size:1rem;line-height:1.5rem;padding:.5rem .75rem}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);border-color:#2563eb;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-bottom:0;padding-top:0}select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;background-origin:border-box;border-color:#6b7280;border-width:1px;color:#2563eb;display:inline-block;flex-shrink:0;height:1rem;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1rem}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=radio]:checked:focus,[type=radio]:checked:hover{background-color:currentColor;border-color:transparent}[type=checkbox]:indeterminate{background-color:currentColor;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{background-color:currentColor;border-color:transparent}[type=file]{background:unset;border-color:inherit;border-radius:0;border-width:0;font-size:unset;line-height:inherit;padding:0}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.static{position:static}.fixed{position:fixed}.inset-0{inset:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.float-right{float:right}.clear-both{clear:both}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-3{margin:.75rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.my-3{margin-bottom:.75rem;margin-top:.75rem}.my-auto{margin-bottom:auto;margin-top:auto}.mb-1{margin-bottom:.25rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-6{height:1.5rem}.h-64{height:16rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-1\/4{width:25%}.w-2\/3{width:66.666667%}.w-40{width:10rem}.w-6{width:1.5rem}.w-96{width:24rem}.w-full{width:100%}.flex-auto{flex:1 1 auto}.flex-none{flex:none}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity:.5}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.pb-4{padding-bottom:1rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.capitalize{text-transform:capitalize}.text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity))}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hdr{--tw-bg-opacity:1;background-color:rgb(124 58 237/var(--tw-bg-opacity));border-radius:.375rem;margin-left:.5rem;margin-right:.5rem;padding:.25rem}:is(.dark .hdr){--tw-bg-opacity:1;background-color:rgb(76 29 149/var(--tw-bg-opacity))}.logo{height:2rem;width:2rem}.cnt{--tw-bg-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-radius:.25rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);margin:.5rem;padding:.5rem}:is(.dark .cnt){--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow-color:#111827;--tw-shadow:var(--tw-shadow-colored);--tw-drop-shadow:drop-shadow(0 4px 3px rgba(0,0,0,.07)) drop-shadow(0 2px 2px rgba(0,0,0,.06));background-color:rgb(31 41 55/var(--tw-bg-opacity));color:rgb(255 255 255/var(--tw-text-opacity));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.cnt{min-height:268px}.gwf{height:16rem}@media (min-width:640px){.gwf{grid-column:span 2/span 2}}@media (min-width:768px){.gwf{grid-column:span 3/span 3}}@media (min-width:1024px){.gwf{grid-column:span 4/span 4}}@media (min-width:1280px){.gwf{grid-column:span 5/span 5}}@media (min-width:1536px){.gwf{grid-column:span 6/span 6}}.in-pre{--tw-border-opacity:1;--tw-bg-opacity:1;align-items:center;background-color:rgb(243 244 246/var(--tw-bg-opacity));border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;border-width:1px 0 1px 1px;display:flex;font-size:.875rem;line-height:1.25rem;padding-left:.75rem;padding-right:.75rem;white-space:nowrap}:is(.dark .in-pre){--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity));border-color:rgb(31 41 55/var(--tw-border-opacity))}.in-post{--tw-border-opacity:1;--tw-bg-opacity:1;align-items:center;background-color:rgb(243 244 246/var(--tw-bg-opacity));border-bottom-right-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-right-radius:.375rem;border-width:1px 1px 1px 0;display:flex;font-size:.875rem;line-height:1.25rem;padding-left:.75rem;padding-right:.75rem;white-space:nowrap}:is(.dark .in-post){--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity));border-color:rgb(31 41 55/var(--tw-border-opacity))}.in-txt{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-txt:disabled{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity));color:rgb(255 255 255/var(--tw-text-opacity));cursor:not-allowed}:is(.dark .in-txt){--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);--tw-drop-shadow:drop-shadow(0 10px 8px rgba(0,0,0,.04)) drop-shadow(0 4px 3px rgba(0,0,0,.1));background-color:rgb(55 65 81/var(--tw-bg-opacity));border-color:rgb(31 41 55/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:rgb(255 255 255/var(--tw-text-opacity));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:is(.dark .in-txt:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}:is(.dark .in-txt:disabled){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.in-f{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-f:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity));cursor:not-allowed}:is(.dark .in-f){--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);--tw-drop-shadow:drop-shadow(0 10px 8px rgba(0,0,0,.04)) drop-shadow(0 4px 3px rgba(0,0,0,.1));background-color:rgb(55 65 81/var(--tw-bg-opacity));border-color:rgb(31 41 55/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:rgb(255 255 255/var(--tw-text-opacity));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:is(.dark .in-f:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}:is(.dark .in-f:disabled){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.in-f:default{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.in-f:disabled{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}:is(.dark .in-f)::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}:is(.dark .in-f)::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}:is(.dark .in-f:default){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.in-m{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-m:disabled{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity));color:rgb(255 255 255/var(--tw-text-opacity));cursor:not-allowed}:is(.dark .in-m){--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);--tw-drop-shadow:drop-shadow(0 10px 8px rgba(0,0,0,.04)) drop-shadow(0 4px 3px rgba(0,0,0,.1));background-color:rgb(55 65 81/var(--tw-bg-opacity));border-color:rgb(31 41 55/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:rgb(255 255 255/var(--tw-text-opacity));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:is(.dark .in-m:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}:is(.dark .in-m:disabled){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.in-l{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-right-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;border-top-right-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-l:disabled{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity));color:rgb(255 255 255/var(--tw-text-opacity));cursor:not-allowed}:is(.dark .in-l){--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);--tw-drop-shadow:drop-shadow(0 10px 8px rgba(0,0,0,.04)) drop-shadow(0 4px 3px rgba(0,0,0,.1));background-color:rgb(55 65 81/var(--tw-bg-opacity));border-color:rgb(31 41 55/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:rgb(255 255 255/var(--tw-text-opacity));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:is(.dark .in-l:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}:is(.dark .in-l:disabled){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}:is(.dark .in-l)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(255 255 255/var(--tw-placeholder-opacity))}:is(.dark .in-l)::placeholder{--tw-placeholder-opacity:1;color:rgb(255 255 255/var(--tw-placeholder-opacity))}.in-s{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem;width:100%}.in-s:disabled{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity));color:rgb(255 255 255/var(--tw-text-opacity));cursor:not-allowed}:is(.dark .in-s){--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);--tw-drop-shadow:drop-shadow(0 10px 8px rgba(0,0,0,.04)) drop-shadow(0 4px 3px rgba(0,0,0,.1));background-color:rgb(55 65 81/var(--tw-bg-opacity));border-color:rgb(31 41 55/var(--tw-border-opacity));border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:is(.dark .in-s:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}:is(.dark .in-s:disabled){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.in-s::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.in-s::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}:is(.dark .in-s){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.tr{text-align:right}.bd-green{background-color:rgb(22 163 74/var(--tw-bg-opacity));color:rgb(220 252 231/var(--tw-text-opacity))}.bd-green,.bd-yellow{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-yellow{background-color:rgb(202 138 4/var(--tw-bg-opacity));color:rgb(254 249 195/var(--tw-text-opacity))}.bd-red{background-color:rgb(220 38 38/var(--tw-bg-opacity));color:rgb(254 226 226/var(--tw-text-opacity))}.bd-blue,.bd-red{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-blue{background-color:rgb(37 99 235/var(--tw-bg-opacity));color:rgb(219 234 254/var(--tw-text-opacity))}.bd-gray{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(243 244 246/var(--tw-text-opacity));font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-on{background-color:rgb(22 163 74/var(--tw-bg-opacity));color:rgb(220 252 231/var(--tw-text-opacity))}.bd-off,.bd-on{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.25rem;margin-top:auto;padding:.125rem .25rem}.bd-off{background-color:rgb(75 85 99/var(--tw-bg-opacity));color:rgb(243 244 246/var(--tw-text-opacity))}.btn-pri{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(255 255 255/var(--tw-text-opacity));margin-right:.75rem;padding:.5rem 1rem}.btn-red{background-color:rgb(220 38 38/var(--tw-bg-opacity))}.btn-red,.btn-yellow{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;color:rgb(255 255 255/var(--tw-text-opacity));margin-left:.5rem;padding:.5rem 1rem}.btn-yellow{background-color:rgb(202 138 4/var(--tw-bg-opacity))}.btn-pri-sm{background-color:rgb(37 99 235/var(--tw-bg-opacity))}.btn-pri-sm,.btn-yellow-sm{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;color:rgb(255 255 255/var(--tw-text-opacity));font-size:.75rem;line-height:1rem;margin-right:.75rem;padding:.25rem .5rem}.btn-yellow-sm{background-color:rgb(202 138 4/var(--tw-bg-opacity))}.pl-root{position:relative}.pl-ov{left:25%;position:absolute;text-align:center;top:27%;width:50%}.pl-val{font-size:1.7rem}.pl-unt{color:gray;font-size:1rem}:is(.dark .pl-unt){--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity))}.pl-sub{font-size:1rem;padding-top:10px}.pl-snt{color:gray;font-size:.7rem}:is(.dark .pl-snt){--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity))}.pl-lab{font-size:1rem}.chart{height:100%;margin:0 auto;width:100%}svg{position:relative;width:100%}.tick{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity));font-family:Helvetica,Arial;font-size:.85em;font-weight:200}:is(.dark .tick){fill:#fff}.tick line{stroke:#e2e2e2;stroke-dasharray:2}.tick text{fill:#999;text-anchor:start}:is(.dark .tick text){fill:#fff}.tick.tick-0 line{stroke-dasharray:0}.tick.tick-green line{stroke:#23ac05!important}.tick.tick-green text{fill:#23ac05!important}.tick.tick-orange line{stroke:#b19601!important}.tick.tick-orange text{fill:#b19601!important}.x-axis .tick text{text-anchor:middle}.bars rect{stroke:#000;stroke-opacity:.25;opacity:.9}.bars text{display:block;font-family:Helvetica,Arial;font-size:.85em;text-align:center}.hover\:text-blue-800:hover{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity))}:is(.dark .dark\:bg-gray-600){--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}:is(.dark .dark\:bg-gray-900){--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}:is(.dark .dark\:bg-opacity-80){--tw-bg-opacity:.8}:is(.dark .dark\:text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}@media (min-width:640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width:1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width:1280px){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width:1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}} diff --git a/lib/SvelteUi/app/dist/index.html b/lib/SvelteUi/app/dist/index.html index 6a9fa71d..8a8943ff 100644 --- a/lib/SvelteUi/app/dist/index.html +++ b/lib/SvelteUi/app/dist/index.html @@ -2,6 +2,7 @@ + @@ -9,7 +10,7 @@ - +
diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 3f2e089f..e0ebd16c 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,14 +1,7 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const u of r.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function l(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerpolicy&&(r.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?r.credentials="include":i.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(i){if(i.ep)return;i.ep=!0;const r=l(i);fetch(i.href,r)}})();function fe(){}function xt(t,e){for(const l in e)t[l]=e[l];return t}function nc(t){return t()}function La(){return Object.create(null)}function ze(t){t.forEach(nc)}function cr(t){return typeof t=="function"}function Ne(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let _s;function Js(t,e){return _s||(_s=document.createElement("a")),_s.href=e,t===_s.href}function l0(t){return Object.keys(t).length===0}function mr(t,...e){if(t==null)return fe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ai(t){let e;return mr(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(mr(e,l))}function pr(t,e,l,n){if(t){const i=ic(t,e,l,n);return t[0](i)}}function ic(t,e,l,n){return t[1]&&n?xt(l.ctx.slice(),t[1](n(e))):l.ctx}function _r(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const r=[],u=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ss(t){return function(e){return e.preventDefault(),t.call(this,e)}}function o(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const i0=["width","height"];function ui(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&i0.indexOf(n)===-1?t[n]=e[n]:o(t,n,e[n])}function he(t){return t===""?null:+t}function s0(t){return Array.from(t.childNodes)}function Z(t,e){e=""+e,t.data!==e&&(t.data=e)}function r0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function o0(t,e,l){~n0.indexOf(l)?r0(t,e):Z(t,e)}function te(t,e){t.value=e==null?"":e}function sc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function qe(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{r=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||r&&n.contentWindow)&&r(),C(n)}}function u0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Oa(t,e){return new t(e)}let $i;function Mi(t){$i=t}function Ti(){if(!$i)throw new Error("Function called outside component initialization");return $i}function oc(t){Ti().$$.on_mount.push(t)}function f0(t){Ti().$$.on_destroy.push(t)}function c0(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const r=u0(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,r)}),!r.defaultPrevented}return!0}}function Si(t,e){return Ti().$$.context.set(t,e),e}function Bl(t){return Ti().$$.context.get(t)}const ii=[],ws=[];let si=[];const Fa=[],ac=Promise.resolve();let xs=!1;function uc(){xs||(xs=!0,ac.then(fc))}function m0(){return uc(),ac}function Qe(t){si.push(t)}const Vs=new Set;let li=0;function fc(){if(li!==0)return;const t=$i;do{try{for(;lit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),si=e}const bs=new Set;let on;function De(){on={r:0,c:[],p:on}}function Ie(){on.r||ze(on.c),on=on.p}function D(t,e){t&&t.i&&(bs.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(bs.has(t))return;bs.add(t),on.c.push(()=>{bs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function cc(t,e){const l={},n={},i={$$scope:1};let r=t.length;for(;r--;){const u=t[r],a=e[r];if(a){for(const c in u)c in a||(n[c]=1);for(const c in a)i[c]||(l[c]=a[c],i[c]=1);t[r]=a}else for(const c in u)i[c]=1}for(const u in n)u in l||(l[u]=void 0);return l}function qa(t){return typeof t=="object"&&t!==null?t:{}}function ie(t){t&&t.c()}function le(t,e,l,n){const{fragment:i,after_update:r}=t.$$;i&&i.m(e,l),n||Qe(()=>{const u=t.$$.on_mount.map(nc).filter(cr);t.$$.on_destroy?t.$$.on_destroy.push(...u):ze(u),t.$$.on_mount=[]}),r.forEach(Qe)}function ne(t,e){const l=t.$$;l.fragment!==null&&(_0(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function d0(t,e){t.$$.dirty[0]===-1&&(ii.push(t),uc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[p],f.ctx[p]=d)&&(!f.skip_bound&&f.bound[p]&&f.bound[p](d),_&&d0(t,p)),b}):[],f.update(),_=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const p=s0(e.target);f.fragment&&f.fragment.l(p),p.forEach(C)}else f.fragment&&f.fragment.c();e.intro&&D(t.$$.fragment),le(t,e.target,e.anchor,e.customElement),fc()}Mi(c)}class Ee{$destroy(){ne(this,1),this.$destroy=fe}$on(e,l){if(!cr(l))return fe;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!l0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ba=t=>typeof t>"u",mc=t=>typeof t=="function",pc=t=>typeof t=="number";function v0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function _c(){let t=0;return()=>t++}function h0(){return Math.random().toString(36).substring(2)}const Ul=typeof window>"u";function dc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const vc=(t,e)=>t?{}:{style:e},er=t=>({"aria-hidden":"true",...vc(t,"display:none;")}),ni=[];function hc(t,e){return{subscribe:at(t,e).subscribe}}function at(t,e=fe){let l;const n=new Set;function i(a){if(Ne(t,a)&&(t=a,l)){const c=!ni.length;for(const f of n)f[1](),ni.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:r,subscribe:u}}function b0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,r=e.length<2;return hc(l,u=>{let a=!1;const c=[];let f=0,_=fe;const p=()=>{if(f)return;_();const v=e(n?c[0]:c,u);r?u(v):_=cr(v)?v:fe},b=i.map((v,d)=>mr(v,S=>{c[d]=S,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,tr=Ni("LOCATION"),fi=Ni("ROUTER"),bc=Ni("ROUTE"),g0=Ni("ROUTE_PARAMS"),k0=Ni("FOCUS_ELEM"),gc=/^:(.+)/,wi=(t,e,l)=>t.substr(e,l),lr=(t,e)=>wi(t,0,e.length)===e,w0=t=>t==="",y0=t=>gc.test(t),kc=t=>t[0]==="*",C0=t=>t.replace(/\*.*$/,""),wc=t=>t.replace(/(^\/+|\/+$)/g,"");function ml(t,e=!1){const l=wc(t).split("/");return e?l.filter(Boolean):l}const Ks=(t,e)=>t+(e?`?${e}`:""),hr=t=>`/${wc(t)}`;function Ai(...t){const e=n=>ml(n,!0).join("/"),l=t.map(e).join("/");return hr(l)}const br=1,$s=2,mn=3,M0=4,yc=5,S0=6,Cc=7,$0=8,T0=9,Mc=10,Sc=11,N0={[br]:"Link",[$s]:"Route",[mn]:"Router",[M0]:"useFocus",[yc]:"useLocation",[S0]:"useMatch",[Cc]:"useNavigate",[$0]:"useParams",[T0]:"useResolvable",[Mc]:"useResolve",[Sc]:"navigate"},gr=t=>N0[t];function A0(t,e){let l;return t===$s?l=e.path?`path="${e.path}"`:"default":t===br?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${gr(t)} ${l||""} />`}function P0(t,e,l,n){const i=l&&A0(n||t,l),r=i?` +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const f of o.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&n(f)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function ze(){}function mn(e,t){for(const l in t)e[l]=t[l];return e}function Fd(e){return e()}function qm(){return Object.create(null)}function Et(e){e.forEach(Fd)}function ff(e){return typeof e=="function"}function ct(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let qo;function jo(e,t){return qo||(qo=document.createElement("a")),qo.href=t,e===qo.href}function Lv(e){return Object.keys(e).length===0}function uf(e,...t){if(e==null)return ze;const l=e.subscribe(...t);return l.unsubscribe?()=>l.unsubscribe():l}function is(e){let t;return uf(e,l=>t=l)(),t}function Cn(e,t,l){e.$$.on_destroy.push(uf(t,l))}function rf(e,t,l,n){if(e){const i=Bd(e,t,l,n);return e[0](i)}}function Bd(e,t,l,n){return e[1]&&n?mn(l.ctx.slice(),e[1](n(t))):l.ctx}function cf(e,t,l,n){if(e[2]&&n){const i=e[2](n(l));if(t.dirty===void 0)return i;if(typeof i=="object"){const o=[],f=Math.max(t.dirty.length,i.length);for(let r=0;r32){const t=[],l=e.ctx.length/32;for(let n=0;ne.removeEventListener(t,l,n)}function as(e){return function(t){return t.preventDefault(),e.call(this,t)}}function u(e,t,l){l==null?e.removeAttribute(t):e.getAttribute(t)!==l&&e.setAttribute(t,l)}const Fv=["width","height"];function ss(e,t){const l=Object.getOwnPropertyDescriptors(e.__proto__);for(const n in t)t[n]==null?e.removeAttribute(n):n==="style"?e.style.cssText=t[n]:n==="__value"?e.value=e[n]=t[n]:l[n]&&l[n].set&&Fv.indexOf(n)===-1?e[n]=t[n]:u(e,n,t[n])}function Ze(e){return e===""?null:+e}function Bv(e){return Array.from(e.childNodes)}function C(e,t){t=""+t,e.data!==t&&(e.data=t)}function Uv(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function jv(e,t,l){~Rv.indexOf(l)?Uv(e,t):C(e,t)}function be(e,t){e.value=t==null?"":t}function As(e,t,l,n){l==null?e.style.removeProperty(t):e.style.setProperty(t,l,n?"important":"")}function Je(e,t,l){for(let n=0;n{f.source===n.contentWindow&&t()})):(n.src="about:blank",n.onload=()=>{o=re(n.contentWindow,"resize",t),t()}),s(e,n),()=>{(i||o&&n.contentWindow)&&o(),T(n)}}function yv(e,t,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(e,l,n,t),i}function Om(e,t){return new e(t)}let Os;function Ds(e){Os=e}function Rs(){if(!Os)throw new Error("Function called outside component initialization");return Os}function Ud(e){Rs().$$.on_mount.push(e)}function zv(e){Rs().$$.on_destroy.push(e)}function Wv(){const e=Rs();return(t,l,{cancelable:n=!1}={})=>{const i=e.$$.callbacks[t];if(i){const o=yv(t,l,{cancelable:n});return i.slice().forEach(f=>{f.call(e,o)}),!o.defaultPrevented}return!0}}function qs(e,t){return Rs().$$.context.set(e,t),t}function $n(e){return Rs().$$.context.get(e)}const ts=[],zo=[];let ls=[];const Im=[],jd=Promise.resolve();let Ka=!1;function Hd(){Ka||(Ka=!0,jd.then(yd))}function Gv(){return Hd(),jd}function Ct(e){ls.push(e)}const ja=new Set;let $i=0;function yd(){if($i!==0)return;const e=Os;do{try{for(;$ie.indexOf(n)===-1?t.push(n):l.push(n)),l.forEach(n=>n()),ls=t}const Fo=new Set;let _i;function pt(){_i={r:0,c:[],p:_i}}function dt(){_i.r||Et(_i.c),_i=_i.p}function Q(e,t){e&&e.i&&(Fo.delete(e),e.i(t))}function ee(e,t,l,n){if(e&&e.o){if(Fo.has(e))return;Fo.add(e),_i.c.push(()=>{Fo.delete(e),n&&(l&&e.d(1),n())}),e.o(t)}else n&&n()}function zd(e,t){const l={},n={},i={$$scope:1};let o=e.length;for(;o--;){const f=e[o],r=t[o];if(r){for(const c in f)c in r||(n[c]=1);for(const c in r)i[c]||(l[c]=r[c],i[c]=1);e[o]=r}else for(const c in f)i[c]=1}for(const f in n)f in l||(l[f]=void 0);return l}function Lm(e){return typeof e=="object"&&e!==null?e:{}}function Ne(e){e&&e.c()}function Se(e,t,l,n){const{fragment:i,after_update:o}=e.$$;i&&i.m(t,l),n||Ct(()=>{const f=e.$$.on_mount.map(Fd).filter(ff);e.$$.on_destroy?e.$$.on_destroy.push(...f):Et(f),e.$$.on_mount=[]}),o.forEach(Ct)}function Ce(e,t){const l=e.$$;l.fragment!==null&&(Kv(l.after_update),Et(l.on_destroy),l.fragment&&l.fragment.d(t),l.on_destroy=l.fragment=null,l.ctx=[])}function Yv(e,t){e.$$.dirty[0]===-1&&(ts.push(e),Hd(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const h=d.length?d[0]:v;return a.ctx&&i(a.ctx[p],a.ctx[p]=h)&&(!a.skip_bound&&a.bound[p]&&a.bound[p](h),_&&Yv(e,p)),v}):[],a.update(),_=!0,Et(a.before_update),a.fragment=n?n(a.ctx):!1,t.target){if(t.hydrate){const p=Bv(t.target);a.fragment&&a.fragment.l(p),p.forEach(T)}else a.fragment&&a.fragment.c();t.intro&&Q(e.$$.fragment),Se(e,t.target,t.anchor,t.customElement),yd()}Ds(c)}class mt{$destroy(){Ce(this,1),this.$destroy=ze}$on(t,l){if(!ff(l))return ze;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(t){this.$$set&&!Lv(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Rm=e=>typeof e>"u",Wd=e=>typeof e=="function",Gd=e=>typeof e=="number";function Qv(e){return!e.defaultPrevented&&e.button===0&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Vd(){let e=0;return()=>e++}function Xv(){return Math.random().toString(36).substring(2)}const xn=typeof window>"u";function Kd(e,t,l){return e.addEventListener(t,l),()=>e.removeEventListener(t,l)}const Yd=(e,t)=>e?{}:{style:t},Ya=e=>({"aria-hidden":"true",...Yd(e,"display:none;")}),xi=[];function Qd(e,t){return{subscribe:xt(e,t).subscribe}}function xt(e,t=ze){let l;const n=new Set;function i(r){if(ct(e,r)&&(e=r,l)){const c=!xi.length;for(const a of n)a[1](),xi.push(a,e);if(c){for(let a=0;a{n.delete(a),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:f}}function Zv(e,t,l){const n=!Array.isArray(e),i=n?[e]:e,o=t.length<2;return Qd(l,f=>{let r=!1;const c=[];let a=0,_=ze;const p=()=>{if(a)return;_();const d=t(n?c[0]:c,f);o?f(d):_=ff(d)?d:ze},v=i.map((d,h)=>uf(d,g=>{c[h]=g,a&=~(1<{a|=1<`@@svnav-ctx__${e}`,Qa=Fs("LOCATION"),os=Fs("ROUTER"),Xd=Fs("ROUTE"),Jv=Fs("ROUTE_PARAMS"),$v=Fs("FOCUS_ELEM"),Zd=/^:(.+)/,Ts=(e,t,l)=>e.substr(t,l),Xa=(e,t)=>Ts(e,0,t.length)===t,xv=e=>e==="",eh=e=>Zd.test(e),Jd=e=>e[0]==="*",th=e=>e.replace(/\*.*$/,""),$d=e=>e.replace(/(^\/+|\/+$)/g,"");function Tn(e,t=!1){const l=$d(e).split("/");return t?l.filter(Boolean):l}const Ha=(e,t)=>e+(t?`?${t}`:""),df=e=>`/${$d(e)}`;function Bs(...e){const t=n=>Tn(n,!0).join("/"),l=e.map(t).join("/");return df(l)}const vf=1,Ko=2,bi=3,lh=4,xd=5,nh=6,ev=7,ih=8,sh=9,tv=10,lv=11,oh={[vf]:"Link",[Ko]:"Route",[bi]:"Router",[lh]:"useFocus",[xd]:"useLocation",[nh]:"useMatch",[ev]:"useNavigate",[ih]:"useParams",[sh]:"useResolvable",[tv]:"useResolve",[lv]:"navigate"},hf=e=>oh[e];function ah(e,t){let l;return e===Ko?l=t.path?`path="${t.path}"`:"default":e===vf?l=`to="${t.to}"`:e===bi&&(l=`basepath="${t.basepath||""}"`),`<${hf(e)} ${l||""} />`}function fh(e,t,l,n){const i=l&&ah(n||e,l),o=i?` -Occurred in: ${i}`:"",u=gr(t),a=mc(e)?e(u):e;return`<${u}> ${a}${r}`}const $c=t=>(...e)=>t(P0(...e)),Tc=$c(t=>{throw new Error(t)}),ys=$c(console.warn),Ua=4,E0=3,D0=2,I0=1,R0=1;function L0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let r=n;return r+=Ua,w0(i)?r+=R0:y0(i)?r+=D0:kc(i)?r-=Ua+I0:r+=E0,r},0);return{route:t,score:l,index:e}}function O0(t){return t.map(L0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Nc(t,e){let l,n;const[i]=e.split("?"),r=ml(i),u=r[0]==="",a=O0(t);for(let c=0,f=a.length;c({..._,params:b,uri:$});if(_.default){n=v(e);continue}const d=ml(_.fullPath),S=Math.max(r.length,d.length);let y=0;for(;y{f===".."?c.pop():f!=="."&&c.push(f)}),Ks(`/${c.join("/")}`,n)}function Ha(t,e){const{pathname:l,hash:n="",search:i="",state:r}=t,u=ml(e,!0),a=ml(l,!0);for(;u.length;)u[0]!==a[0]&&Tc(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:Ai(...a),hash:n,search:i,state:r}}const ja=t=>t.length===1?"":t,kr=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,r=i?ja(wi(t,l)):"",u=i?wi(t,0,l):t,a=n?ja(wi(u,e)):"";return{pathname:(n?wi(u,0,e):u)||"/",search:a,hash:r}},q0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function B0(t,e,l){return Ai(l,F0(t,e))}function U0(t,e){const l=hr(C0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),r=Ac({fullPath:l},Ai(...i));return r&&r.uri}const Ys="POP",H0="PUSH",j0="REPLACE";function Qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function W0(t){let e=[],l=Qs(t),n=Ys;const i=(r=e)=>r.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(r){e.push(r);const u=()=>{l=Qs(t),n=Ys,i([r])};i([r]);const a=dc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==r)}},navigate(r,u){const{state:a={},replace:c=!1}=u||{};if(n=c?j0:H0,pc(r))u&&ys(Sc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ys,t.history.go(r);else{const f={...a,_key:h0()};try{t.history[c?"replaceState":"pushState"](f,"",r)}catch{t.location[c?"replace":"assign"](r)}}l=Qs(t),i()}}}function Xs(t,e){return{...kr(e),state:t}}function z0(t="/"){let e=0,l=[Xs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,r){e++,l=l.slice(0,e),l.push(Xs(n,r))},replaceState(n,i,r){l[e]=Xs(n,r)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const G0=!!(!Ul&&window.document&&window.document.createElement),V0=!Ul&&window.location.origin==="null",Pc=W0(G0&&!V0?window:z0()),{navigate:ri}=Pc;let $l=null,Ec=!0;function K0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;n$l.level||t.level===$l.level&&K0(t.routerId,$l.routerId))&&($l=t)}function Q0(){$l=null}function X0(){Ec=!1}function Wa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=dc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Z0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function J0(t){return/^H[1-6]$/i.test(t.tagName)}function za(t,e=document){return e.querySelector(t)}function x0(t){let l=za(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Z0(l,t);){if(J0(l))return l;const n=za("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function e1(t){Promise.resolve(ai(t.focusElement)).then(e=>{const l=e||x0(t.id);l||ys(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,$s),!Wa(l)&&Wa(document.documentElement)})}const t1=(t,e,l)=>(n,i)=>m0().then(()=>{if(!$l||Ec){X0();return}if(n&&e1($l.route),t.announcements&&i){const{path:r,fullPath:u,meta:a,params:c,uri:f}=$l.route,_=t.createAnnouncement({path:r,fullPath:u,meta:a,params:c,uri:f},ai(l));Promise.resolve(_).then(p=>{e.set(p)})}Q0()}),l1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function n1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},vc(t[6],l1)],i={};for(let r=0;r`Navigated to ${ue.uri}`,announcements:!0,...d},$=_,N=hr(_),E=Bl(tr),B=Bl(fi),P=!E,L=s1(),O=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,a=ue));const x=B?B.disableInlineStyles:S,H=at([]);ul(t,H,ue=>l(20,u=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=P?0:B.level+1,U=P?at((()=>Ha(Ul?kr(p):b.location,N))()):E;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,r=ue));const j=t1(y,F,U),Y=ue=>ke=>ke.filter(me=>me.id!==ue);function X(ue){if(Ul){if(G)return;const ke=Ac(ue,n.pathname);if(ke)return G=!0,ke}else H.update(ke=>{const me=Y(ue.id)(ke);return me.push(ue),me})}function oe(ue){H.update(Y(ue))}return!P&&_!==Ga&&ys(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),P&&(oc(()=>b.listen(ke=>{const me=Ha(ke.location,N);K.set(n),U.set(me)})),Si(tr,U)),Si(fi,{activeRoute:z,registerRoute:X,unregisterRoute:oe,manageFocus:O,level:V,id:L,history:P?b:B.history,basepath:P?N:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,_=ue.basepath),"url"in ue&&l(12,p=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,S=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==$&&ys(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Nc(u,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&P){const ue=!!n.hash,ke=!ue&&O,me=!ue||n.pathname!==r.pathname;j(ke,me)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&Y0({level:V,routerId:L,route:i})},[a,y,P,L,O,F,x,H,z,U,K,_,p,b,v,d,S,n,i,r,u,f,c]}class o1 extends Ee{constructor(e){super(),Pe(this,e,r1,i1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Dc=o1;function Pi(t,e,l=fi,n=mn){Bl(l)||Tc(t,r=>`You cannot use ${r} outside of a ${gr(n)}.`,e)}const a1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Ic(){return Pi(yc),a1(tr)}function Rc(){const{history:t}=Bl(fi);return t}function Lc(){const t=Bl(bc);return t?b0(t,e=>e.base):at("/")}function Oc(){Pi(Mc);const t=Lc(),{basepath:e}=Bl(fi);return n=>B0(n,ai(t),e)}function u1(){Pi(Cc);const t=Oc(),{navigate:e}=Rc();return(n,i)=>{const r=pc(n)?n:t(n);return e(r,i)}}const f1=t=>({params:t&16,location:t&8}),Va=t=>({params:Ul?ai(t[10]):t[4],location:t[3],navigate:t[11]});function Ka(t){let e,l;return e=new Dc({props:{primary:t[1],$$slots:{default:[p1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&2&&(r.primary=n[1]),i&528409&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function c1(t){let e;const l=t[18].default,n=pr(l,t,t[19],Va);return{c(){n&&n.c()},m(i,r){n&&n.m(i,r),e=!0},p(i,r){n&&n.p&&(!e||r&524312)&&dr(n,l,i,i[19],e?_r(l,i[19],r,f1):vr(i[19]),Va)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function m1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?ai(t[10]):t[4],t[12]];var r=t[0];function u(a){let c={};for(let f=0;f{ne(_,1)}),Ie()}r?(e=Oa(r,u()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else r&&e.$set(f)},i(a){n||(e&&D(e.$$.fragment,a),n=!0)},o(a){e&&q(e.$$.fragment,a),n=!1},d(a){a&&C(l),e&&ne(e,a)}}}function p1(t){let e,l,n,i;const r=[m1,c1],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=r[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=r[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function _1(t){let e,l,n,i,r,u=[er(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let p=0;p{c=null}),Ie())},i(p){r||(D(c),r=!0)},o(p){q(c),r=!1},d(p){p&&C(e),p&&C(l),c&&c.d(p),p&&C(n),p&&C(i)}}}const d1=_c();function v1(t,e,l){let n;const i=["path","component","meta","primary"];let r=ks(e,i),u,a,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:S=!0}=e;Pi($s,e);const y=d1(),{registerRoute:$,unregisterRoute:N,activeRoute:E,disableInlineStyles:B}=Bl(fi);ul(t,E,G=>l(16,u=G));const P=Lc();ul(t,P,G=>l(17,c=G));const L=Ic();ul(t,L,G=>l(3,a=G));const O=at(null);let F;const x=at(),H=at({});ul(t,H,G=>l(4,f=G)),Si(bc,x),Si(g0,H),Si(k0,O);const z=u1();return Ul||f0(()=>N(y)),t.$$set=G=>{l(24,e=xt(xt({},e),gs(G))),l(12,r=ks(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,S=G.primary),"$$scope"in G&&l(19,p=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ai(c,b),W={id:y,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:U0(V,a.pathname),primary:S,focusElement:O};x.set(W),l(15,F=$(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||u&&u.id===y)),t.$$.dirty&98308&&n){const{params:G}=F||u;H.set(G)}},e=gs(e),[v,S,n,a,f,y,E,B,P,L,H,z,r,b,d,F,u,c,_,p]}class h1 extends Ee{constructor(e){super(),Pe(this,e,v1,_1,Ne,{path:13,component:0,meta:14,primary:1})}}const Sl=h1;function b1(t){let e,l,n,i;const r=t[13].default,u=pr(r,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,p=O));const E=c0(),B=Oc(),{navigate:P}=Rc();function L(O){E("click",O),v0(O)&&(O.preventDefault(),P(n,{state:y,replace:u||S}))}return t.$$set=O=>{l(19,e=xt(xt({},e),gs(O))),l(18,_=ks(e,f)),"to"in O&&l(5,d=O.to),"replace"in O&&l(6,S=O.replace),"state"in O&&l(7,y=O.state),"getProps"in O&&l(8,$=O.getProps),"$$scope"in O&&l(12,v=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,p)),t.$$.dirty&2049&&l(10,i=lr(p.pathname,n)),t.$$.dirty&2049&&l(9,r=n===p.pathname),t.$$.dirty&2049&&(u=kr(n)===q0(p)),t.$$.dirty&512&&l(2,a=r?{"aria-current":"page"}:{}),l(1,c=(()=>{if(mc($)){const O=$({location:p,href:n,isPartiallyCurrent:i,isCurrent:r});return{..._,...O}}return _})())},e=gs(e),[n,c,a,N,L,d,S,y,$,r,i,p,v,b]}class k1 extends Ee{constructor(e){super(),Pe(this,e,g1,b1,Ne,{to:5,replace:6,state:7,getProps:8})}}const el=k1;let nr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function w1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Fc(t){let e;return t>90?e="#d90000":t>85?e="#e32100":t>80?e="#ffb800":t>75?e="#dcd800":e="#32d900",e}function y1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Oe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ya(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Qa(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Xa(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Za(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ke(t,e){return t==1||t==2&&e}function Ht(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ja(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function xa(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function eu(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function Hl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),r=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),r}let al={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Rt=at(al);async function wr(){al=await(await Hl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Rt.set(al)}let vs=0,tu=-127,lu=null,C1={};const M1=hc(C1,t=>{let e;async function l(){Hl("/data.json").then(n=>n.json()).then(n=>{t(n),tu!=n.t&&(tu=n.t,setTimeout(jc,2e3)),lu==null&&n.pe&&n.p!=null&&(lu=n.p,Bc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||vs>1&&!oi(al.board))&&(wr(),an&&clearTimeout(an),an=setTimeout(Cr,2e3),un&&clearTimeout(un),un=setTimeout(Mr,3e3));let i=5e3;if(oi(al.board)&&n.v>2.5){let r=3.3-Math.min(3.3,n.v);r>0&&(i=Math.max(r,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),vs=0}).catch(n=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let ir={},yi;const yr=at(ir);async function qc(){let t=!1;if(yr.update(e=>{for(var l=0;l<36;l++){if(e[Oe(l)]==null){t=l<12;break}e[Oe(l)]=e[Oe(l+1)]}return e}),t)Bc();else{let e=new Date;yi=setTimeout(qc,(60-e.getMinutes())*6e4)}}async function Bc(){yi&&(clearTimeout(yi),yi=0),ir=await(await Hl("/energyprice.json")).json(),yr.set(ir);let e=new Date;yi=setTimeout(qc,(60-e.getMinutes())*6e4)}let sr={},an;async function Cr(){an&&(clearTimeout(an),an=0),sr=await(await Hl("/dayplot.json")).json(),Uc.set(sr);let e=new Date;an=setTimeout(Cr,(60-e.getMinutes())*6e4+20)}const Uc=at(sr,t=>(Cr(),function(){}));let rr={},un;async function Mr(){un&&(clearTimeout(un),un=0),rr=await(await Hl("/monthplot.json")).json(),Hc.set(rr);let e=new Date;un=setTimeout(Mr,(24-e.getHours())*36e5+40)}const Hc=at(rr,t=>(Mr(),function(){}));let or={};async function jc(){or=await(await Hl("/temperature.json")).json(),Wc.set(or)}const Wc=at(or,t=>(jc(),function(){}));let ar={},hs;async function zc(){hs&&(clearTimeout(hs),hs=0),ar=await(await Hl("/tariff.json")).json(),Gc.set(ar);let e=new Date;hs=setTimeout(zc,(60-e.getMinutes())*6e4+30)}const Gc=at(ar,t=>function(){});let ur=[];const Sr=at(ur);async function S1(){ur=await(await Hl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Sr.set(ur)}function Ms(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Vc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Kc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),r=parseInt(l[2]),u=[...e];u.reverse();let a,c,f;for(let _=0;_r&&(a=p):S==i+1&&(c=p);else if(d==n+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let N=parseInt($[1]);parseInt($[2]),S==N&&(f=p)}else f=p}return c||f||a||!1}else return e[0]}const $1="/github.svg";function nu(t){let e,l;function n(u,a){return u[1]>1?I1:u[1]>0?D1:u[2]>1?E1:u[2]>0?P1:u[3]>1?A1:u[3]>0?N1:T1}let i=n(t),r=i(t);return{c(){e=T(`Up - `),r.c(),l=Ve()},m(u,a){M(u,e,a),r.m(u,a),M(u,l,a)},p(u,a){i===(i=n(u))&&r?r.p(u,a):(r.d(1),r=i(u),r&&(r.c(),r.m(l.parentNode,l)))},d(u){u&&C(e),r.d(u),u&&C(l)}}}function T1(t){let e,l;return{c(){e=T(t[0]),l=T(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&Z(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function N1(t){let e,l;return{c(){e=T(t[3]),l=T(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=T(t[3]),l=T(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=T(t[2]),l=T(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=T(t[2]),l=T(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l;return{c(){e=T(t[1]),l=T(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function I1(t){let e,l;return{c(){e=T(t[1]),l=T(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function R1(t){let e,l=t[0]&&nu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=nu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function L1(t,e,l){let{epoch:n}=e,i=0,r=0,u=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,r=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,r,u]}class O1 extends Ee{constructor(e){super(),Pe(this,e,L1,R1,Ne,{epoch:0})}}function F1(t){let e,l,n;return{c(){e=m("span"),l=T(t[2]),o(e,"title",t[1]),o(e,"class",n="bd-"+t[0])},m(i,r){M(i,e,r),s(e,l)},p(i,[r]){r&4&&Z(l,i[2]),r&2&&o(e,"title",i[1]),r&1&&n!==(n="bd-"+i[0])&&o(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function q1(t,e,l){let{color:n}=e,{title:i}=e,{text:r}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,r=u.text)},[n,i,r]}class fn extends Ee{constructor(e){super(),Pe(this,e,q1,F1,Ne,{color:0,title:1,text:2})}}function B1(t){let e,l=`${Oe(t[0].getDate())}.${Oe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=T(l),o(e,"class",t[1])},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l=`${Oe(i[0].getDate())}.${Oe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Oe(i[0].getHours())}:${Oe(i[0].getMinutes())}`)&&Z(n,l),r&2&&o(e,"class",i[1])},d(i){i&&C(e)}}}function U1(t){let e=`${Oe(t[0].getDate())}. ${nr[t[0].getMonth()]} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,l;return{c(){l=T(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Oe(n[0].getDate())}. ${nr[n[0].getMonth()]} ${Oe(n[0].getHours())}:${Oe(n[0].getMinutes())}`)&&Z(l,e)},d(n){n&&C(l)}}}function H1(t){let e;function l(r,u){return r[2]?U1:B1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(r,u){i.m(r,u),M(r,e,u)},p(r,[u]){n===(n=l(r))&&i?i.p(r,u):(i.d(1),i=n(r),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(r){i.d(r),r&&C(e)}}}function j1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:r}=e,u;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,r=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(r)||fl(n,r-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,r]}class Yc extends Ee{constructor(e){super(),Pe(this,e,j1,H1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function W1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),o(n,"stroke-linecap","round"),o(n,"stroke-linejoin","round"),o(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(i,r){M(i,e,r),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class z1 extends Ee{constructor(e){super(),Pe(this,e,null,W1,Ne,{})}}function G1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class V1 extends Ee{constructor(e){super(),Pe(this,e,null,G1,Ne,{})}}function K1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Ut extends Ee{constructor(e){super(),Pe(this,e,null,K1,Ne,{})}}function Y1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Qc extends Ee{constructor(e){super(),Pe(this,e,null,Y1,Ne,{})}}function Q1(t){let e,l,n=t[1].version+"",i;return{c(){e=T("AMS reader "),l=m("span"),i=T(n)},m(r,u){M(r,e,u),M(r,l,u),s(l,i)},p(r,u){u&2&&n!==(n=r[1].version+"")&&Z(i,n)},d(r){r&&C(e),r&&C(l)}}}function iu(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=T(l),i=T("\xB0C"),o(e,"class","flex-none my-auto")},m(r,u){M(r,e,u),s(e,n),s(e,i)},p(r,u){u&1&&l!==(l=(r[0].t>-50?r[0].t.toFixed(1):"-")+"")&&Z(n,l)},d(r){r&&C(e)}}}function su(t){let e,l="HAN: "+Ya(t[0].he),n;return{c(){e=m("div"),n=T(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="HAN: "+Ya(i[0].he))&&Z(n,l)},d(i){i&&C(e)}}}function ru(t){let e,l="MQTT: "+Qa(t[0].me),n;return{c(){e=m("div"),n=T(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="MQTT: "+Qa(i[0].me))&&Z(n,l)},d(i){i&&C(e)}}}function ou(t){let e,l="PriceAPI: "+Xa(t[0].ee),n;return{c(){e=m("div"),n=T(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="PriceAPI: "+Xa(i[0].ee))&&Z(n,l)},d(i){i&&C(e)}}}function au(t){let e,l,n,i,r,u;return l=new el({props:{to:"/configuration",$$slots:{default:[X1]},$$scope:{ctx:t}}}),r=new el({props:{to:"/status",$$slots:{default:[Z1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(r.$$.fragment),o(e,"class","flex-none px-1 mt-1"),o(e,"title","Configuration"),o(i,"class","flex-none px-1 mt-1"),o(i,"title","Device information")},m(a,c){M(a,e,c),le(l,e,null),M(a,n,c),M(a,i,c),le(r,i,null),u=!0},i(a){u||(D(l.$$.fragment,a),D(r.$$.fragment,a),u=!0)},o(a){q(l.$$.fragment,a),q(r.$$.fragment,a),u=!1},d(a){a&&C(e),ne(l),a&&C(n),a&&C(i),ne(r)}}}function X1(t){let e,l;return e=new z1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Z1(t){let e,l;return e=new V1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function uu(t){let e,l,n,i,r;const u=[x1,J1],a=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),o(e,"class","flex-none mr-3 text-yellow-500"),o(e,"title",i="New version: "+t[2].tag_name)},m(f,_){M(f,e,_),a[l].m(e,null),r=!0},p(f,_){let p=l;l=c(f),l===p?a[l].p(f,_):(De(),q(a[p],1,1,()=>{a[p]=null}),Ie(),n=a[l],n?n.p(f,_):(n=a[l]=u[l](f),n.c()),D(n,1),n.m(e,null)),(!r||_&4&&i!==(i="New version: "+f[2].tag_name))&&o(e,"title",i)},i(f){r||(D(n),r=!0)},o(f){q(n),r=!1},d(f){f&&C(e),a[l].d()}}}function J1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=T("New version: "),i=T(n)},m(r,u){M(r,e,u),s(e,l),s(e,i)},p(r,u){u&4&&n!==(n=r[2].tag_name+"")&&Z(i,n)},i:fe,o:fe,d(r){r&&C(e)}}}function x1(t){let e,l,n,i=t[2].tag_name+"",r,u,a,c,f,_;return a=new Qc({}),{c(){e=m("button"),l=m("span"),n=T("New version: "),r=T(i),u=h(),ie(a.$$.fragment),o(l,"class","mt-1"),o(e,"class","flex")},m(p,b){M(p,e,b),s(e,l),s(l,n),s(l,r),s(e,u),le(a,e,null),c=!0,f||(_=ee(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&Z(r,i)},i(p){c||(D(a.$$.fragment,p),c=!0)},o(p){q(a.$$.fragment,p),c=!1},d(p){p&&C(e),ne(a),f=!1,_()}}}function em(t){let e,l,n,i,r,u,a,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,S,y,$,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,$e,He,Re,je;i=new el({props:{to:"/",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),c=new O1({props:{epoch:t[0].u}});let we=t[0].t>-50&&iu(t);N=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new fn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),L=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new fn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let Te=(t[0].he<0||t[0].he>0)&&su(t),Le=t[0].me<0&&ru(t),Me=(t[0].ee>0||t[0].ee<0)&&ou(t);oe=new Yc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let w=t[1].vndcfg&&t[1].usrcfg&&au(t);He=new Ut({});let g=t[1].fwconsent===1&&t[2]&&uu(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),a=m("div"),ie(c.$$.fragment),f=h(),we&&we.c(),_=h(),p=m("div"),b=T("Free mem: "),d=T(v),S=T("kb"),y=h(),$=m("div"),ie(N.$$.fragment),E=h(),ie(B.$$.fragment),P=h(),ie(L.$$.fragment),O=h(),ie(F.$$.fragment),x=h(),Te&&Te.c(),H=h(),Le&&Le.c(),z=h(),Me&&Me.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),X=m("div"),ie(oe.$$.fragment),ue=h(),w&&w.c(),ke=h(),me=m("div"),$e=m("a"),ie(He.$$.fragment),Re=h(),g&&g.c(),o(n,"class","flex text-lg text-gray-100 p-2"),o(a,"class","flex-none my-auto"),o(p,"class","flex-none my-auto"),o(u,"class","flex-none my-auto p-2 flex space-x-4"),o($,"class","flex-auto flex-wrap my-auto justify-center p-2"),o(K,"class","gh-logo"),Js(K.src,j=$1)||o(K,"src",j),o(K,"alt","GitHub repo"),o(U,"class","float-right"),o(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),o(U,"target","_blank"),o(U,"rel","noreferrer"),o(U,"aria-label","GitHub"),o(W,"class","flex-none"),o(X,"class","flex-none my-auto px-2"),o($e,"href",Ht("")),o($e,"target","_blank"),o($e,"rel","noreferrer"),o(me,"class","flex-none px-1 mt-1"),o(me,"title","Documentation"),o(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),o(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),o(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){M(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(u,a),le(c,a,null),s(u,f),we&&we.m(u,null),s(u,_),s(u,p),s(p,b),s(p,d),s(p,S),s(l,y),s(l,$),le(N,$,null),s($,E),le(B,$,null),s($,P),le(L,$,null),s($,O),le(F,$,null),s(l,x),Te&&Te.m(l,null),s(l,H),Le&&Le.m(l,null),s(l,z),Me&&Me.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,X),le(oe,X,null),s(V,ue),w&&w.m(V,null),s(V,ke),s(V,me),s(me,$e),le(He,$e,null),s(V,Re),g&&g.m(V,null),je=!0},p(k,[A]){const I={};A&18&&(I.$$scope={dirty:A,ctx:k}),i.$set(I);const Q={};A&1&&(Q.epoch=k[0].u),c.$set(Q),k[0].t>-50?we?we.p(k,A):(we=iu(k),we.c(),we.m(u,_)):we&&(we.d(1),we=null),(!je||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&Z(d,v);const J={};A&3&&(J.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(J.color=ql(k[1].booting?2:k[0].em)),N.$set(J);const se={};A&3&&(se.color=ql(k[1].booting?9:k[0].hm)),B.$set(se);const ce={};A&1&&(ce.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(ce.color=ql(k[1].booting?9:k[0].wm)),L.$set(ce);const ve={};A&3&&(ve.color=ql(k[1].booting?9:k[0].mm)),F.$set(ve),k[0].he<0||k[0].he>0?Te?Te.p(k,A):(Te=su(k),Te.c(),Te.m(l,H)):Te&&(Te.d(1),Te=null),k[0].me<0?Le?Le.p(k,A):(Le=ru(k),Le.c(),Le.m(l,z)):Le&&(Le.d(1),Le=null),k[0].ee>0||k[0].ee<0?Me?Me.p(k,A):(Me=ou(k),Me.c(),Me.m(l,G)):Me&&(Me.d(1),Me=null);const Se={};A&1&&(Se.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&(Se.offset=k[1].clock_offset),oe.$set(Se),k[1].vndcfg&&k[1].usrcfg?w?A&2&&D(w,1):(w=au(k),w.c(),D(w,1),w.m(V,ke)):w&&(De(),q(w,1,1,()=>{w=null}),Ie()),k[1].fwconsent===1&&k[2]?g?(g.p(k,A),A&6&&D(g,1)):(g=uu(k),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(k){je||(D(i.$$.fragment,k),D(c.$$.fragment,k),D(N.$$.fragment,k),D(B.$$.fragment,k),D(L.$$.fragment,k),D(F.$$.fragment,k),D(oe.$$.fragment,k),D(w),D(He.$$.fragment,k),D(g),je=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(N.$$.fragment,k),q(B.$$.fragment,k),q(L.$$.fragment,k),q(F.$$.fragment,k),q(oe.$$.fragment,k),q(w),q(He.$$.fragment,k),q(g),je=!1},d(k){k&&C(e),ne(i),ne(c),we&&we.d(),ne(N),ne(B),ne(L),ne(F),Te&&Te.d(),Le&&Le.d(),Me&&Me.d(),ne(oe),w&&w.d(),ne(He),g&&g.d()}}}function tm(t,e,l){let{data:n={}}=e,i={},r={};function u(){confirm("Do you want to upgrade this device to "+r.tag_name+"?")&&(!oi(i.board)||confirm(Ms(be(i.chip,i.board))))&&(Rt.update(a=>(a.upgrading=!0,a)),Vc(r.tag_name))}return Rt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&S1()}),Sr.subscribe(a=>{l(2,r=Kc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,r,u]}class lm extends Ee{constructor(e){super(),Pe(this,e,tm,em,Ne,{data:0})}}function nm(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),o(l,"d",Zs(150,150,115,210,510)),o(l,"stroke","#eee"),o(l,"fill","none"),o(l,"stroke-width","55"),o(n,"d",i=Zs(150,150,115,210,210+300*t[0]/100)),o(n,"stroke",t[1]),o(n,"fill","none"),o(n,"stroke-width","55"),o(e,"viewBox","0 0 300 300"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"height","100%")},m(r,u){M(r,e,u),s(e,l),s(e,n)},p(r,[u]){u&1&&i!==(i=Zs(150,150,115,210,210+300*r[0]/100))&&o(n,"d",i),u&2&&o(n,"stroke",r[1])},i:fe,o:fe,d(r){r&&C(e)}}}function fu(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Zs(t,e,l,n,i){var r=fu(t,e,l,i),u=fu(t,e,l,n),a=i-n<=180?"0":"1",c=["M",r.x,r.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return c}function im(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=r=>{"pct"in r&&l(0,n=r.pct),"color"in r&&l(1,i=r.color)},[n,i]}class sm extends Ee{constructor(e){super(),Pe(this,e,im,nm,Ne,{pct:0,color:1})}}function cu(t){let e,l,n,i,r,u,a,c;return{c(){e=m("br"),l=h(),n=m("span"),i=T(t[3]),r=h(),u=m("span"),a=T(t[4]),c=T("/kWh"),o(n,"class","pl-sub"),o(u,"class","pl-snt")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),M(f,r,_),M(f,u,_),s(u,a),s(u,c)},p(f,_){_&8&&Z(i,f[3]),_&16&&Z(a,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(r),f&&C(u)}}}function rm(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y;l=new sm({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&cu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),r=m("span"),u=T(t[2]),a=h(),c=m("br"),f=h(),_=m("span"),p=T(t[0]),b=h(),v=m("span"),d=T(t[1]),S=h(),$&&$.c(),o(r,"class","pl-lab"),o(_,"class","pl-val"),o(v,"class","pl-unt"),o(i,"class","pl-ov"),o(e,"class","pl-root")},m(N,E){M(N,e,E),le(l,e,null),s(e,n),s(e,i),s(i,r),s(r,u),s(i,a),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,S),$&&$.m(i,null),y=!0},p(N,[E]){const B={};E&64&&(B.pct=N[6]),E&96&&(B.color=N[5](N[6])),l.$set(B),(!y||E&4)&&Z(u,N[2]),(!y||E&1)&&Z(p,N[0]),(!y||E&2)&&Z(d,N[1]),N[3]?$?$.p(N,E):($=cu(N),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(N){y||(D(l.$$.fragment,N),y=!0)},o(N){q(l.$$.fragment,N),y=!1},d(N){N&&C(e),ne(l),$&&$.d()}}}function om(t,e,l){let{val:n}=e,{max:i}=e,{unit:r}=e,{label:u}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,r=p.unit),"label"in p&&l(2,u=p.label),"sub"in p&&l(3,a=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,r,u,a,c,f,_,i]}class Xc extends Ee{constructor(e){super(),Pe(this,e,om,rm,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function mu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function pu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function _u(t,e,l){const n=t.slice();return n[15]=e[l],n}function du(t){let e,l,n,i,r,u,a=t[0].title&&vu(t),c=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(r,u){M(r,e,u),s(e,n),i=rc(e,t[9].bind(e))},p(r,u){u&1&&l!==(l=r[0].title+"")&&Z(n,l)},d(r){r&&C(e),i()}}}function hu(t){let e,l,n,i=t[15].label+"",r,u,a,c;return{c(){e=Fe("g"),l=Fe("line"),n=Fe("text"),r=T(i),o(l,"x2","100%"),o(n,"y","-4"),o(n,"x",u=t[15].align=="right"?"85%":""),o(e,"class",a="tick tick-"+t[15].value+" tick-"+t[15].color),o(e,"transform",c="translate(0, "+t[7](t[15].value)+")")},m(f,_){M(f,e,_),s(e,l),s(e,n),s(n,r)},p(f,_){_&1&&i!==(i=f[15].label+"")&&Z(r,i),_&1&&u!==(u=f[15].align=="right"?"85%":"")&&o(n,"x",u),_&1&&a!==(a="tick tick-"+f[15].value+" tick-"+f[15].color)&&o(e,"class",a),_&129&&c!==(c="translate(0, "+f[7](f[15].value)+")")&&o(e,"transform",c)},d(f){f&&C(e)}}}function bu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&hu(t);return{c(){n&&n.c(),l=Ve()},m(i,r){n&&n.m(i,r),M(i,l,r)},p(i,r){r&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,r):(n=hu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function gu(t){let e,l,n=(t[3]>20||t[13]%2==0)&&ku(t);return{c(){e=Fe("g"),n&&n.c(),o(e,"class","tick"),o(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,r){M(i,e,r),n&&n.m(e,null)},p(i,r){i[3]>20||i[13]%2==0?n?n.p(i,r):(n=ku(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),r&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&o(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function ku(t){let e,l=t[11].label+"",n,i;return{c(){e=Fe("text"),n=T(l),o(e,"x",i=t[3]/2),o(e,"y","-4")},m(r,u){M(r,e,u),s(e,n)},p(r,u){u&1&&l!==(l=r[11].label+"")&&Z(n,l),u&8&&i!==(i=r[3]/2)&&o(e,"x",i)},d(r){r&&C(e)}}}function wu(t){let e=!isNaN(t[6](t[13])),l,n=e&&gu(t);return{c(){n&&n.c(),l=Ve()},m(i,r){n&&n.m(i,r),M(i,l,r)},p(i,r){r&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,r):(n=gu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function yu(t){let e,l,n=t[11].value!==void 0&&Cu(t),i=t[11].value2>1e-4&&$u(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(r,u){M(r,e,u),n&&n.m(e,null),M(r,l,u),i&&i.m(l,null)},p(r,u){r[11].value!==void 0?n?n.p(r,u):(n=Cu(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null),r[11].value2>1e-4?i?i.p(r,u):(i=$u(r),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(r){r&&C(e),n&&n.d(),r&&C(l),i&&i.d()}}}function Cu(t){let e,l,n,i,r,u,a,c=t[3]>15&&Mu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),o(e,"x",l=t[6](t[13])+2),o(e,"y",n=t[7](t[11].value)),o(e,"width",i=t[3]-4),o(e,"height",r=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),o(e,"fill",u=t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,a,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&o(e,"x",l),_&129&&n!==(n=f[7](f[11].value))&&o(e,"y",n),_&8&&i!==(i=f[3]-4)&&o(e,"width",i),_&129&&r!==(r=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&o(e,"height",r),_&1&&u!==(u=f[11].color)&&o(e,"fill",u),f[3]>15?c?c.p(f,_):(c=Mu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function Mu(t){let e,l=t[11].label+"",n,i,r,u,a,c,f=t[11].title&&Su(t);return{c(){e=Fe("text"),n=T(l),f&&f.c(),c=Ve(),o(e,"width",i=t[3]-4),o(e,"dominant-baseline","middle"),o(e,"text-anchor",r=t[3]t[7](0)-t[8]?t[11].color:"white"),o(e,"transform",a="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]_[7](0)-_[8]?_[11].color:"white")&&o(e,"fill",u),p&457&&a!==(a="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[11].labelAngle?_[11].labelAngle:_[3]15&&Tu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),o(e,"x",l=t[6](t[13])+2),o(e,"y",n=t[7](0)),o(e,"width",i=t[3]-4),o(e,"height",r=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),o(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,a,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&o(e,"x",l),_&128&&n!==(n=f[7](0))&&o(e,"y",n),_&8&&i!==(i=f[3]-4)&&o(e,"width",i),_&129&&r!==(r=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&o(e,"height",r),_&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&o(e,"fill",u),f[3]>15?c?c.p(f,_):(c=Tu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function Tu(t){let e,l=t[11].label2+"",n,i,r,u,a,c=t[11].title2&&Nu(t);return{c(){e=Fe("text"),n=T(l),c&&c.c(),a=Ve(),o(e,"width",i=t[3]-4),o(e,"dominant-baseline","middle"),o(e,"text-anchor","middle"),o(e,"fill",r=t[7](-t[11].value2)t[10].call(e))},m(i,r){M(i,e,r),n&&n.m(e,null),l=rc(e,t[10].bind(e))},p(i,[r]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,r):(n=du(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let cn=30;function um(t,e,l){let{config:n}=e,i,r,u,a,c,f,_,p=0;function b(){p=this.clientHeight,l(5,p)}function v(){i=this.clientWidth,r=this.clientHeight,l(1,i),l(2,r)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=r-p);let d=i-(n.padding.left+n.padding.right);l(3,u=d/n.points.length),l(8,_=un.y.max?$=n.padding.bottom:yf||$<0?0:$})}},[n,i,r,u,f,p,a,c,_,b,v]}class pn extends Ee{constructor(e){super(),Pe(this,e,um,am,Ne,{config:0})}}function fm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:r}=e,{ds:u}=e,a={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:w1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,r=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),_.push(c(i))),r>0&&(f.push({label:u===1?"L2-L3":"L3"}),_.push(c(r))),l(0,a={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[a,n,i,r,u]}class mm extends Ee{constructor(e){super(),Pe(this,e,cm,fm,Ne,{u1:1,u2:2,u3:3,ds:4})}}function pm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function _m(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:r}=e,{i1:u}=e,{i2:a}=e,{i2e:c}=e,{i3:f}=e,{max:_}=e,p={};function b(v){return{label:ge(v)+"A",title:v.toFixed(1)+" A",value:isNaN(v)?0:v,color:Fc(v?v/_*100:0)}}return t.$$set=v=>{"u1"in v&&l(1,n=v.u1),"u2"in v&&l(2,i=v.u2),"u3"in v&&l(3,r=v.u3),"i1"in v&&l(4,u=v.i1),"i2"in v&&l(5,a=v.i2),"i2e"in v&&l(6,c=v.i2e),"i3"in v&&l(7,f=v.i3),"max"in v&&l(8,_=v.max)},t.$$.update=()=>{if(t.$$.dirty&510){let v=[],d=[];n>0&&(v.push({label:"L1"}),d.push(b(u))),i>0&&(c?(v.push({label:"L2"}),d.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(v.push({label:"L2"}),d.push(b(a)))),r>0&&(v.push({label:"L3"}),d.push(b(f))),l(0,p={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:_,ticks:[{value:0,label:"0%"},{value:_/4,label:"25%"},{value:_/2,label:"50%"},{value:_/4*3,label:"75%"},{value:_,label:"100%"}]},x:{ticks:v},points:d})}},[p,n,i,r,u,a,c,f,_]}class dm extends Ee{constructor(e){super(),Pe(this,e,_m,pm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function vm(t){let e,l,n,i,r,u,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,S=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",y,$,N,E,B,P,L,O=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,H,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),r=m("div"),r.textContent="Instant in",u=h(),a=m("div"),f=T(c),_=T(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),y=T(S),$=T(" VAr"),N=h(),E=m("div"),B=m("div"),B.textContent="Total in",P=h(),L=m("div"),F=T(O),x=T(" kVArh"),H=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=T(W),K=T(" kVArh"),o(a,"class","text-right"),o(d,"class","text-right"),o(i,"class","grid grid-cols-2 mt-4"),o(L,"class","text-right"),o(V,"class","text-right"),o(E,"class","grid grid-cols-2 mt-4"),o(e,"class","mx-2 text-sm")},m(j,Y){M(j,e,Y),s(e,l),s(e,n),s(e,i),s(i,r),s(i,u),s(i,a),s(a,f),s(a,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,y),s(d,$),s(e,N),s(e,E),s(E,B),s(E,P),s(E,L),s(L,F),s(L,x),s(E,H),s(E,z),s(E,G),s(E,V),s(V,U),s(V,K)},p(j,[Y]){Y&1&&c!==(c=(typeof j[0]<"u"?j[0].toFixed(0):"-")+"")&&Z(f,c),Y&2&&S!==(S=(typeof j[1]<"u"?j[1].toFixed(0):"-")+"")&&Z(y,S),Y&4&&O!==(O=(typeof j[2]<"u"?j[2].toFixed(1):"-")+"")&&Z(F,O),Y&8&&W!==(W=(typeof j[3]<"u"?j[3].toFixed(1):"-")+"")&&Z(U,W)},i:fe,o:fe,d(j){j&&C(e)}}}function hm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:r}=e,{exportTotal:u}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,r=a.importTotal),"exportTotal"in a&&l(3,u=a.exportTotal)},[n,i,r,u]}class bm extends Ee{constructor(e){super(),Pe(this,e,hm,vm,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Pu(t){let e;function l(r,u){return r[3]?km:gm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(r,u){i.m(r,u),M(r,e,u)},p(r,u){n===(n=l(r))&&i?i.p(r,u):(i.d(1),i=n(r),i&&(i.c(),i.m(e.parentNode,e)))},d(r){i.d(r),r&&C(e)}}}function gm(t){let e,l,n,i,r,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d=ge(t[1].d.u,1)+"",S,y,$,N,E,B,P=ge(t[1].m.u)+"",L,O,F,x,H,z,G=ge(t[0].last_month.u)+"",V,W,U,K,j=t[4]&&Eu(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=T(a),f=T(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),S=T(d),y=T(" kWh"),$=h(),N=m("div"),N.textContent="Month",E=h(),B=m("div"),L=T(P),O=T(" kWh"),F=h(),x=m("div"),x.textContent="Last month",H=h(),z=m("div"),V=T(G),W=T(" kWh"),U=h(),j&&j.c(),K=Ve(),o(u,"class","text-right"),o(v,"class","text-right"),o(B,"class","text-right"),o(z,"class","text-right"),o(n,"class","grid grid-cols-2 mb-3")},m(Y,X){M(Y,e,X),M(Y,l,X),M(Y,n,X),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,S),s(v,y),s(n,$),s(n,N),s(n,E),s(n,B),s(B,L),s(B,O),s(n,F),s(n,x),s(n,H),s(n,z),s(z,V),s(z,W),M(Y,U,X),j&&j.m(Y,X),M(Y,K,X)},p(Y,X){X&2&&a!==(a=ge(Y[1].h.u,2)+"")&&Z(c,a),X&2&&d!==(d=ge(Y[1].d.u,1)+"")&&Z(S,d),X&2&&P!==(P=ge(Y[1].m.u)+"")&&Z(L,P),X&1&&G!==(G=ge(Y[0].last_month.u)+"")&&Z(V,G),Y[4]?j?j.p(Y,X):(j=Eu(Y),j.c(),j.m(K.parentNode,K)):j&&(j.d(1),j=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),j&&j.d(Y),Y&&C(K)}}}function km(t){let e,l,n,i,r,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.u,1)+"",y,$,N,E,B,P,L,O=ge(t[1].m.u)+"",F,x,H,z,G,V,W,U=ge(t[0].last_month.u)+"",K,j,Y,X,oe,ue,ke,me,$e,He,Re,je=ge(t[1].h.p,2)+"",we,Te,Le,Me,w,g,k,A=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,Se,re=ge(t[1].m.p)+"",pe,Be,_e,ye,vt,jl,tl,ct=ge(t[0].last_month.p)+"",Tl,pl,jt,ht,Xe=t[4]&&Du(t),Ze=t[4]&&Iu(t),Je=t[4]&&Ru(t),Ue=t[4]&&Lu(t),xe=t[4]&&Ou(t),We=t[4]&&Fu(t),et=t[4]&&qu(t),tt=t[4]&&Bu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=T(a),f=T(" kWh"),_=h(),Xe&&Xe.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=T(S),$=T(" kWh"),N=h(),Ze&&Ze.c(),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=T(O),x=T(" kWh"),H=h(),Je&&Je.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=T(U),j=T(" kWh"),Y=h(),Ue&&Ue.c(),oe=h(),ue=m("strong"),ue.textContent="Export",ke=h(),me=m("div"),$e=m("div"),$e.textContent="Hour",He=h(),Re=m("div"),we=T(je),Te=T(" kWh"),Le=h(),xe&&xe.c(),Me=h(),w=m("div"),w.textContent="Day",g=h(),k=m("div"),I=T(A),Q=T(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),Se=m("div"),pe=T(re),Be=T(" kWh"),_e=h(),et&&et.c(),ye=h(),vt=m("div"),vt.textContent="Last mo.",jl=h(),tl=m("div"),Tl=T(ct),pl=T(" kWh"),jt=h(),tt&&tt.c(),o(u,"class","text-right"),o(d,"class","text-right"),o(L,"class","text-right"),o(W,"class","text-right"),o(n,"class",X="grid grid-cols-"+t[5]+" mb-3"),o(Re,"class","text-right"),o(k,"class","text-right"),o(Se,"class","text-right"),o(tl,"class","text-right"),o(me,"class",ht="grid grid-cols-"+t[5])},m(de,Ce){M(de,e,Ce),M(de,l,Ce),M(de,n,Ce),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(n,_),Xe&&Xe.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,$),s(n,N),Ze&&Ze.m(n,null),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(n,H),Je&&Je.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,j),s(n,Y),Ue&&Ue.m(n,null),M(de,oe,Ce),M(de,ue,Ce),M(de,ke,Ce),M(de,me,Ce),s(me,$e),s(me,He),s(me,Re),s(Re,we),s(Re,Te),s(me,Le),xe&&xe.m(me,null),s(me,Me),s(me,w),s(me,g),s(me,k),s(k,I),s(k,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,Se),s(Se,pe),s(Se,Be),s(me,_e),et&&et.m(me,null),s(me,ye),s(me,vt),s(me,jl),s(me,tl),s(tl,Tl),s(tl,pl),s(me,jt),tt&&tt.m(me,null)},p(de,Ce){Ce&2&&a!==(a=ge(de[1].h.u,2)+"")&&Z(c,a),de[4]?Xe?Xe.p(de,Ce):(Xe=Du(de),Xe.c(),Xe.m(n,p)):Xe&&(Xe.d(1),Xe=null),Ce&2&&S!==(S=ge(de[1].d.u,1)+"")&&Z(y,S),de[4]?Ze?Ze.p(de,Ce):(Ze=Iu(de),Ze.c(),Ze.m(n,E)):Ze&&(Ze.d(1),Ze=null),Ce&2&&O!==(O=ge(de[1].m.u)+"")&&Z(F,O),de[4]?Je?Je.p(de,Ce):(Je=Ru(de),Je.c(),Je.m(n,z)):Je&&(Je.d(1),Je=null),Ce&1&&U!==(U=ge(de[0].last_month.u)+"")&&Z(K,U),de[4]?Ue?Ue.p(de,Ce):(Ue=Lu(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Ce&32&&X!==(X="grid grid-cols-"+de[5]+" mb-3")&&o(n,"class",X),Ce&2&&je!==(je=ge(de[1].h.p,2)+"")&&Z(we,je),de[4]?xe?xe.p(de,Ce):(xe=Ou(de),xe.c(),xe.m(me,Me)):xe&&(xe.d(1),xe=null),Ce&2&&A!==(A=ge(de[1].d.p,1)+"")&&Z(I,A),de[4]?We?We.p(de,Ce):(We=Fu(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Ce&2&&re!==(re=ge(de[1].m.p)+"")&&Z(pe,re),de[4]?et?et.p(de,Ce):(et=qu(de),et.c(),et.m(me,ye)):et&&(et.d(1),et=null),Ce&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&Z(Tl,ct),de[4]?tt?tt.p(de,Ce):(tt=Bu(de),tt.c(),tt.m(me,null)):tt&&(tt.d(1),tt=null),Ce&32&&ht!==(ht="grid grid-cols-"+de[5])&&o(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Xe&&Xe.d(),Ze&&Ze.d(),Je&&Je.d(),Ue&&Ue.d(),de&&C(oe),de&&C(ue),de&&C(ke),de&&C(me),xe&&xe.d(),We&&We.d(),et&&et.d(),tt&&tt.d()}}}function Eu(t){let e,l,n,i,r,u,a=ge(t[1].h.c,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.c,1)+"",y,$,N,E,B,P,L,O=ge(t[1].m.c)+"",F,x,H,z,G,V,W,U=ge(t[0].last_month.c)+"",K,j,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=T(a),f=h(),_=T(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=T(S),$=h(),N=T(t[2]),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=T(O),x=h(),H=T(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=T(U),j=h(),Y=T(t[2]),o(u,"class","text-right"),o(d,"class","text-right"),o(L,"class","text-right"),o(W,"class","text-right"),o(n,"class","grid grid-cols-2")},m(X,oe){M(X,e,oe),M(X,l,oe),M(X,n,oe),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(u,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,$),s(d,N),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(L,H),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,j),s(W,Y)},p(X,oe){oe&2&&a!==(a=ge(X[1].h.c,2)+"")&&Z(c,a),oe&4&&Z(_,X[2]),oe&2&&S!==(S=ge(X[1].d.c,1)+"")&&Z(y,S),oe&4&&Z(N,X[2]),oe&2&&O!==(O=ge(X[1].m.c)+"")&&Z(F,O),oe&4&&Z(H,X[2]),oe&1&&U!==(U=ge(X[0].last_month.c)+"")&&Z(K,U),oe&4&&Z(Y,X[2])},d(X){X&&C(e),X&&C(l),X&&C(n)}}}function Du(t){let e,l=ge(t[1].h.c,2)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].h.c,2)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Iu(t){let e,l=ge(t[1].d.c,1)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].d.c,1)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Ru(t){let e,l=ge(t[1].m.c)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].m.c)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Lu(t){let e,l=ge(t[0].last_month.c)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.c)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Ou(t){let e,l=ge(t[1].h.i,2)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].h.i,2)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Fu(t){let e,l=ge(t[1].d.i,1)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].d.i,1)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function qu(t){let e,l=ge(t[1].m.i)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].m.i)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Bu(t){let e,l=ge(t[0].last_month.i)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.i)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function wm(t){let e,l,n,i,r,u,a=t[1]&&Pu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),r=m("br"),u=h(),a&&a.c(),o(e,"class","mx-2 text-sm")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),s(e,u),a&&a.m(e,null)},p(c,[f]){c[1]?a?a.p(c,f):(a=Pu(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:fe,o:fe,d(c){c&&C(e),a&&a.d()}}}function ym(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:r}=e,{hasExport:u}=e,a=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,r=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=a?3:2))},[n,i,r,u,a,c]}class Cm extends Ee{constructor(e){super(),Pe(this,e,ym,wm,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Mm(t){let e,l,n=xa(t[0].source)+"",i,r,u,a,c;return a=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=T("Provided by: "),i=T(n),u=h(),ie(a.$$.fragment),o(e,"href",r=eu(t[0].source)),o(e,"target","_blank"),o(e,"class","text-xs float-right z-40")},m(f,_){M(f,e,_),s(e,l),s(e,i),M(f,u,_),le(a,f,_),c=!0},p(f,[_]){(!c||_&1)&&n!==(n=xa(f[0].source)+"")&&Z(i,n),(!c||_&1&&r!==(r=eu(f[0].source)))&&o(e,"href",r);const p={};_&2&&(p.config=f[1]),a.$set(p)},i(f){c||(D(a.$$.fragment,f),c=!0)},o(f){q(a.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(u),ne(a,f)}}}function Sm(t,e,l){let{json:n}=e,{sysinfo:i}=e,r={},u,a;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],S=[];l(4,a=l(3,u=0));let y=new Date;for(fl(y,i.clock_offset-(24+y.getHours()-y.getUTCHours())%24),_=f;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),S.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);for(_=0;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),S.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);if(a>-100&&u<100){switch(c){case"NOK":case"DKK":c="\xF8re";break;case"SEK":c="\xF6re";break;case"EUR":c="cent";break;case"CHF":c="rp.";break;default:c=c+"/100"}for(l(4,a*=100),l(3,u*=100),_=0;_=0?P.toFixed(L):"",title:P>=0?P.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:P<0?P.toFixed(L):"",title2:P<0?P.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let N=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(N/4*-1,a));let P=Math.ceil(Math.abs(a)/N*4),L=a/P;for(_=1;_{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let $=n["i"+Oe(c)],N=n["e"+Oe(c)];$===void 0&&($=0),N===void 0&&(N=0),_.push({label:Oe(b.getHours())}),p.push({label:$.toFixed(1),title:$.toFixed(2)+" kWh",value:$*10,label2:N.toFixed(1),title2:N.toFixed(2)+" kWh",value2:N*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N*10)),l(3,u=Math.max(u,$*10)),fl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let $=n["i"+Oe(c)],N=n["e"+Oe(c)];$===void 0&&($=0),N===void 0&&(N=0),_.push({label:Oe(c)}),p.push({label:$.toFixed($<10?1:0),title:$.toFixed(2)+" kWh",value:$,label2:N.toFixed(N<10?1:0),title2:N.toFixed(2)+" kWh",value2:N,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N)),l(3,u=Math.max(u,$))}for(c=1;c{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,S)=>{var y=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:y.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,u=Math.min(u,c)),l(2,r=Math.max(r,c))}),l(2,r=Math.ceil(r)),l(3,u=Math.floor(u));let b=r;u<0&&(b+=Math.abs(u));let v=b/4;for(a=0;a<5;a++)c=u+v*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:r,ticks:f},x:{ticks:_},points:p})}},[i,n,r,u]}class Lm extends Ee{constructor(e){super(),Pe(this,e,Rm,Im,Ne,{json:1})}}function Om(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let Fm=0;function qm(t,e,l){let n={},i=0,r;return Gc.subscribe(u=>{l(2,r=u)}),zc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),r&&r.p)for(u=0;u0?Oe(_.d)+"."+nr[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(r&&r.t){for(u=0;u=i)break;a.push({value:_,label:_})}a.push({label:r.m.toFixed(1),align:"right",color:"green",value:r.m})}r&&r.c&&(a.push({label:r.c.toFixed(0),color:"orange",value:r.c}),l(1,i=Math.max(i,r.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Fm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,r]}class Bm extends Ee{constructor(e){super(),Pe(this,e,qm,Om,Ne,{})}}function Uu(t){let e,l,n,i,r,u,a=(t[0].mt?Cs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Xc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Fc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),c=T(a),f=h(),_=m("div"),b=T(p),v=T(" kWh"),o(n,"class","col-span-2"),o(_,"class","text-right"),o(l,"class","grid grid-cols-2"),o(e,"class","cnt")},m(S,y){M(S,e,y),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(u,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(S,y){const $={};y&1&&($.val=S[0].i?S[0].i:0),y&1&&($.max=S[0].im?S[0].im:15e3),y&1&&($.sub=S[0].p),y&1&&($.subunit=S[0].pc),i.$set($),(!d||y&1)&&a!==(a=(S[0].mt?Cs(S[0].mt):"-")+"")&&Z(c,a),(!d||y&1)&&p!==(p=(S[0].ic?S[0].ic.toFixed(1):"-")+"")&&Z(b,p)},i(S){d||(D(i.$$.fragment,S),d=!0)},o(S){q(i.$$.fragment,S),d=!1},d(S){S&&C(e),ne(i)}}}function Hu(t){let e,l,n,i,r,u,a,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new Xc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:y1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),a=h(),c=m("div"),_=T(f),p=T(" kWh"),o(n,"class","col-span-2"),o(c,"class","text-right"),o(l,"class","grid grid-cols-2"),o(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(l,a),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const S={};d&1&&(S.val=v[0].e?v[0].e:0),d&1&&(S.max=v[0].om?v[0].om*1e3:1e4),i.$set(S),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&Z(_,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function ju(t){let e,l,n;return l=new mm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.u1=i[0].u1),r&1&&(u.u2=i[0].u2),r&1&&(u.u3=i[0].u3),r&1&&(u.ds=i[0].ds),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Wu(t){let e,l,n;return l=new dm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i2e:t[0].i2e,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.u1=i[0].u1),r&1&&(u.u2=i[0].u2),r&1&&(u.u3=i[0].u3),r&1&&(u.i1=i[0].i1),r&1&&(u.i2=i[0].i2),r&1&&(u.i2e=i[0].i2e),r&1&&(u.i3=i[0].i3),r&1&&(u.max=i[0].mf?i[0].mf:32),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new bm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.importInstant=i[0].ri),r&1&&(u.exportInstant=i[0].re),r&1&&(u.importTotal=i[0].ric),r&1&&(u.exportTotal=i[0].rec),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new Cm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&2&&(u.sysinfo=i[1]),r&1&&(u.data=i[0].ea),r&1&&(u.currency=i[0].pc),r&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Bm({}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt h-64")},m(i,r){M(i,e,r),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new $m({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&4&&(u.json=i[2]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Am({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&8&&(u.json=i[3]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Qu(t){let e,l,n;return l=new Dm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&16&&(u.json=i[4]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Xu(t){let e,l,n;return l=new Lm({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&32&&(u.json=i[5]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Um(t){let e,l=Ke(t[1].ui.i,t[0].i),n,i=Ke(t[1].ui.e,t[0].om||t[0].e>0),r,u=Ke(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=Ke(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Ke(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Ke(t[1].ui.c,t[0].ea),v,d=Ke(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),S,y=Ke(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),$,N=Ke(t[1].ui.d,t[3]),E,B=Ke(t[1].ui.m,t[4]),P,L=Ke(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),O,F=l&&Uu(t),x=i&&Hu(t),H=u&&ju(t),z=c&&Wu(t),G=_&&zu(t),V=b&&Gu(t),W=d&&Vu(),U=y&&Ku(t),K=N&&Yu(t),j=B&&Qu(t),Y=L&&Xu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),r=h(),H&&H.c(),a=h(),z&&z.c(),f=h(),G&&G.c(),p=h(),V&&V.c(),v=h(),W&&W.c(),S=h(),U&&U.c(),$=h(),K&&K.c(),E=h(),j&&j.c(),P=h(),Y&&Y.c(),o(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(X,oe){M(X,e,oe),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,r),H&&H.m(e,null),s(e,a),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,p),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,S),U&&U.m(e,null),s(e,$),K&&K.m(e,null),s(e,E),j&&j.m(e,null),s(e,P),Y&&Y.m(e,null),O=!0},p(X,[oe]){oe&3&&(l=Ke(X[1].ui.i,X[0].i)),l?F?(F.p(X,oe),oe&3&&D(F,1)):(F=Uu(X),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),oe&3&&(i=Ke(X[1].ui.e,X[0].om||X[0].e>0)),i?x?(x.p(X,oe),oe&3&&D(x,1)):(x=Hu(X),x.c(),D(x,1),x.m(e,r)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),oe&3&&(u=Ke(X[1].ui.v,X[0].u1>100||X[0].u2>100||X[0].u3>100)),u?H?(H.p(X,oe),oe&3&&D(H,1)):(H=ju(X),H.c(),D(H,1),H.m(e,a)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),oe&3&&(c=Ke(X[1].ui.a,X[0].i1>.01||X[0].i2>.01||X[0].i3>.01)),c?z?(z.p(X,oe),oe&3&&D(z,1)):(z=Wu(X),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),oe&3&&(_=Ke(X[1].ui.r,X[0].ri>0||X[0].re>0||X[0].ric>0||X[0].rec>0)),_?G?(G.p(X,oe),oe&3&&D(G,1)):(G=zu(X),G.c(),D(G,1),G.m(e,p)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),oe&3&&(b=Ke(X[1].ui.c,X[0].ea)),b?V?(V.p(X,oe),oe&3&&D(V,1)):(V=Gu(X),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),oe&3&&(d=Ke(X[1].ui.t,X[0].pr&&(X[0].pr.startsWith("10YNO")||X[0].pr.startsWith("10Y1001A1001A4")))),d?W?oe&3&&D(W,1):(W=Vu(),W.c(),D(W,1),W.m(e,S)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),oe&3&&(y=Ke(X[1].ui.p,X[0].pe&&!Number.isNaN(X[0].p))),y?U?(U.p(X,oe),oe&3&&D(U,1)):(U=Ku(X),U.c(),D(U,1),U.m(e,$)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),oe&10&&(N=Ke(X[1].ui.d,X[3])),N?K?(K.p(X,oe),oe&10&&D(K,1)):(K=Yu(X),K.c(),D(K,1),K.m(e,E)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),oe&18&&(B=Ke(X[1].ui.m,X[4])),B?j?(j.p(X,oe),oe&18&&D(j,1)):(j=Qu(X),j.c(),D(j,1),j.m(e,P)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),oe&35&&(L=Ke(X[1].ui.s,X[0].t&&X[0].t!=-127&&X[5].c>1)),L?Y?(Y.p(X,oe),oe&35&&D(Y,1)):(Y=Xu(X),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(X){O||(D(F),D(x),D(H),D(z),D(G),D(V),D(W),D(U),D(K),D(j),D(Y),O=!0)},o(X){q(F),q(x),q(H),q(z),q(G),q(V),q(W),q(U),q(K),q(j),q(Y),O=!1},d(X){X&&C(e),F&&F.d(),x&&x.d(),H&&H.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),j&&j.d(),Y&&Y.d()}}}function Hm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,r={},u={},a={},c={};return yr.subscribe(f=>{l(2,r=f)}),Uc.subscribe(f=>{l(3,u=f)}),Hc.subscribe(f=>{l(4,a=f)}),Wc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,r,u,a,c]}class jm extends Ee{constructor(e){super(),Pe(this,e,Hm,Um,Ne,{data:0,sysinfo:1})}}let fr={};const Ci=at(fr);async function Wm(){fr=await(await fetch("/configuration.json")).json(),Ci.set(fr)}function Zu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function zm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Gm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Ju(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function xu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,r){M(i,e,r),M(i,l,r),M(i,n,r)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function ef(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function tf(t){let e,l,n;return{c(){e=m("option"),l=T("GPIO"),n=T(t[4]),e.__value=t[4],e.value=e.__value},m(i,r){M(i,e,r),s(e,l),s(e,n)},d(i){i&&C(e)}}}function lf(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&tf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=tf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function Vm(t){let e,l,n,i,r;function u(d,S){return d[0]=="esp32c3"?Gm:zm}let a=u(t),c=a(t),f=t[0]=="esp8266"&&Ju(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&xu(),p=t[0]=="esp32s2"&&ef(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in r&&l(0,n=r.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Zc extends Ee{constructor(e){super(),Pe(this,e,Km,Vm,Ne,{chip:0})}}function nf(t){let e,l,n=t[1]&&sf(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),o(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),o(e,"class","z-50"),o(e,"aria-modal","true")},m(i,r){M(i,e,r),s(e,l),n&&n.m(l,null)},p(i,r){i[1]?n?n.p(i,r):(n=sf(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function sf(t){let e,l;return{c(){e=m("div"),l=T(t[1]),o(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){M(n,e,i),s(e,l)},p(n,i){i&2&&Z(l,n[1])},d(n){n&&C(e)}}}function Ym(t){let e,l=t[0]&&nf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=nf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Qm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=r=>{"active"in r&&l(0,n=r.active),"message"in r&&l(1,i=r.message)},[n,i]}class It extends Ee{constructor(e){super(),Pe(this,e,Qm,Ym,Ne,{active:0,message:1})}}function rf(t,e,l){const n=t.slice();return n[1]=e[l],n}function of(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=T("Europe/"),i=T(n),e.__value="Europe/"+t[1],e.value=e.__value},m(r,u){M(r,e,u),s(e,l),s(e,i)},p:fe,d(r){r&&C(e)}}}function Xm(t){let e,l,n,i=t[0],r=[];for(let u=0;u>1&1,A=0;A0;g--)A[g]=A[g]?A[g-1]^P.EXPONENT[F._modN(P.LOG[A[g]]+w)]:A[g-1];A[0]=P.EXPONENT[F._modN(P.LOG[A[0]]+w)]}for(w=0;w<=k;w++)A[w]=P.LOG[A[w]]},_checkBadness:function(){var w,g,k,A,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;Ice*ce;)re-=ce*ce,Se++;for(Q+=Se*F.N4,A=0;A=J-2&&(w=J-2,I>9&&w--);var se=w;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&w<<4,Q[1]=w>>4,Q[0]=64|w>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&w<<4,Q[0]=64|w>>4}for(se=w+3-(I<10);se=5&&(k+=F.N1+A[g]-5);for(g=3;gw||A[g-3]*3>=A[g]*4||A[g+3]*3>=A[g]*4)&&(k+=F.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var w,g,k=0,A=3e4;for(g=0;g<8&&(this._applyMask(g),w=this._checkBadness(),w>=1)A&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,A>>=1)A&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var w,g,k=this._dataBlock,A=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(w=0;w1)for(w=$.BLOCK[A],k=I-7;;){for(g=I-7;g>w-3&&(this._addAlignment(g,k),!(g6)for(w=O.BLOCK[Q-7],g=17,k=0;k<6;k++)for(A=0;A<3;A++,g--)1&(g>11?Q>>g-12:w>>g)?(I[5-k+J*(2-A+J-11)]=1,I[2-A+J-11+J*(5-k)]=1):(this._setMask(5-k,2-A+J-11),this._setMask(2-A+J-11,5-k))},_isMasked:function(w,g){var k=F._getMaskBit(w,g);return this._mask[k]===1},_pack:function(){var w,g,k,A=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;gg&&(k=w,w=g,g=k),k=g,k+=g*g,k>>=1,k+=w,k},_modN:function(w){for(;w>=255;)w-=255,w=(w>>8)+(w&255);return w},N1:3,N2:3,N3:40,N4:10}),x=F,H=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var w=this.element;w.width=w.height=this.qrious.size}}),z=H,G=p.extend(function(w,g,k,A){this.name=w,this.modifiable=Boolean(g),this.defaultValue=k,this._valueTransformer=A},{transform:function(w){var g=this._valueTransformer;return typeof g=="function"?g(w,this):w}}),V=G,W=p.extend(null,{abs:function(w){return w!=null?Math.abs(w):null},hasOwn:function(w,g){return Object.prototype.hasOwnProperty.call(w,g)},noop:function(){},toUpperCase:function(w){return w!=null?w.toUpperCase():null}}),U=W,K=p.extend(function(w){this.options={},w.forEach(function(g){this.options[g.name]=g},this)},{exists:function(w){return this.options[w]!=null},get:function(w,g){return K._get(this.options[w],g)},getAll:function(w){var g,k=this.options,A={};for(g in k)U.hasOwn(k,g)&&(A[g]=K._get(k[g],w));return A},init:function(w,g,k){typeof k!="function"&&(k=U.noop);var A,I;for(A in this.options)U.hasOwn(this.options,A)&&(I=this.options[A],K._set(I,I.defaultValue,g),K._createAccessor(I,g,k));this._setAll(w,g,!0)},set:function(w,g,k){return this._set(w,g,k)},setAll:function(w,g){return this._setAll(w,g)},_set:function(w,g,k,A){var I=this.options[w];if(!I)throw new Error("Invalid option: "+w);if(!I.modifiable&&!A)throw new Error("Option cannot be modified: "+w);return K._set(I,g,k)},_setAll:function(w,g,k){if(!w)return!1;var A,I=!1;for(A in w)U.hasOwn(w,A)&&this._set(A,w[A],g,k)&&(I=!0);return I}},{_createAccessor:function(w,g,k){var A={get:function(){return K._get(w,g)}};w.modifiable&&(A.set=function(I){K._set(w,I,g)&&k(I,w)}),Object.defineProperty(g,w.name,A)},_get:function(w,g){return g["_"+w.name]},_set:function(w,g,k){var A="_"+w.name,I=k[A],Q=w.transform(g!=null?g:w.defaultValue);return k[A]=Q,Q!==I}}),j=K,Y=p.extend(function(){this._services={}},{getService:function(w){var g=this._services[w];if(!g)throw new Error("Service is not being managed with name: "+w);return g},setService:function(w,g){if(this._services[w])throw new Error("Service is already managed with name: "+w);g&&(this._services[w]=g)}}),X=Y,oe=new j([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new X,ke=p.extend(function(w){oe.init(w,this,this.update.bind(this));var g=oe.get("element",this),k=ue.getService("element"),A=g&&k.isCanvas(g)?g:k.createCanvas(),I=g&&k.isImage(g)?g:k.createImage();this._canvasRenderer=new S(this,A,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return oe.getAll(this)},set:function(w){oe.setAll(w,this)&&this.update()},toDataURL:function(w){return this.canvas.toDataURL(w||this.mime)},update:function(){var w=new x({level:this.level,value:this.value});this._canvasRenderer.render(w),this._imageRenderer.render(w)}},{use:function(w){ue.setService(w.getName(),w)}});Object.defineProperties(ke.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=ke,$e=me,He=p.extend({getName:function(){}}),Re=He,je=Re.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(w){},isImage:function(w){}}),we=je,Te=we.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(w){return w instanceof HTMLCanvasElement},isImage:function(w){return w instanceof HTMLImageElement}}),Le=Te;$e.use(new Le);var Me=$e;return Me})})(xc);const lp=xc.exports;function np(t){let e,l;return{c(){e=m("img"),Js(e.src,l=t[2])||o(e,"src",l),o(e,"alt",t[0]),o(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!Js(e.src,l=n[2])&&o(e,"src",l),i&1&&o(e,"alt",n[0]),i&2&&o(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function ip(t,e,l){const n=new lp;let{errorCorrection:i="L"}=e,{background:r="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:r,foreground:u,level:i,padding:f,size:a,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return oc(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,r=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,a=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,r,u,a,f]}class sp extends Ee{constructor(e){super(),Pe(this,e,ip,np,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function af(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function uf(t,e,l){const n=t.slice();return n[98]=e[l],n[99]=e,n[100]=l,n}function rp(t,e,l){const n=t.slice();return n[101]=e[l],n}function op(t,e,l){const n=t.slice();return n[104]=e[l],n}function ap(t){let e,l;return{c(){e=m("option"),l=T(t[104]),e.__value=t[104],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function ff(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),o(l,"name","pt"),o(l,"type","text"),o(l,"class","in-s"),o(l,"placeholder","ENTSO-E API key, optional, read docs")},m(r,u){M(r,e,u),M(r,l,u),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(r,u){u[0]&8&&l.value!==r[3].p.t&&te(l,r[3].p.t)},d(r){r&&C(e),r&&C(l),n=!1,i()}}}function cf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v;return{c(){e=m("div"),l=T("Username"),n=m("br"),i=h(),r=m("input"),u=h(),a=m("div"),c=T("Password"),f=m("br"),_=h(),p=m("input"),o(r,"name","gu"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1"),o(p,"name","gp"),o(p,"type","password"),o(p,"class","in-s"),o(a,"class","my-1")},m(d,S){M(d,e,S),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].g.u),M(d,u,S),M(d,a,S),s(a,c),s(a,f),s(a,_),s(a,p),te(p,t[3].g.p),b||(v=[ee(r,"input",t[24]),ee(p,"input",t[25])],b=!0)},p(d,S){S[0]&8&&r.value!==d[3].g.u&&te(r,d[3].g.u),S[0]&8&&p.value!==d[3].g.p&&te(p,d[3].g.p)},d(d){d&&C(e),d&&C(u),d&&C(a),b=!1,ze(v)}}}function up(t){let e,l=t[101]*100+"",n;return{c(){e=m("option"),n=T(l),e.__value=t[101]*100,e.value=e.__value},m(i,r){M(i,e,r),s(e,n)},p:fe,d(i){i&&C(e)}}}function mf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),o(l,"name","mek"),o(l,"type","text"),o(l,"class","in-s")},m(r,u){M(r,e,u),M(r,l,u),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(r,u){u[0]&8&&l.value!==r[3].m.e.k&&te(l,r[3].m.e.k)},d(r){r&&C(e),r&&C(l),n=!1,i()}}}function pf(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=T("Authentication key"),n=m("br"),i=h(),r=m("input"),o(r,"name","mea"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].m.e.a),u||(a=ee(r,"input",t[35]),u=!0)},p(c,f){f[0]&8&&r.value!==c[3].m.e.a&&te(r,c[3].m.e.a)},d(c){c&&C(e),u=!1,a()}}}function _f(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,H;return{c(){e=m("div"),l=m("div"),n=T("Watt"),i=m("br"),r=h(),u=m("input"),a=h(),c=m("div"),f=T("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),S=T("Amp"),y=m("br"),$=h(),N=m("input"),E=h(),B=m("div"),P=T("kWh"),L=m("br"),O=h(),F=m("input"),o(u,"name","mmw"),o(u,"type","number"),o(u,"min","0.00"),o(u,"max","1000"),o(u,"step","0.001"),o(u,"class","in-f tr w-full"),o(l,"class","w-1/4"),o(b,"name","mmv"),o(b,"type","number"),o(b,"min","0.00"),o(b,"max","1000"),o(b,"step","0.001"),o(b,"class","in-m tr w-full"),o(c,"class","w-1/4"),o(N,"name","mma"),o(N,"type","number"),o(N,"min","0.00"),o(N,"max","1000"),o(N,"step","0.001"),o(N,"class","in-m tr w-full"),o(d,"class","w-1/4"),o(F,"name","mmc"),o(F,"type","number"),o(F,"min","0.00"),o(F,"max","1000"),o(F,"step","0.001"),o(F,"class","in-l tr w-full"),o(B,"class","w-1/4"),o(e,"class","flex my-1")},m(z,G){M(z,e,G),s(e,l),s(l,n),s(l,i),s(l,r),s(l,u),te(u,t[3].m.m.w),s(e,a),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,S),s(d,y),s(d,$),s(d,N),te(N,t[3].m.m.a),s(e,E),s(e,B),s(B,P),s(B,L),s(B,O),s(B,F),te(F,t[3].m.m.c),x||(H=[ee(u,"input",t[37]),ee(b,"input",t[38]),ee(N,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(u.value)!==z[3].m.m.w&&te(u,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(N.value)!==z[3].m.m.a&&te(N,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(H)}}}function df(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y;return{c(){e=m("div"),l=T("Gateway"),n=m("br"),i=h(),r=m("input"),u=h(),a=m("div"),c=T("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),o(r,"name","ng"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1"),o(b,"name","nd1"),o(b,"type","text"),o(b,"class","in-f w-full"),o(d,"name","nd2"),o(d,"type","text"),o(d,"class","in-l w-full"),o(p,"class","flex"),o(a,"class","my-1")},m($,N){M($,e,N),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].n.g),M($,u,N),M($,a,N),s(a,c),s(a,f),s(a,_),s(a,p),s(p,b),te(b,t[3].n.d1),s(p,v),s(p,d),te(d,t[3].n.d2),S||(y=[ee(r,"input",t[49]),ee(b,"input",t[50]),ee(d,"input",t[51])],S=!0)},p($,N){N[0]&8&&r.value!==$[3].n.g&&te(r,$[3].n.g),N[0]&8&&b.value!==$[3].n.d1&&te(b,$[3].n.d1),N[0]&8&&d.value!==$[3].n.d2&&te(d,$[3].n.d2)},d($){$&&C(e),$&&C(u),$&&C(a),S=!1,ze(y)}}}function vf(t){let e,l,n,i,r;return{c(){e=m("label"),l=m("input"),n=T(" SSL"),o(l,"type","checkbox"),o(l,"name","qs"),l.__value="true",l.value=l.__value,o(l,"class","rounded mb-1"),o(e,"class","float-right mr-3")},m(u,a){M(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(r=[ee(l,"change",t[55]),ee(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&C(e),i=!1,ze(r)}}}function hf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v;const d=[cp,fp],S=[];function y(O,F){return O[3].q.s.c?0:1}n=y(t),i=S[n]=d[n](t);const $=[dp,_p],N=[];function E(O,F){return O[3].q.s.r?0:1}a=E(t),c=N[a]=$[a](t);const B=[gp,bp],P=[];function L(O,F){return O[3].q.s.k?0:1}return p=L(t),b=P[p]=B[p](t),{c(){e=m("div"),l=m("span"),i.c(),r=h(),u=m("span"),c.c(),f=h(),_=m("span"),b.c(),o(l,"class","flex pr-2"),o(u,"class","flex pr-2"),o(_,"class","flex pr-2"),o(e,"class","my-1 flex")},m(O,F){M(O,e,F),s(e,l),S[n].m(l,null),s(e,r),s(e,u),N[a].m(u,null),s(e,f),s(e,_),P[p].m(_,null),v=!0},p(O,F){let x=n;n=y(O),n===x?S[n].p(O,F):(De(),q(S[x],1,1,()=>{S[x]=null}),Ie(),i=S[n],i?i.p(O,F):(i=S[n]=d[n](O),i.c()),D(i,1),i.m(l,null));let H=a;a=E(O),a===H?N[a].p(O,F):(De(),q(N[H],1,1,()=>{N[H]=null}),Ie(),c=N[a],c?c.p(O,F):(c=N[a]=$[a](O),c.c()),D(c,1),c.m(u,null));let z=p;p=L(O),p===z?P[p].p(O,F):(De(),q(P[z],1,1,()=>{P[z]=null}),Ie(),b=P[p],b?b.p(O,F):(b=P[p]=B[p](O),b.c()),D(b,1),b.m(_,null))},i(O){v||(D(i),D(c),D(b),v=!0)},o(O){q(i),q(c),q(b),v=!1},d(O){O&&C(e),S[n].d(),N[a].d(),P[p].d()}}}function fp(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[mp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[pp]},$$scope:{ctx:t}}}),r=new $r({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function mp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function pp(t){let e;return{c(){e=T("CA OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function _p(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[vp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function dp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[hp]},$$scope:{ctx:t}}}),r=new $r({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function vp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function hp(t){let e;return{c(){e=T("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function bp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[kp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function gp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[wp]},$$scope:{ctx:t}}}),r=new $r({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function kp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function wp(t){let e;return{c(){e=T("Key OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function bf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K;return r=new Ut({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=m("div"),p=T("Electricity IDX"),b=m("br"),v=h(),d=m("input"),S=h(),y=m("div"),$=T("Current IDX"),N=m("br"),E=h(),B=m("input"),P=h(),L=m("div"),O=T(`Voltage IDX: L1, L2 & L3 - `),F=m("div"),x=m("input"),H=h(),z=m("input"),G=h(),V=m("input"),o(l,"class","text-sm"),o(i,"href",Ht("MQTT-configuration#domoticz")),o(i,"target","_blank"),o(i,"class","float-right"),o(a,"type","hidden"),o(a,"name","o"),a.value="true",o(d,"name","oe"),o(d,"type","text"),o(d,"class","in-f tr w-full"),o(_,"class","w-1/2"),o(B,"name","oc"),o(B,"type","text"),o(B,"class","in-l tr w-full"),o(y,"class","w-1/2"),o(f,"class","my-1 flex"),o(x,"name","ou1"),o(x,"type","text"),o(x,"class","in-f tr w-1/3"),o(z,"name","ou2"),o(z,"type","text"),o(z,"class","in-m tr w-1/3"),o(V,"name","ou3"),o(V,"type","text"),o(V,"class","in-l tr w-1/3"),o(F,"class","flex"),o(L,"class","my-1"),o(e,"class","cnt")},m(j,Y){M(j,e,Y),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].o.e),s(f,S),s(f,y),s(y,$),s(y,N),s(y,E),s(y,B),te(B,t[3].o.c),s(e,P),s(e,L),s(L,O),s(L,F),s(F,x),te(x,t[3].o.u1),s(F,H),s(F,z),te(z,t[3].o.u2),s(F,G),s(F,V),te(V,t[3].o.u3),W=!0,U||(K=[ee(d,"input",t[63]),ee(B,"input",t[64]),ee(x,"input",t[65]),ee(z,"input",t[66]),ee(V,"input",t[67])],U=!0)},p(j,Y){Y[0]&8&&d.value!==j[3].o.e&&te(d,j[3].o.e),Y[0]&8&&B.value!==j[3].o.c&&te(B,j[3].o.c),Y[0]&8&&x.value!==j[3].o.u1&&te(x,j[3].o.u1),Y[0]&8&&z.value!==j[3].o.u2&&te(z,j[3].o.u2),Y[0]&8&&V.value!==j[3].o.u3&&te(V,j[3].o.u3)},i(j){W||(D(r.$$.fragment,j),W=!0)},o(j){q(r.$$.fragment,j),W=!1},d(j){j&&C(e),ne(r),U=!1,ze(K)}}}function gf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,H,z,G,V;return r=new Ut({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=T("Discovery topic prefix"),p=m("br"),b=h(),v=m("input"),d=h(),S=m("div"),y=T("Hostname for URL"),$=m("br"),N=h(),E=m("input"),P=h(),L=m("div"),O=T("Name tag"),F=m("br"),x=h(),H=m("input"),o(l,"class","text-sm"),o(i,"href",Ht("MQTT-configuration#home-assistant")),o(i,"target","_blank"),o(i,"class","float-right"),o(a,"type","hidden"),o(a,"name","h"),a.value="true",o(v,"name","ht"),o(v,"type","text"),o(v,"class","in-s"),o(v,"placeholder","homeassistant"),o(f,"class","my-1"),o(E,"name","hh"),o(E,"type","text"),o(E,"class","in-s"),o(E,"placeholder",B=t[3].g.h+".local"),o(S,"class","my-1"),o(H,"name","hn"),o(H,"type","text"),o(H,"class","in-s"),o(L,"class","my-1"),o(e,"class","cnt")},m(W,U){M(W,e,U),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(f,p),s(f,b),s(f,v),te(v,t[3].h.t),s(e,d),s(e,S),s(S,y),s(S,$),s(S,N),s(S,E),te(E,t[3].h.h),s(e,P),s(e,L),s(L,O),s(L,F),s(L,x),s(L,H),te(H,t[3].h.n),z=!0,G||(V=[ee(v,"input",t[68]),ee(E,"input",t[69]),ee(H,"input",t[70])],G=!0)},p(W,U){U[0]&8&&v.value!==W[3].h.t&&te(v,W[3].h.t),(!z||U[0]&8&&B!==(B=W[3].g.h+".local"))&&o(E,"placeholder",B),U[0]&8&&E.value!==W[3].h.h&&te(E,W[3].h.h),U[0]&8&&H.value!==W[3].h.n&&te(H,W[3].h.n)},i(W){z||(D(r.$$.fragment,W),z=!0)},o(W){q(r.$$.fragment,W),z=!1},d(W){W&&C(e),ne(r),G=!1,ze(V)}}}function kf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d=t[3].c.es&&wf(t);return{c(){e=m("div"),l=m("input"),n=h(),i=m("strong"),i.textContent="Cloud connections",r=h(),u=m("div"),a=m("label"),c=m("input"),f=T(" Energy Speedometer"),_=h(),d&&d.c(),o(l,"type","hidden"),o(l,"name","c"),l.value="true",o(i,"class","text-sm"),o(c,"type","checkbox"),o(c,"class","rounded mb-1"),o(c,"name","ces"),c.__value="true",c.value=c.__value,o(u,"class","my-1"),o(e,"class","cnt")},m(S,y){M(S,e,y),s(e,l),s(e,n),s(e,i),s(e,r),s(e,u),s(u,a),s(a,c),c.checked=t[3].c.es,s(a,f),s(u,_),d&&d.m(u,null),p=!0,b||(v=ee(c,"change",t[71]),b=!0)},p(S,y){y[0]&8&&(c.checked=S[3].c.es),S[3].c.es?d?(d.p(S,y),y[0]&8&&D(d,1)):(d=wf(S),d.c(),D(d,1),d.m(u,null)):d&&(De(),q(d,1,1,()=>{d=null}),Ie())},i(S){p||(D(d),p=!0)},o(S){q(d),p=!1},d(S){S&&C(e),d&&d.d(),b=!1,v()}}}function wf(t){let e,l,n=t[0].mac+"",i,r,u,a,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,_,p,b,v=t[0].mac&&t[0].meter.id&&yf(t);return{c(){e=m("div"),l=T("MAC: "),i=T(n),r=h(),u=m("div"),a=T("Meter ID: "),f=T(c),_=h(),v&&v.c(),p=Ve(),o(e,"class","pl-5"),o(u,"class","pl-5")},m(d,S){M(d,e,S),s(e,l),s(e,i),M(d,r,S),M(d,u,S),s(u,a),s(u,f),M(d,_,S),v&&v.m(d,S),M(d,p,S),b=!0},p(d,S){(!b||S[0]&1)&&n!==(n=d[0].mac+"")&&Z(i,n),(!b||S[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&Z(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,S),S[0]&1&&D(v,1)):(v=yf(d),v.c(),D(v,1),v.m(p.parentNode,p)):v&&(De(),q(v,1,1,()=>{v=null}),Ie())},i(d){b||(D(v),b=!0)},o(d){q(v),b=!1},d(d){d&&C(e),d&&C(r),d&&C(u),d&&C(_),v&&v.d(d),d&&C(p)}}}function yf(t){let e,l,n;return l=new sp({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","pl-2")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Cf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,E;r=new Ut({});let B={length:9},P=[];for(let L=0;L20&&Tf(t),_=t[0].chip=="esp8266"&&Pf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),f&&f.c(),a=h(),_&&_.c(),o(l,"class","text-sm"),o(i,"href",Ht("GPIO-configuration")),o(i,"target","_blank"),o(i,"class","float-right"),o(e,"class","cnt")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),f&&f.m(e,null),s(e,a),_&&_.m(e,null),c=!0},p(p,b){p[0].board>20?f?(f.p(p,b),b[0]&1&&D(f,1)):(f=Tf(p),f.c(),D(f,1),f.m(e,a)):f&&(De(),q(f,1,1,()=>{f=null}),Ie()),p[0].chip=="esp8266"?_?_.p(p,b):(_=Pf(p),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(p){c||(D(r.$$.fragment,p),D(f),c=!0)},o(p){q(r.$$.fragment,p),q(f),c=!1},d(p){p&&C(e),ne(r),f&&f.d(),_&&_.d()}}}function Tf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,$e,He,Re,je,we,Te,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re;b=new Zc({props:{chip:t[0].chip}});let pe=t[0].chip!="esp8266"&&Nf(t),Be=t[3].i.v.p>0&&Af(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),r=T("HAN"),u=m("label"),a=m("input"),c=T(" pullup"),f=m("br"),_=h(),p=m("select"),ie(b.$$.fragment),v=h(),d=m("div"),S=T("AP button"),y=m("br"),$=h(),N=m("input"),E=h(),B=m("div"),P=T("LED"),L=m("label"),O=m("input"),F=T(" inv"),x=m("br"),H=h(),z=m("div"),G=m("input"),V=h(),W=m("div"),U=T("RGB"),K=m("label"),j=m("input"),Y=T(" inverted"),X=m("br"),oe=h(),ue=m("div"),ke=m("input"),me=h(),$e=m("input"),He=h(),Re=m("input"),je=h(),we=m("div"),Te=T("Temperature"),Le=m("br"),Me=h(),w=m("input"),g=h(),k=m("div"),A=T("Analog temp"),I=m("br"),Q=h(),J=m("input"),se=h(),pe&&pe.c(),ce=h(),Be&&Be.c(),o(e,"type","hidden"),o(e,"name","i"),e.value="true",o(a,"name","ihu"),a.__value="true",a.value=a.__value,o(a,"type","checkbox"),o(a,"class","rounded mb-1"),o(u,"class","ml-2"),o(p,"name","ihp"),o(p,"class","in-f w-full"),t[3].i.h.p===void 0&&Qe(()=>t[76].call(p)),o(i,"class","w-1/3"),o(N,"name","ia"),o(N,"type","number"),o(N,"min","0"),o(N,"max",t[6]),o(N,"class","in-m tr w-full"),o(d,"class","w-1/3"),o(O,"name","ili"),O.__value="true",O.value=O.__value,o(O,"type","checkbox"),o(O,"class","rounded mb-1"),o(L,"class","ml-4"),o(G,"name","ilp"),o(G,"type","number"),o(G,"min","0"),o(G,"max",t[6]),o(G,"class","in-l tr w-full"),o(z,"class","flex"),o(B,"class","w-1/3"),o(j,"name","iri"),j.__value="true",j.value=j.__value,o(j,"type","checkbox"),o(j,"class","rounded mb-1"),o(K,"class","ml-4"),o(ke,"name","irr"),o(ke,"type","number"),o(ke,"min","0"),o(ke,"max",t[6]),o(ke,"class","in-f tr w-1/3"),o($e,"name","irg"),o($e,"type","number"),o($e,"min","0"),o($e,"max",t[6]),o($e,"class","in-m tr w-1/3"),o(Re,"name","irb"),o(Re,"type","number"),o(Re,"min","0"),o(Re,"max",t[6]),o(Re,"class","in-l tr w-1/3"),o(ue,"class","flex"),o(W,"class","w-full"),o(w,"name","itd"),o(w,"type","number"),o(w,"min","0"),o(w,"max",t[6]),o(w,"class","in-f tr w-full"),o(we,"class","my-1 w-1/3"),o(J,"name","ita"),o(J,"type","number"),o(J,"min","0"),o(J,"max",t[6]),o(J,"class","in-l tr w-full"),o(k,"class","my-1 pr-1 w-1/3"),o(n,"class","flex flex-wrap")},m(_e,ye){M(_e,e,ye),M(_e,l,ye),M(_e,n,ye),s(n,i),s(i,r),s(i,u),s(u,a),a.checked=t[3].i.h.u,s(u,c),s(i,f),s(i,_),s(i,p),le(b,p,null),qe(p,t[3].i.h.p,!0),s(n,v),s(n,d),s(d,S),s(d,y),s(d,$),s(d,N),te(N,t[3].i.a),s(n,E),s(n,B),s(B,P),s(B,L),s(L,O),O.checked=t[3].i.l.i,s(L,F),s(B,x),s(B,H),s(B,z),s(z,G),te(G,t[3].i.l.p),s(n,V),s(n,W),s(W,U),s(W,K),s(K,j),j.checked=t[3].i.r.i,s(K,Y),s(W,X),s(W,oe),s(W,ue),s(ue,ke),te(ke,t[3].i.r.r),s(ue,me),s(ue,$e),te($e,t[3].i.r.g),s(ue,He),s(ue,Re),te(Re,t[3].i.r.b),s(n,je),s(n,we),s(we,Te),s(we,Le),s(we,Me),s(we,w),te(w,t[3].i.t.d),s(n,g),s(n,k),s(k,A),s(k,I),s(k,Q),s(k,J),te(J,t[3].i.t.a),s(n,se),pe&&pe.m(n,null),s(n,ce),Be&&Be.m(n,null),ve=!0,Se||(re=[ee(a,"change",t[75]),ee(p,"change",t[76]),ee(N,"input",t[77]),ee(O,"change",t[78]),ee(G,"input",t[79]),ee(j,"change",t[80]),ee(ke,"input",t[81]),ee($e,"input",t[82]),ee(Re,"input",t[83]),ee(w,"input",t[84]),ee(J,"input",t[85])],Se=!0)},p(_e,ye){ye[0]&8&&(a.checked=_e[3].i.h.u);const vt={};ye[0]&1&&(vt.chip=_e[0].chip),b.$set(vt),ye[0]&8&&qe(p,_e[3].i.h.p),(!ve||ye[0]&64)&&o(N,"max",_e[6]),ye[0]&8&&he(N.value)!==_e[3].i.a&&te(N,_e[3].i.a),ye[0]&8&&(O.checked=_e[3].i.l.i),(!ve||ye[0]&64)&&o(G,"max",_e[6]),ye[0]&8&&he(G.value)!==_e[3].i.l.p&&te(G,_e[3].i.l.p),ye[0]&8&&(j.checked=_e[3].i.r.i),(!ve||ye[0]&64)&&o(ke,"max",_e[6]),ye[0]&8&&he(ke.value)!==_e[3].i.r.r&&te(ke,_e[3].i.r.r),(!ve||ye[0]&64)&&o($e,"max",_e[6]),ye[0]&8&&he($e.value)!==_e[3].i.r.g&&te($e,_e[3].i.r.g),(!ve||ye[0]&64)&&o(Re,"max",_e[6]),ye[0]&8&&he(Re.value)!==_e[3].i.r.b&&te(Re,_e[3].i.r.b),(!ve||ye[0]&64)&&o(w,"max",_e[6]),ye[0]&8&&he(w.value)!==_e[3].i.t.d&&te(w,_e[3].i.t.d),(!ve||ye[0]&64)&&o(J,"max",_e[6]),ye[0]&8&&he(J.value)!==_e[3].i.t.a&&te(J,_e[3].i.t.a),_e[0].chip!="esp8266"?pe?pe.p(_e,ye):(pe=Nf(_e),pe.c(),pe.m(n,ce)):pe&&(pe.d(1),pe=null),_e[3].i.v.p>0?Be?Be.p(_e,ye):(Be=Af(_e),Be.c(),Be.m(n,null)):Be&&(Be.d(1),Be=null)},i(_e){ve||(D(b.$$.fragment,_e),ve=!0)},o(_e){q(b.$$.fragment,_e),ve=!1},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),ne(b),pe&&pe.d(),Be&&Be.d(),Se=!1,ze(re)}}}function Nf(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=T("Vcc"),n=m("br"),i=h(),r=m("input"),o(r,"name","ivp"),o(r,"type","number"),o(r,"min","0"),o(r,"max",t[6]),o(r,"class","in-s tr w-full"),o(e,"class","my-1 pl-1 w-1/3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].i.v.p),u||(a=ee(r,"input",t[86]),u=!0)},p(c,f){f[0]&64&&o(r,"max",c[6]),f[0]&8&&he(r.value)!==c[3].i.v.p&&te(r,c[3].i.v.p)},d(c){c&&C(e),u=!1,a()}}}function Af(t){let e,l,n,i,r,u,a,c,f,_;return{c(){e=m("div"),l=T("Voltage divider"),n=m("br"),i=h(),r=m("div"),u=m("input"),a=h(),c=m("input"),o(u,"name","ivdv"),o(u,"type","number"),o(u,"min","0"),o(u,"max","65535"),o(u,"class","in-f tr w-full"),o(u,"placeholder","VCC"),o(c,"name","ivdg"),o(c,"type","number"),o(c,"min","0"),o(c,"max","65535"),o(c,"class","in-l tr w-full"),o(c,"placeholder","GND"),o(r,"class","flex"),o(e,"class","my-1")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),s(e,r),s(r,u),te(u,t[3].i.v.d.v),s(r,a),s(r,c),te(c,t[3].i.v.d.g),f||(_=[ee(u,"input",t[87]),ee(c,"input",t[88])],f=!0)},p(p,b){b[0]&8&&he(u.value)!==p[3].i.v.d.v&&te(u,p[3].i.v.d.v),b[0]&8&&he(c.value)!==p[3].i.v.d.g&&te(c,p[3].i.v.d.g)},d(p){p&&C(e),f=!1,ze(_)}}}function Pf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N=(t[0].board==2||t[0].board==100)&&Ef(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),r=T("Vcc offset"),u=m("br"),a=h(),c=m("input"),f=h(),_=m("div"),p=T("Multiplier"),b=m("br"),v=h(),d=m("input"),S=h(),N&&N.c(),o(e,"type","hidden"),o(e,"name","iv"),e.value="true",o(c,"name","ivo"),o(c,"type","number"),o(c,"min","0.0"),o(c,"max","3.5"),o(c,"step","0.01"),o(c,"class","in-f tr w-full"),o(i,"class","w-1/3"),o(d,"name","ivm"),o(d,"type","number"),o(d,"min","0.1"),o(d,"max","10"),o(d,"step","0.01"),o(d,"class","in-l tr w-full"),o(_,"class","w-1/3 pr-1"),o(n,"class","my-1 flex flex-wrap")},m(E,B){M(E,e,B),M(E,l,B),M(E,n,B),s(n,i),s(i,r),s(i,u),s(i,a),s(i,c),te(c,t[3].i.v.o),s(n,f),s(n,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].i.v.m),s(n,S),N&&N.m(n,null),y||($=[ee(c,"input",t[89]),ee(d,"input",t[90])],y=!0)},p(E,B){B[0]&8&&he(c.value)!==E[3].i.v.o&&te(c,E[3].i.v.o),B[0]&8&&he(d.value)!==E[3].i.v.m&&te(d,E[3].i.v.m),E[0].board==2||E[0].board==100?N?N.p(E,B):(N=Ef(E),N.c(),N.m(n,null)):N&&(N.d(1),N=null)},d(E){E&&C(e),E&&C(l),E&&C(n),N&&N.d(),y=!1,ze($)}}}function Ef(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=T("Boot limit"),n=m("br"),i=h(),r=m("input"),o(r,"name","ivb"),o(r,"type","number"),o(r,"min","2.5"),o(r,"max","3.5"),o(r,"step","0.1"),o(r,"class","in-s tr w-full"),o(e,"class","w-1/3 pl-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].i.v.b),u||(a=ee(r,"input",t[91]),u=!0)},p(c,f){f[0]&8&&he(r.value)!==c[3].i.v.b&&te(r,c[3].i.v.b)},d(c){c&&C(e),u=!1,a()}}}function Df(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$=t[3].d.t&&If();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),r=m("input"),u=T(" Enable telnet"),a=h(),$&&$.c(),c=h(),f=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",o(e,"class","bd-red"),o(r,"type","checkbox"),o(r,"name","dt"),r.__value="true",r.value=r.__value,o(r,"class","rounded mb-1"),o(n,"class","my-1"),p.__value=1,p.value=p.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,o(_,"name","dl"),o(_,"class","in-s"),t[3].d.l===void 0&&Qe(()=>t[94].call(_)),o(f,"class","my-1")},m(N,E){M(N,e,E),M(N,l,E),M(N,n,E),s(n,i),s(i,r),r.checked=t[3].d.t,s(i,u),M(N,a,E),$&&$.m(N,E),M(N,c,E),M(N,f,E),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),qe(_,t[3].d.l,!0),S||(y=[ee(r,"change",t[93]),ee(_,"change",t[94])],S=!0)},p(N,E){E[0]&8&&(r.checked=N[3].d.t),N[3].d.t?$||($=If(),$.c(),$.m(c.parentNode,c)):$&&($.d(1),$=null),E[0]&8&&qe(_,N[3].d.l)},d(N){N&&C(e),N&&C(l),N&&C(n),N&&C(a),$&&$.d(N),N&&C(c),N&&C(f),S=!1,ze(y)}}}function If(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",o(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function yp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,$e,He,Re,je,we,Te,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re,pe,Be,_e,ye,vt,jl,tl,ct,Tl,pl,jt,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi,Ge,Ae,vl,Ts,El,Lt,Bi,Wl,Nr,ll,Ui,Ar,Ns,Pr,ci,Wt,Er,Dr,Dl,nl,Il,Ir,Hi,Rr,pt,Rl,Lr,ji,dn,vn,hn,bn,Wi,Or,At,zi,Fr,zl,qr,Br,Ur,il,gn,kn,Hr,wn,Gl,jr,Wr,zr,yn,zt,Gr,Gi,Vr,Vl,Kr,Yr,Qr,Cn,Gt,Xr,Vi,Zr,As,Jr,Kl,Ki,Vt,xr,eo,to,Ps,Yi,Kt,lo,no,io,mt,Qi,so,Mn,Sn,ro,mi,oo,Yl,ao,uo,fo,hl,co,Ql,mo,po,_o,bl,vo,$n,Xl,ho,bo,go,Ot,Tn,Nn,An,Pn,ko,Zl,wo,yo,Co,En,Ft,Mo,Xi,So,Zi,Ji,Yt,$o,To,ut,xi,No,Dn,In,Ao,Jl,Po,Eo,Do,Ll,sl,Rn,Ln,Io,Pt,es,ts,Ro,Et,On,ls,ns,Lo,Es,is,ss,Qt,Oo,Fo,pi,qo,Ol,Bo,_i,Xt,Uo,Ho,jo,rs,gl,Wo,Ye,os,zo,Fn,qn,Go,di,Vo,rl,Ko,Ds,Yo,Qo,Bn,kl,Xo,Zt,Zo,Is,xl,Jo,xo,ea,wl,ta,en,la,na,ia,yl,sa,Un,Hn,ra,oa,aa,Cl,ua,jn,fa,ca,ma,bt,Wn,zn,Gn,Vn,Kn,Yn,pa,tn,_a,da,va,Ml,ha,Rs,Ls,Os,Fs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),qs,ol,as,ba,Qn,Xn,ga,vi,ka,hi,wa,Bs,Dt,us,ya,Zn,Jn,Ca,bi,Ma,fs,cs,Jt,Sa,$a,Ta,Fl,Us,xn,Na,ms,ei,Aa,ps,Hs,ln,js,nn,Ws,sn,zs,rn,qt,Gs,Pa;a=new Ut({}),F=new Jm({});let e0=["NOK","SEK","DKK","EUR","CHF"],gi=[];for(let R=0;R<5;R+=1)gi[R]=ap(op(t,e0,R));let gt=t[3].p.e&&t[0].chip!="esp8266"&&ff(t),kt=t[3].g.s>0&&cf(t);Lt=new Ut({});let t0=[24,48,96,192,384,576,1152],ki=[];for(let R=0;R<7;R+=1)ki[R]=up(rp(t,t0,R));let wt=t[3].m.e.e&&mf(t),yt=t[3].m.e.e&&pf(t),Ct=t[3].m.m.e&&_f(t);Sn=new Ut({}),In=new Ut({}),On=new Jc({});let Mt=t[3].n.m=="static"&&df(t);qn=new Ut({});let St=t[0].chip!="esp8266"&&vf(t),lt=t[3].q.s.e&&hf(t),nt=t[3].q.m==3&&bf(t),it=t[3].q.m==4&&gf(t),st=t[3].c.es!=null&&kf(t),rt=Fs&&Cf(t);Xn=new Ut({});let ti=t[7],_t=[];for(let R=0;R20||t[0].chip=="esp8266")&&$f(t);Jn=new Ut({});let $t=t[3].d.s&&Df(t);return ln=new It({props:{active:t[1],message:"Loading configuration"}}),nn=new It({props:{active:t[2],message:"Saving configuration"}}),sn=new It({props:{active:t[4],message:"Performing factory reset"}}),rn=new It({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",r=h(),u=m("a"),ie(a.$$.fragment),c=h(),f=m("input"),_=h(),p=m("div"),b=m("div"),v=m("div"),d=T("Hostname"),S=m("br"),y=h(),$=m("input"),N=h(),E=m("div"),B=T("Time zone"),P=m("br"),L=h(),O=m("select"),ie(F.$$.fragment),x=h(),H=m("input"),z=h(),G=m("div"),V=m("div"),W=m("div"),U=T("Price region"),K=m("br"),j=h(),Y=m("select"),X=m("optgroup"),oe=m("option"),oe.textContent="NO1",ue=m("option"),ue.textContent="NO2",ke=m("option"),ke.textContent="NO3",me=m("option"),me.textContent="NO4",$e=m("option"),$e.textContent="NO5",He=m("optgroup"),Re=m("option"),Re.textContent="SE1",je=m("option"),je.textContent="SE2",we=m("option"),we.textContent="SE3",Te=m("option"),Te.textContent="SE4",Le=m("optgroup"),Me=m("option"),Me.textContent="DK1",w=m("option"),w.textContent="DK2",g=m("option"),g.textContent="Austria",k=m("option"),k.textContent="Belgium",A=m("option"),A.textContent="Czech Republic",I=m("option"),I.textContent="Estonia",Q=m("option"),Q.textContent="Finland",J=m("option"),J.textContent="France",se=m("option"),se.textContent="Germany",ce=m("option"),ce.textContent="Great Britain",ve=m("option"),ve.textContent="Latvia",Se=m("option"),Se.textContent="Lithuania",re=m("option"),re.textContent="Netherland",pe=m("option"),pe.textContent="Poland",Be=m("option"),Be.textContent="Switzerland",_e=h(),ye=m("div"),vt=T("Currency"),jl=m("br"),tl=h(),ct=m("select");for(let R=0;R<5;R+=1)gi[R].c();Tl=h(),pl=m("div"),jt=m("div"),ht=m("div"),Xe=T("Fixed price"),Ze=m("br"),Je=h(),Ue=m("input"),xe=h(),We=m("div"),et=T("Multiplier"),tt=m("br"),de=h(),Ce=m("input"),Ei=h(),_l=m("div"),_n=m("label"),Tt=m("input"),Di=T(" Enable price fetch from remote server"),Ii=h(),gt&>.c(),Ri=h(),dl=m("div"),Li=T("Security"),Oi=m("br"),Fi=h(),Nt=m("select"),Nl=m("option"),Nl.textContent="None",Al=m("option"),Al.textContent="Only configuration",Pl=m("option"),Pl.textContent="Everything",qi=h(),kt&&kt.c(),Ge=h(),Ae=m("div"),vl=m("strong"),vl.textContent="Meter",Ts=h(),El=m("a"),ie(Lt.$$.fragment),Bi=h(),Wl=m("input"),Nr=h(),ll=m("div"),Ui=m("span"),Ui.textContent="Buffer size",Ar=h(),Ns=m("span"),Ns.textContent="Serial conf.",Pr=h(),ci=m("label"),Wt=m("input"),Er=T(" inverted"),Dr=h(),Dl=m("div"),nl=m("select"),Il=m("option"),Ir=T("Autodetect");for(let R=0;R<7;R+=1)ki[R].c();Rr=h(),pt=m("select"),Rl=m("option"),Lr=T("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Or=h(),At=m("input"),Fr=h(),zl=m("div"),qr=T("Voltage"),Br=m("br"),Ur=h(),il=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Hr=h(),wn=m("div"),Gl=m("div"),jr=T("Main fuse"),Wr=m("br"),zr=h(),yn=m("label"),zt=m("input"),Gr=h(),Gi=m("span"),Gi.textContent="A",Vr=h(),Vl=m("div"),Kr=T("Production"),Yr=m("br"),Qr=h(),Cn=m("label"),Gt=m("input"),Xr=h(),Vi=m("span"),Vi.textContent="kWp",Zr=h(),As=m("div"),Jr=h(),Kl=m("div"),Ki=m("label"),Vt=m("input"),xr=T(" Meter is encrypted"),eo=h(),wt&&wt.c(),to=h(),yt&&yt.c(),Ps=h(),Yi=m("label"),Kt=m("input"),lo=T(" Multipliers"),no=h(),Ct&&Ct.c(),io=h(),mt=m("div"),Qi=m("strong"),Qi.textContent="WiFi",so=h(),Mn=m("a"),ie(Sn.$$.fragment),ro=h(),mi=m("input"),oo=h(),Yl=m("div"),ao=T("SSID"),uo=m("br"),fo=h(),hl=m("input"),co=h(),Ql=m("div"),mo=T("Password"),po=m("br"),_o=h(),bl=m("input"),vo=h(),$n=m("div"),Xl=m("div"),ho=T("Power saving"),bo=m("br"),go=h(),Ot=m("select"),Tn=m("option"),Tn.textContent="Default",Nn=m("option"),Nn.textContent="Off",An=m("option"),An.textContent="Minimum",Pn=m("option"),Pn.textContent="Maximum",ko=h(),Zl=m("div"),wo=T("Power"),yo=m("br"),Co=h(),En=m("div"),Ft=m("input"),Mo=h(),Xi=m("span"),Xi.textContent="dBm",So=h(),Zi=m("div"),Ji=m("label"),Yt=m("input"),$o=T(" Allow 802.11b legacy rates"),To=h(),ut=m("div"),xi=m("strong"),xi.textContent="Network",No=h(),Dn=m("a"),ie(In.$$.fragment),Ao=h(),Jl=m("div"),Po=T("IP"),Eo=m("br"),Do=h(),Ll=m("div"),sl=m("select"),Rn=m("option"),Rn.textContent="DHCP",Ln=m("option"),Ln.textContent="Static",Io=h(),Pt=m("input"),Ro=h(),Et=m("select"),ie(On.$$.fragment),Lo=h(),Mt&&Mt.c(),Es=h(),is=m("div"),ss=m("label"),Qt=m("input"),Oo=T(" enable mDNS"),Fo=h(),pi=m("input"),qo=h(),Ol=m("div"),Bo=T("NTP "),_i=m("label"),Xt=m("input"),Uo=T(" obtain from DHCP"),Ho=m("br"),jo=h(),rs=m("div"),gl=m("input"),Wo=h(),Ye=m("div"),os=m("strong"),os.textContent="MQTT",zo=h(),Fn=m("a"),ie(qn.$$.fragment),Go=h(),di=m("input"),Vo=h(),rl=m("div"),Ko=T(`Server - `),St&&St.c(),Ds=h(),Yo=m("br"),Qo=h(),Bn=m("div"),kl=m("input"),Xo=h(),Zt=m("input"),Zo=h(),lt&<.c(),Is=h(),xl=m("div"),Jo=T("Username"),xo=m("br"),ea=h(),wl=m("input"),ta=h(),en=m("div"),la=T("Password"),na=m("br"),ia=h(),yl=m("input"),sa=h(),Un=m("div"),Hn=m("div"),ra=T("Client ID"),oa=m("br"),aa=h(),Cl=m("input"),ua=h(),jn=m("div"),fa=T("Payload"),ca=m("br"),ma=h(),bt=m("select"),Wn=m("option"),Wn.textContent="JSON",zn=m("option"),zn.textContent="Raw (minimal)",Gn=m("option"),Gn.textContent="Raw (full)",Vn=m("option"),Vn.textContent="Domoticz",Kn=m("option"),Kn.textContent="HomeAssistant",Yn=m("option"),Yn.textContent="HEX dump",pa=h(),tn=m("div"),_a=T("Publish topic"),da=m("br"),va=h(),Ml=m("input"),ha=h(),nt&&nt.c(),Rs=h(),it&&it.c(),Ls=h(),st&&st.c(),Os=h(),rt&&rt.c(),qs=h(),ol=m("div"),as=m("strong"),as.textContent="User interface",ba=h(),Qn=m("a"),ie(Xn.$$.fragment),ga=h(),vi=m("input"),ka=h(),hi=m("div");for(let R=0;R<_t.length;R+=1)_t[R].c();wa=h(),ot&&ot.c(),Bs=h(),Dt=m("div"),us=m("strong"),us.textContent="Debugging",ya=h(),Zn=m("a"),ie(Jn.$$.fragment),Ca=h(),bi=m("input"),Ma=h(),fs=m("div"),cs=m("label"),Jt=m("input"),Sa=T(" Enable debugging"),$a=h(),$t&&$t.c(),Ta=h(),Fl=m("div"),Us=m("div"),xn=m("button"),xn.textContent="Factory reset",Na=h(),ms=m("div"),ei=m("button"),ei.textContent="Reboot",Aa=h(),ps=m("div"),ps.innerHTML='',Hs=h(),ie(ln.$$.fragment),js=h(),ie(nn.$$.fragment),Ws=h(),ie(sn.$$.fragment),zs=h(),ie(rn.$$.fragment),o(i,"class","text-sm"),o(u,"href",Ht("General-configuration")),o(u,"target","_blank"),o(u,"class","float-right"),o(f,"type","hidden"),o(f,"name","g"),f.value="true",o($,"name","gh"),o($,"type","text"),o($,"class","in-f w-full"),o($,"pattern","[A-Za-z0-9-]+"),o(O,"name","gt"),o(O,"class","in-l w-full"),t[3].g.t===void 0&&Qe(()=>t[16].call(O)),o(b,"class","flex"),o(p,"class","my-1"),o(H,"type","hidden"),o(H,"name","p"),H.value="true",oe.__value="10YNO-1--------2",oe.value=oe.__value,ue.__value="10YNO-2--------T",ue.value=ue.__value,ke.__value="10YNO-3--------J",ke.value=ke.__value,me.__value="10YNO-4--------9",me.value=me.__value,$e.__value="10Y1001A1001A48H",$e.value=$e.__value,o(X,"label","Norway"),Re.__value="10Y1001A1001A44P",Re.value=Re.__value,je.__value="10Y1001A1001A45N",je.value=je.__value,we.__value="10Y1001A1001A46L",we.value=we.__value,Te.__value="10Y1001A1001A47J",Te.value=Te.__value,o(He,"label","Sweden"),Me.__value="10YDK-1--------W",Me.value=Me.__value,w.__value="10YDK-2--------M",w.value=w.__value,o(Le,"label","Denmark"),g.__value="10YAT-APG------L",g.value=g.__value,k.__value="10YBE----------2",k.value=k.__value,A.__value="10YCZ-CEPS-----N",A.value=A.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,Q.__value="10YFI-1--------U",Q.value=Q.__value,J.__value="10YFR-RTE------C",J.value=J.__value,se.__value="10Y1001A1001A83F",se.value=se.__value,ce.__value="10YGB----------A",ce.value=ce.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,Se.__value="10YLT-1001A0008Q",Se.value=Se.__value,re.__value="10YNL----------L",re.value=re.__value,pe.__value="10YPL-AREA-----S",pe.value=pe.__value,Be.__value="10YCH-SWISSGRIDZ",Be.value=Be.__value,o(Y,"name","pr"),o(Y,"class","in-f w-full"),t[3].p.r===void 0&&Qe(()=>t[17].call(Y)),o(W,"class","w-full"),o(ct,"name","pc"),o(ct,"class","in-l"),t[3].p.c===void 0&&Qe(()=>t[18].call(ct)),o(V,"class","flex"),o(G,"class","my-1"),o(Ue,"name","pf"),o(Ue,"type","number"),o(Ue,"min","0.001"),o(Ue,"max","65"),o(Ue,"step","0.001"),o(Ue,"class","in-f tr w-full"),o(ht,"class","w-1/2"),o(Ce,"name","pm"),o(Ce,"type","number"),o(Ce,"min","0.001"),o(Ce,"max","1000"),o(Ce,"step","0.001"),o(Ce,"class","in-l tr w-full"),o(We,"class","w-1/2"),o(jt,"class","flex"),o(pl,"class","my-1"),o(Tt,"type","checkbox"),o(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,o(Tt,"class","rounded mb-1"),o(_l,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,Al.__value=1,Al.value=Al.__value,Pl.__value=2,Pl.value=Pl.__value,o(Nt,"name","gs"),o(Nt,"class","in-s"),t[3].g.s===void 0&&Qe(()=>t[23].call(Nt)),o(dl,"class","my-1"),o(n,"class","cnt"),o(vl,"class","text-sm"),o(El,"href",Ht("Meter-configuration")),o(El,"target","_blank"),o(El,"class","float-right"),o(Wl,"type","hidden"),o(Wl,"name","m"),Wl.value="true",o(Ui,"class","float-right"),o(Wt,"name","mi"),Wt.__value="true",Wt.value=Wt.__value,o(Wt,"type","checkbox"),o(Wt,"class","rounded mb-1"),o(ci,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=Hi=t[3].m.b!=0,o(nl,"name","mb"),o(nl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Qe(()=>t[27].call(nl)),Rl.__value=0,Rl.value=Rl.__value,Rl.disabled=ji=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,o(pt,"name","mp"),o(pt,"class","in-m"),pt.disabled=Wi=t[3].m.b==0,t[3].m.p===void 0&&Qe(()=>t[28].call(pt)),o(At,"name","ms"),o(At,"type","number"),o(At,"min",64),o(At,"max",zi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),o(At,"step",64),o(At,"class","in-l tr w-1/2"),o(Dl,"class","flex w-full"),o(ll,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,o(il,"name","md"),o(il,"class","in-s"),t[3].m.d===void 0&&Qe(()=>t[30].call(il)),o(zl,"class","my-1"),o(zt,"name","mf"),o(zt,"type","number"),o(zt,"min","5"),o(zt,"max","65535"),o(zt,"class","in-f tr w-full"),o(Gi,"class","in-post"),o(yn,"class","flex"),o(Gl,"class","mx-1"),o(Gt,"name","mr"),o(Gt,"type","number"),o(Gt,"min","0"),o(Gt,"max","65535"),o(Gt,"class","in-f tr w-full"),o(Vi,"class","in-post"),o(Cn,"class","flex"),o(Vl,"class","mx-1"),o(wn,"class","my-1 flex"),o(As,"class","my-1"),o(Vt,"type","checkbox"),o(Vt,"name","me"),Vt.__value="true",Vt.value=Vt.__value,o(Vt,"class","rounded mb-1"),o(Kl,"class","my-1"),o(Kt,"type","checkbox"),o(Kt,"name","mm"),Kt.__value="true",Kt.value=Kt.__value,o(Kt,"class","rounded mb-1"),o(Ae,"class","cnt"),o(Qi,"class","text-sm"),o(Mn,"href",Ht("WiFi-configuration")),o(Mn,"target","_blank"),o(Mn,"class","float-right"),o(mi,"type","hidden"),o(mi,"name","w"),mi.value="true",o(hl,"name","ws"),o(hl,"type","text"),o(hl,"class","in-s"),o(Yl,"class","my-1"),o(bl,"name","wp"),o(bl,"type","password"),o(bl,"class","in-s"),o(Ql,"class","my-1"),Tn.__value=255,Tn.value=Tn.__value,Nn.__value=0,Nn.value=Nn.__value,An.__value=1,An.value=An.__value,Pn.__value=2,Pn.value=Pn.__value,o(Ot,"name","wz"),o(Ot,"class","in-s"),t[3].w.z===void 0&&Qe(()=>t[43].call(Ot)),o(Xl,"class","w-1/2"),o(Ft,"name","ww"),o(Ft,"type","number"),o(Ft,"min","0"),o(Ft,"max","20.5"),o(Ft,"step","0.5"),o(Ft,"class","in-f tr w-full"),o(Xi,"class","in-post"),o(En,"class","flex"),o(Zl,"class","ml-2 w-1/2"),o($n,"class","my-1 flex"),o(Yt,"type","checkbox"),o(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,o(Yt,"class","rounded mb-1"),o(Zi,"class","my-3"),o(mt,"class","cnt"),o(xi,"class","text-sm"),o(Dn,"href",Ht("Network-configuration")),o(Dn,"target","_blank"),o(Dn,"class","float-right"),Rn.__value="dhcp",Rn.value=Rn.__value,Ln.__value="static",Ln.value=Ln.__value,o(sl,"name","nm"),o(sl,"class","in-f"),t[3].n.m===void 0&&Qe(()=>t[46].call(sl)),o(Pt,"name","ni"),o(Pt,"type","text"),o(Pt,"class","in-m w-full"),Pt.disabled=es=t[3].n.m=="dhcp",Pt.required=ts=t[3].n.m=="static",o(Et,"name","ns"),o(Et,"class","in-l"),Et.disabled=ls=t[3].n.m=="dhcp",Et.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&Qe(()=>t[48].call(Et)),o(Ll,"class","flex"),o(Jl,"class","my-1"),o(Qt,"name","nd"),Qt.__value="true",Qt.value=Qt.__value,o(Qt,"type","checkbox"),o(Qt,"class","rounded mb-1"),o(is,"class","my-1"),o(pi,"type","hidden"),o(pi,"name","ntp"),pi.value="true",o(Xt,"name","ntpd"),Xt.__value="true",Xt.value=Xt.__value,o(Xt,"type","checkbox"),o(Xt,"class","rounded mb-1"),o(_i,"class","ml-4"),o(gl,"name","ntph"),o(gl,"type","text"),o(gl,"class","in-s"),o(rs,"class","flex"),o(Ol,"class","my-1"),o(ut,"class","cnt"),o(os,"class","text-sm"),o(Fn,"href",Ht("MQTT-configuration")),o(Fn,"target","_blank"),o(Fn,"class","float-right"),o(di,"type","hidden"),o(di,"name","q"),di.value="true",o(kl,"name","qh"),o(kl,"type","text"),o(kl,"class","in-f w-3/4"),o(Zt,"name","qp"),o(Zt,"type","number"),o(Zt,"min","1024"),o(Zt,"max","65535"),o(Zt,"class","in-l tr w-1/4"),o(Bn,"class","flex"),o(rl,"class","my-1"),o(wl,"name","qu"),o(wl,"type","text"),o(wl,"class","in-s"),o(xl,"class","my-1"),o(yl,"name","qa"),o(yl,"type","password"),o(yl,"class","in-s"),o(en,"class","my-1"),o(Cl,"name","qc"),o(Cl,"type","text"),o(Cl,"class","in-f w-full"),Wn.__value=0,Wn.value=Wn.__value,zn.__value=1,zn.value=zn.__value,Gn.__value=2,Gn.value=Gn.__value,Vn.__value=3,Vn.value=Vn.__value,Kn.__value=4,Kn.value=Kn.__value,Yn.__value=255,Yn.value=Yn.__value,o(bt,"name","qm"),o(bt,"class","in-l"),t[3].q.m===void 0&&Qe(()=>t[61].call(bt)),o(Un,"class","my-1 flex"),o(Ml,"name","qb"),o(Ml,"type","text"),o(Ml,"class","in-s"),o(tn,"class","my-1"),o(Ye,"class","cnt"),o(as,"class","text-sm"),o(Qn,"href",Ht("User-interface")),o(Qn,"target","_blank"),o(Qn,"class","float-right"),o(vi,"type","hidden"),o(vi,"name","u"),vi.value="true",o(hi,"class","flex flex-wrap"),o(ol,"class","cnt"),o(us,"class","text-sm"),o(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),o(Zn,"target","_blank"),o(Zn,"class","float-right"),o(bi,"type","hidden"),o(bi,"name","d"),bi.value="true",o(Jt,"type","checkbox"),o(Jt,"name","ds"),Jt.__value="true",Jt.value=Jt.__value,o(Jt,"class","rounded mb-1"),o(fs,"class","mt-3"),o(Dt,"class","cnt"),o(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),o(xn,"type","button"),o(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),o(ei,"type","button"),o(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),o(ms,"class","text-center"),o(ps,"class","text-right"),o(Fl,"class","grid grid-cols-3"),o(e,"autocomplete","off")},m(R,ae){M(R,e,ae),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),le(a,u,null),s(n,c),s(n,f),s(n,_),s(n,p),s(p,b),s(b,v),s(v,d),s(v,S),s(v,y),s(v,$),te($,t[3].g.h),s(b,N),s(b,E),s(E,B),s(E,P),s(E,L),s(E,O),le(F,O,null),qe(O,t[3].g.t,!0),s(n,x),s(n,H),s(n,z),s(n,G),s(G,V),s(V,W),s(W,U),s(W,K),s(W,j),s(W,Y),s(Y,X),s(X,oe),s(X,ue),s(X,ke),s(X,me),s(X,$e),s(Y,He),s(He,Re),s(He,je),s(He,we),s(He,Te),s(Y,Le),s(Le,Me),s(Le,w),s(Y,g),s(Y,k),s(Y,A),s(Y,I),s(Y,Q),s(Y,J),s(Y,se),s(Y,ce),s(Y,ve),s(Y,Se),s(Y,re),s(Y,pe),s(Y,Be),qe(Y,t[3].p.r,!0),s(V,_e),s(V,ye),s(ye,vt),s(ye,jl),s(ye,tl),s(ye,ct);for(let ft=0;ft<5;ft+=1)gi[ft]&&gi[ft].m(ct,null);qe(ct,t[3].p.c,!0),s(n,Tl),s(n,pl),s(pl,jt),s(jt,ht),s(ht,Xe),s(ht,Ze),s(ht,Je),s(ht,Ue),te(Ue,t[3].p.f),s(jt,xe),s(jt,We),s(We,et),s(We,tt),s(We,de),s(We,Ce),te(Ce,t[3].p.m),s(n,Ei),s(n,_l),s(_l,_n),s(_n,Tt),Tt.checked=t[3].p.e,s(_n,Di),s(_l,Ii),gt&>.m(_l,null),s(n,Ri),s(n,dl),s(dl,Li),s(dl,Oi),s(dl,Fi),s(dl,Nt),s(Nt,Nl),s(Nt,Al),s(Nt,Pl),qe(Nt,t[3].g.s,!0),s(n,qi),kt&&kt.m(n,null),s(l,Ge),s(l,Ae),s(Ae,vl),s(Ae,Ts),s(Ae,El),le(Lt,El,null),s(Ae,Bi),s(Ae,Wl),s(Ae,Nr),s(Ae,ll),s(ll,Ui),s(ll,Ar),s(ll,Ns),s(ll,Pr),s(ll,ci),s(ci,Wt),Wt.checked=t[3].m.i,s(ci,Er),s(ll,Dr),s(ll,Dl),s(Dl,nl),s(nl,Il),s(Il,Ir);for(let ft=0;ft<7;ft+=1)ki[ft]&&ki[ft].m(nl,null);qe(nl,t[3].m.b,!0),s(Dl,Rr),s(Dl,pt),s(pt,Rl),s(Rl,Lr),s(pt,dn),s(pt,vn),s(pt,hn),s(pt,bn),qe(pt,t[3].m.p,!0),s(Dl,Or),s(Dl,At),te(At,t[3].m.s),s(Ae,Fr),s(Ae,zl),s(zl,qr),s(zl,Br),s(zl,Ur),s(zl,il),s(il,gn),s(il,kn),qe(il,t[3].m.d,!0),s(Ae,Hr),s(Ae,wn),s(wn,Gl),s(Gl,jr),s(Gl,Wr),s(Gl,zr),s(Gl,yn),s(yn,zt),te(zt,t[3].m.f),s(yn,Gr),s(yn,Gi),s(wn,Vr),s(wn,Vl),s(Vl,Kr),s(Vl,Yr),s(Vl,Qr),s(Vl,Cn),s(Cn,Gt),te(Gt,t[3].m.r),s(Cn,Xr),s(Cn,Vi),s(Ae,Zr),s(Ae,As),s(Ae,Jr),s(Ae,Kl),s(Kl,Ki),s(Ki,Vt),Vt.checked=t[3].m.e.e,s(Ki,xr),s(Kl,eo),wt&&wt.m(Kl,null),s(Ae,to),yt&&yt.m(Ae,null),s(Ae,Ps),s(Ae,Yi),s(Yi,Kt),Kt.checked=t[3].m.m.e,s(Yi,lo),s(Ae,no),Ct&&Ct.m(Ae,null),s(l,io),s(l,mt),s(mt,Qi),s(mt,so),s(mt,Mn),le(Sn,Mn,null),s(mt,ro),s(mt,mi),s(mt,oo),s(mt,Yl),s(Yl,ao),s(Yl,uo),s(Yl,fo),s(Yl,hl),te(hl,t[3].w.s),s(mt,co),s(mt,Ql),s(Ql,mo),s(Ql,po),s(Ql,_o),s(Ql,bl),te(bl,t[3].w.p),s(mt,vo),s(mt,$n),s($n,Xl),s(Xl,ho),s(Xl,bo),s(Xl,go),s(Xl,Ot),s(Ot,Tn),s(Ot,Nn),s(Ot,An),s(Ot,Pn),qe(Ot,t[3].w.z,!0),s($n,ko),s($n,Zl),s(Zl,wo),s(Zl,yo),s(Zl,Co),s(Zl,En),s(En,Ft),te(Ft,t[3].w.w),s(En,Mo),s(En,Xi),s(mt,So),s(mt,Zi),s(Zi,Ji),s(Ji,Yt),Yt.checked=t[3].w.b,s(Ji,$o),s(l,To),s(l,ut),s(ut,xi),s(ut,No),s(ut,Dn),le(In,Dn,null),s(ut,Ao),s(ut,Jl),s(Jl,Po),s(Jl,Eo),s(Jl,Do),s(Jl,Ll),s(Ll,sl),s(sl,Rn),s(sl,Ln),qe(sl,t[3].n.m,!0),s(Ll,Io),s(Ll,Pt),te(Pt,t[3].n.i),s(Ll,Ro),s(Ll,Et),le(On,Et,null),qe(Et,t[3].n.s,!0),s(ut,Lo),Mt&&Mt.m(ut,null),s(ut,Es),s(ut,is),s(is,ss),s(ss,Qt),Qt.checked=t[3].n.d,s(ss,Oo),s(ut,Fo),s(ut,pi),s(ut,qo),s(ut,Ol),s(Ol,Bo),s(Ol,_i),s(_i,Xt),Xt.checked=t[3].n.h,s(_i,Uo),s(Ol,Ho),s(Ol,jo),s(Ol,rs),s(rs,gl),te(gl,t[3].n.n1),s(l,Wo),s(l,Ye),s(Ye,os),s(Ye,zo),s(Ye,Fn),le(qn,Fn,null),s(Ye,Go),s(Ye,di),s(Ye,Vo),s(Ye,rl),s(rl,Ko),St&&St.m(rl,null),s(rl,Ds),s(rl,Yo),s(rl,Qo),s(rl,Bn),s(Bn,kl),te(kl,t[3].q.h),s(Bn,Xo),s(Bn,Zt),te(Zt,t[3].q.p),s(Ye,Zo),lt&<.m(Ye,null),s(Ye,Is),s(Ye,xl),s(xl,Jo),s(xl,xo),s(xl,ea),s(xl,wl),te(wl,t[3].q.u),s(Ye,ta),s(Ye,en),s(en,la),s(en,na),s(en,ia),s(en,yl),te(yl,t[3].q.a),s(Ye,sa),s(Ye,Un),s(Un,Hn),s(Hn,ra),s(Hn,oa),s(Hn,aa),s(Hn,Cl),te(Cl,t[3].q.c),s(Un,ua),s(Un,jn),s(jn,fa),s(jn,ca),s(jn,ma),s(jn,bt),s(bt,Wn),s(bt,zn),s(bt,Gn),s(bt,Vn),s(bt,Kn),s(bt,Yn),qe(bt,t[3].q.m,!0),s(Ye,pa),s(Ye,tn),s(tn,_a),s(tn,da),s(tn,va),s(tn,Ml),te(Ml,t[3].q.b),s(l,ha),nt&&nt.m(l,null),s(l,Rs),it&&it.m(l,null),s(l,Ls),st&&st.m(l,null),s(l,Os),rt&&rt.m(l,null),s(l,qs),s(l,ol),s(ol,as),s(ol,ba),s(ol,Qn),le(Xn,Qn,null),s(ol,ga),s(ol,vi),s(ol,ka),s(ol,hi);for(let ft=0;ft<_t.length;ft+=1)_t[ft]&&_t[ft].m(hi,null);s(l,wa),ot&&ot.m(l,null),s(l,Bs),s(l,Dt),s(Dt,us),s(Dt,ya),s(Dt,Zn),le(Jn,Zn,null),s(Dt,Ca),s(Dt,bi),s(Dt,Ma),s(Dt,fs),s(fs,cs),s(cs,Jt),Jt.checked=t[3].d.s,s(cs,Sa),s(Dt,$a),$t&&$t.m(Dt,null),s(e,Ta),s(e,Fl),s(Fl,Us),s(Us,xn),s(Fl,Na),s(Fl,ms),s(ms,ei),s(Fl,Aa),s(Fl,ps),M(R,Hs,ae),le(ln,R,ae),M(R,js,ae),le(nn,R,ae),M(R,Ws,ae),le(sn,R,ae),M(R,zs,ae),le(rn,R,ae),qt=!0,Gs||(Pa=[ee($,"input",t[15]),ee(O,"change",t[16]),ee(Y,"change",t[17]),ee(ct,"change",t[18]),ee(Ue,"input",t[19]),ee(Ce,"input",t[20]),ee(Tt,"change",t[21]),ee(Nt,"change",t[23]),ee(Wt,"change",t[26]),ee(nl,"change",t[27]),ee(pt,"change",t[28]),ee(At,"input",t[29]),ee(il,"change",t[30]),ee(zt,"input",t[31]),ee(Gt,"input",t[32]),ee(Vt,"change",t[33]),ee(Kt,"change",t[36]),ee(hl,"input",t[41]),ee(bl,"input",t[42]),ee(Ot,"change",t[43]),ee(Ft,"input",t[44]),ee(Yt,"change",t[45]),ee(sl,"change",t[46]),ee(Pt,"input",t[47]),ee(Et,"change",t[48]),ee(Qt,"change",t[52]),ee(Xt,"change",t[53]),ee(gl,"input",t[54]),ee(kl,"input",t[56]),ee(Zt,"input",t[57]),ee(wl,"input",t[58]),ee(yl,"input",t[59]),ee(Cl,"input",t[60]),ee(bt,"change",t[61]),ee(Ml,"input",t[62]),ee(Jt,"change",t[92]),ee(xn,"click",t[8]),ee(ei,"click",t[10]),ee(e,"submit",Ss(t[9]))],Gs=!0)},p(R,ae){if(ae[0]&8&&$.value!==R[3].g.h&&te($,R[3].g.h),ae[0]&8&&qe(O,R[3].g.t),ae[0]&8&&qe(Y,R[3].p.r),ae[0]&8&&qe(ct,R[3].p.c),ae[0]&8&&he(Ue.value)!==R[3].p.f&&te(Ue,R[3].p.f),ae[0]&8&&he(Ce.value)!==R[3].p.m&&te(Ce,R[3].p.m),ae[0]&8&&(Tt.checked=R[3].p.e),R[3].p.e&&R[0].chip!="esp8266"?gt?gt.p(R,ae):(gt=ff(R),gt.c(),gt.m(_l,null)):gt&&(gt.d(1),gt=null),ae[0]&8&&qe(Nt,R[3].g.s),R[3].g.s>0?kt?kt.p(R,ae):(kt=cf(R),kt.c(),kt.m(n,null)):kt&&(kt.d(1),kt=null),ae[0]&8&&(Wt.checked=R[3].m.i),(!qt||ae[0]&8&&Hi!==(Hi=R[3].m.b!=0))&&(Il.disabled=Hi),ae[0]&8&&qe(nl,R[3].m.b),(!qt||ae[0]&8&&ji!==(ji=R[3].m.b!=0))&&(Rl.disabled=ji),(!qt||ae[0]&8&&Wi!==(Wi=R[3].m.b==0))&&(pt.disabled=Wi),ae[0]&8&&qe(pt,R[3].m.p),(!qt||ae[0]&9&&zi!==(zi=R[0].chip=="esp8266"?R[3].i.h.p==3||R[3].i.h.p==113?512:128:4096))&&o(At,"max",zi),ae[0]&8&&he(At.value)!==R[3].m.s&&te(At,R[3].m.s),ae[0]&8&&qe(il,R[3].m.d),ae[0]&8&&he(zt.value)!==R[3].m.f&&te(zt,R[3].m.f),ae[0]&8&&he(Gt.value)!==R[3].m.r&&te(Gt,R[3].m.r),ae[0]&8&&(Vt.checked=R[3].m.e.e),R[3].m.e.e?wt?wt.p(R,ae):(wt=mf(R),wt.c(),wt.m(Kl,null)):wt&&(wt.d(1),wt=null),R[3].m.e.e?yt?yt.p(R,ae):(yt=pf(R),yt.c(),yt.m(Ae,Ps)):yt&&(yt.d(1),yt=null),ae[0]&8&&(Kt.checked=R[3].m.m.e),R[3].m.m.e?Ct?Ct.p(R,ae):(Ct=_f(R),Ct.c(),Ct.m(Ae,null)):Ct&&(Ct.d(1),Ct=null),ae[0]&8&&hl.value!==R[3].w.s&&te(hl,R[3].w.s),ae[0]&8&&bl.value!==R[3].w.p&&te(bl,R[3].w.p),ae[0]&8&&qe(Ot,R[3].w.z),ae[0]&8&&he(Ft.value)!==R[3].w.w&&te(Ft,R[3].w.w),ae[0]&8&&(Yt.checked=R[3].w.b),ae[0]&8&&qe(sl,R[3].n.m),(!qt||ae[0]&8&&es!==(es=R[3].n.m=="dhcp"))&&(Pt.disabled=es),(!qt||ae[0]&8&&ts!==(ts=R[3].n.m=="static"))&&(Pt.required=ts),ae[0]&8&&Pt.value!==R[3].n.i&&te(Pt,R[3].n.i),(!qt||ae[0]&8&&ls!==(ls=R[3].n.m=="dhcp"))&&(Et.disabled=ls),(!qt||ae[0]&8&&ns!==(ns=R[3].n.m=="static"))&&(Et.required=ns),ae[0]&8&&qe(Et,R[3].n.s),R[3].n.m=="static"?Mt?Mt.p(R,ae):(Mt=df(R),Mt.c(),Mt.m(ut,Es)):Mt&&(Mt.d(1),Mt=null),ae[0]&8&&(Qt.checked=R[3].n.d),ae[0]&8&&(Xt.checked=R[3].n.h),ae[0]&8&&gl.value!==R[3].n.n1&&te(gl,R[3].n.n1),R[0].chip!="esp8266"?St?St.p(R,ae):(St=vf(R),St.c(),St.m(rl,Ds)):St&&(St.d(1),St=null),ae[0]&8&&kl.value!==R[3].q.h&&te(kl,R[3].q.h),ae[0]&8&&he(Zt.value)!==R[3].q.p&&te(Zt,R[3].q.p),R[3].q.s.e?lt?(lt.p(R,ae),ae[0]&8&&D(lt,1)):(lt=hf(R),lt.c(),D(lt,1),lt.m(Ye,Is)):lt&&(De(),q(lt,1,1,()=>{lt=null}),Ie()),ae[0]&8&&wl.value!==R[3].q.u&&te(wl,R[3].q.u),ae[0]&8&&yl.value!==R[3].q.a&&te(yl,R[3].q.a),ae[0]&8&&Cl.value!==R[3].q.c&&te(Cl,R[3].q.c),ae[0]&8&&qe(bt,R[3].q.m),ae[0]&8&&Ml.value!==R[3].q.b&&te(Ml,R[3].q.b),R[3].q.m==3?nt?(nt.p(R,ae),ae[0]&8&&D(nt,1)):(nt=bf(R),nt.c(),D(nt,1),nt.m(l,Rs)):nt&&(De(),q(nt,1,1,()=>{nt=null}),Ie()),R[3].q.m==4?it?(it.p(R,ae),ae[0]&8&&D(it,1)):(it=gf(R),it.c(),D(it,1),it.m(l,Ls)):it&&(De(),q(it,1,1,()=>{it=null}),Ie()),R[3].c.es!=null?st?(st.p(R,ae),ae[0]&8&&D(st,1)):(st=kf(R),st.c(),D(st,1),st.m(l,Os)):st&&(De(),q(st,1,1,()=>{st=null}),Ie()),ae[0]&8&&(Fs=R[3].p.r.startsWith("10YNO")||R[3].p.r.startsWith("10Y1001A1001A4")),Fs?rt?(rt.p(R,ae),ae[0]&8&&D(rt,1)):(rt=Cf(R),rt.c(),D(rt,1),rt.m(l,qs)):rt&&(De(),q(rt,1,1,()=>{rt=null}),Ie()),ae[0]&136){ti=R[7];let Bt;for(Bt=0;Bt20||R[0].chip=="esp8266"?ot?(ot.p(R,ae),ae[0]&1&&D(ot,1)):(ot=$f(R),ot.c(),D(ot,1),ot.m(l,Bs)):ot&&(De(),q(ot,1,1,()=>{ot=null}),Ie()),ae[0]&8&&(Jt.checked=R[3].d.s),R[3].d.s?$t?$t.p(R,ae):($t=Df(R),$t.c(),$t.m(Dt,null)):$t&&($t.d(1),$t=null);const ft={};ae[0]&2&&(ft.active=R[1]),ln.$set(ft);const Ea={};ae[0]&4&&(Ea.active=R[2]),nn.$set(Ea);const Da={};ae[0]&16&&(Da.active=R[4]),sn.$set(Da);const Ia={};ae[0]&32&&(Ia.active=R[5]),rn.$set(Ia)},i(R){qt||(D(a.$$.fragment,R),D(F.$$.fragment,R),D(Lt.$$.fragment,R),D(Sn.$$.fragment,R),D(In.$$.fragment,R),D(On.$$.fragment,R),D(qn.$$.fragment,R),D(lt),D(nt),D(it),D(st),D(rt),D(Xn.$$.fragment,R),D(ot),D(Jn.$$.fragment,R),D(ln.$$.fragment,R),D(nn.$$.fragment,R),D(sn.$$.fragment,R),D(rn.$$.fragment,R),qt=!0)},o(R){q(a.$$.fragment,R),q(F.$$.fragment,R),q(Lt.$$.fragment,R),q(Sn.$$.fragment,R),q(In.$$.fragment,R),q(On.$$.fragment,R),q(qn.$$.fragment,R),q(lt),q(nt),q(it),q(st),q(rt),q(Xn.$$.fragment,R),q(ot),q(Jn.$$.fragment,R),q(ln.$$.fragment,R),q(nn.$$.fragment,R),q(sn.$$.fragment,R),q(rn.$$.fragment,R),qt=!1},d(R){R&&C(e),ne(a),ne(F),cl(gi,R),gt&>.d(),kt&&kt.d(),ne(Lt),cl(ki,R),wt&&wt.d(),yt&&yt.d(),Ct&&Ct.d(),ne(Sn),ne(In),ne(On),Mt&&Mt.d(),ne(qn),St&&St.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),rt&&rt.d(),ne(Xn),cl(_t,R),ot&&ot.d(),ne(Jn),$t&&$t.d(),R&&C(Hs),ne(ln,R),R&&C(js),ne(nn,R),R&&C(Ws),ne(sn,R),R&&C(zs),ne(rn,R),Gs=!1,ze(Pa)}}}async function Cp(){await(await fetch("/reboot",{method:"POST"})).json()}function Mp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],r=!0,u=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{es:null}};Ci.subscribe(Ge=>{Ge.version&&(l(3,a=Ge),l(1,r=!1))}),Wm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ge=new URLSearchParams;Ge.append("perform","true");let vl=await(await fetch("/reset",{method:"POST",body:Ge})).json();l(4,c=!1),l(5,f=vl.success)}}async function p(Ge){l(2,u=!0);const Ae=new FormData(Ge.target),vl=new URLSearchParams;for(let Lt of Ae){const[Bi,Wl]=Lt;vl.append(Bi,Wl)}let El=await(await fetch("/save",{method:"POST",body:vl})).json();Rt.update(Lt=>(Lt.booting=El.reboot,Lt.ui=a.u,Lt)),l(2,u=!1),ri("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Rt.update(Ge=>(Ge.booting=!0,Ge)),Cp())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.c=!1,Ae)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.r=!1,Ae)))}async function S(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.k=!1,Ae)))}const y=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let $=44;function N(){a.g.h=this.value,l(3,a)}function E(){a.g.t=dt(this),l(3,a)}function B(){a.p.r=dt(this),l(3,a)}function P(){a.p.c=dt(this),l(3,a)}function L(){a.p.f=he(this.value),l(3,a)}function O(){a.p.m=he(this.value),l(3,a)}function F(){a.p.e=this.checked,l(3,a)}function x(){a.p.t=this.value,l(3,a)}function H(){a.g.s=dt(this),l(3,a)}function z(){a.g.u=this.value,l(3,a)}function G(){a.g.p=this.value,l(3,a)}function V(){a.m.i=this.checked,l(3,a)}function W(){a.m.b=dt(this),l(3,a)}function U(){a.m.p=dt(this),l(3,a)}function K(){a.m.s=he(this.value),l(3,a)}function j(){a.m.d=dt(this),l(3,a)}function Y(){a.m.f=he(this.value),l(3,a)}function X(){a.m.r=he(this.value),l(3,a)}function oe(){a.m.e.e=this.checked,l(3,a)}function ue(){a.m.e.k=this.value,l(3,a)}function ke(){a.m.e.a=this.value,l(3,a)}function me(){a.m.m.e=this.checked,l(3,a)}function $e(){a.m.m.w=he(this.value),l(3,a)}function He(){a.m.m.v=he(this.value),l(3,a)}function Re(){a.m.m.a=he(this.value),l(3,a)}function je(){a.m.m.c=he(this.value),l(3,a)}function we(){a.w.s=this.value,l(3,a)}function Te(){a.w.p=this.value,l(3,a)}function Le(){a.w.z=dt(this),l(3,a)}function Me(){a.w.w=he(this.value),l(3,a)}function w(){a.w.b=this.checked,l(3,a)}function g(){a.n.m=dt(this),l(3,a)}function k(){a.n.i=this.value,l(3,a)}function A(){a.n.s=dt(this),l(3,a)}function I(){a.n.g=this.value,l(3,a)}function Q(){a.n.d1=this.value,l(3,a)}function J(){a.n.d2=this.value,l(3,a)}function se(){a.n.d=this.checked,l(3,a)}function ce(){a.n.h=this.checked,l(3,a)}function ve(){a.n.n1=this.value,l(3,a)}function Se(){a.q.s.e=this.checked,l(3,a)}function re(){a.q.h=this.value,l(3,a)}function pe(){a.q.p=he(this.value),l(3,a)}function Be(){a.q.u=this.value,l(3,a)}function _e(){a.q.a=this.value,l(3,a)}function ye(){a.q.c=this.value,l(3,a)}function vt(){a.q.m=dt(this),l(3,a)}function jl(){a.q.b=this.value,l(3,a)}function tl(){a.o.e=this.value,l(3,a)}function ct(){a.o.c=this.value,l(3,a)}function Tl(){a.o.u1=this.value,l(3,a)}function pl(){a.o.u2=this.value,l(3,a)}function jt(){a.o.u3=this.value,l(3,a)}function ht(){a.h.t=this.value,l(3,a)}function Xe(){a.h.h=this.value,l(3,a)}function Ze(){a.h.n=this.value,l(3,a)}function Je(){a.c.es=this.checked,l(3,a)}function Ue(Ge){a.t.t[Ge]=he(this.value),l(3,a)}function xe(){a.t.h=he(this.value),l(3,a)}function We(Ge){a.u[Ge.key]=dt(this),l(3,a)}function et(){a.i.h.u=this.checked,l(3,a)}function tt(){a.i.h.p=dt(this),l(3,a)}function de(){a.i.a=he(this.value),l(3,a)}function Ce(){a.i.l.i=this.checked,l(3,a)}function Ei(){a.i.l.p=he(this.value),l(3,a)}function _l(){a.i.r.i=this.checked,l(3,a)}function _n(){a.i.r.r=he(this.value),l(3,a)}function Tt(){a.i.r.g=he(this.value),l(3,a)}function Di(){a.i.r.b=he(this.value),l(3,a)}function Ii(){a.i.t.d=he(this.value),l(3,a)}function Ri(){a.i.t.a=he(this.value),l(3,a)}function dl(){a.i.v.p=he(this.value),l(3,a)}function Li(){a.i.v.d.v=he(this.value),l(3,a)}function Oi(){a.i.v.d.g=he(this.value),l(3,a)}function Fi(){a.i.v.o=he(this.value),l(3,a)}function Nt(){a.i.v.m=he(this.value),l(3,a)}function Nl(){a.i.v.b=he(this.value),l(3,a)}function Al(){a.d.s=this.checked,l(3,a)}function Pl(){a.d.t=this.checked,l(3,a)}function qi(){a.d.l=dt(this),l(3,a)}return t.$$set=Ge=>{"sysinfo"in Ge&&l(0,n=Ge.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,$=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,r,u,a,c,f,$,i,_,p,b,v,d,S,y,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,$e,He,Re,je,we,Te,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re,pe,Be,_e,ye,vt,jl,tl,ct,Tl,pl,jt,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi]}class Sp extends Ee{constructor(e){super(),Pe(this,e,Mp,yp,Ne,{sysinfo:0},null,[-1,-1,-1,-1])}}function Rf(t,e,l){const n=t.slice();return n[20]=e[l],n}function $p(t){let e=be(t[1].chip,t[1].board)+"",l;return{c(){l=T(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=be(n[1].chip,n[1].board)+"")&&Z(l,e)},d(n){n&&C(l)}}}function Lf(t){let e,l,n=t[1].apmac+"",i,r,u,a,c,f,_,p,b,v=Ja(t[1])+"",d,S,y=t[1].boot_reason+"",$,N,E=t[1].ex_cause+"",B,P,L;const O=[Np,Tp],F=[];function x(H,z){return H[0].u>0?0:1}return c=x(t),f=F[c]=O[c](t),{c(){e=m("div"),l=T("AP MAC: "),i=T(n),r=h(),u=m("div"),a=T(`Last boot: - `),f.c(),_=h(),p=m("div"),b=T("Reason: "),d=T(v),S=T(" ("),$=T(y),N=T("/"),B=T(E),P=T(")"),o(e,"class","my-2"),o(u,"class","my-2"),o(p,"class","my-2")},m(H,z){M(H,e,z),s(e,l),s(e,i),M(H,r,z),M(H,u,z),s(u,a),F[c].m(u,null),M(H,_,z),M(H,p,z),s(p,b),s(p,d),s(p,S),s(p,$),s(p,N),s(p,B),s(p,P),L=!0},p(H,z){(!L||z&2)&&n!==(n=H[1].apmac+"")&&Z(i,n);let G=c;c=x(H),c===G?F[c].p(H,z):(De(),q(F[G],1,1,()=>{F[G]=null}),Ie(),f=F[c],f?f.p(H,z):(f=F[c]=O[c](H),f.c()),D(f,1),f.m(u,null)),(!L||z&2)&&v!==(v=Ja(H[1])+"")&&Z(d,v),(!L||z&2)&&y!==(y=H[1].boot_reason+"")&&Z($,y),(!L||z&2)&&E!==(E=H[1].ex_cause+"")&&Z(B,E)},i(H){L||(D(f),L=!0)},o(H){q(f),L=!1},d(H){H&&C(e),H&&C(r),H&&C(u),F[c].d(),H&&C(_),H&&C(p)}}}function Tp(t){let e;return{c(){e=T("-")},m(l,n){M(l,e,n)},p:fe,i:fe,o:fe,d(l){l&&C(e)}}}function Np(t){let e,l;return e=new Yc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Ap(t){let e;return{c(){e=m("span"),e.textContent="Update consents",o(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:fe,d(l){l&&C(e)}}}function Of(t){let e,l,n,i,r,u=Cs(t[1].meter.mfg)+"",a,c,f,_,p=(t[1].meter.model?t[1].meter.model:"unknown")+"",b,v,d,S,y=(t[1].meter.id?t[1].meter.id:"unknown")+"",$;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),r=T("Manufacturer: "),a=T(u),c=h(),f=m("div"),_=T("Model: "),b=T(p),v=h(),d=m("div"),S=T("ID: "),$=T(y),o(l,"class","text-sm"),o(i,"class","my-2"),o(f,"class","my-2"),o(d,"class","my-2"),o(e,"class","cnt")},m(N,E){M(N,e,E),s(e,l),s(e,n),s(e,i),s(i,r),s(i,a),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,S),s(d,$)},p(N,E){E&2&&u!==(u=Cs(N[1].meter.mfg)+"")&&Z(a,u),E&2&&p!==(p=(N[1].meter.model?N[1].meter.model:"unknown")+"")&&Z(b,p),E&2&&y!==(y=(N[1].meter.id?N[1].meter.id:"unknown")+"")&&Z($,y)},d(N){N&&C(e)}}}function Ff(t){let e,l,n,i,r,u=t[1].net.ip+"",a,c,f,_,p=t[1].net.mask+"",b,v,d,S,y=t[1].net.gw+"",$,N,E,B,P=t[1].net.dns1+"",L,O,F=t[1].net.dns2&&qf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),r=T("IP: "),a=T(u),c=h(),f=m("div"),_=T("Mask: "),b=T(p),v=h(),d=m("div"),S=T("Gateway: "),$=T(y),N=h(),E=m("div"),B=T("DNS: "),L=T(P),O=h(),F&&F.c(),o(l,"class","text-sm"),o(i,"class","my-2"),o(f,"class","my-2"),o(d,"class","my-2"),o(E,"class","my-2"),o(e,"class","cnt")},m(x,H){M(x,e,H),s(e,l),s(e,n),s(e,i),s(i,r),s(i,a),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,S),s(d,$),s(e,N),s(e,E),s(E,B),s(E,L),s(E,O),F&&F.m(E,null)},p(x,H){H&2&&u!==(u=x[1].net.ip+"")&&Z(a,u),H&2&&p!==(p=x[1].net.mask+"")&&Z(b,p),H&2&&y!==(y=x[1].net.gw+"")&&Z($,y),H&2&&P!==(P=x[1].net.dns1+"")&&Z(L,P),x[1].net.dns2?F?F.p(x,H):(F=qf(x),F.c(),F.m(E,null)):F&&(F.d(1),F=null)},d(x){x&&C(e),F&&F.d()}}}function qf(t){let e,l=t[1].net.dns2+"",n;return{c(){e=T("/ "),n=T(l)},m(i,r){M(i,e,r),M(i,n,r)},p(i,r){r&2&&l!==(l=i[1].net.dns2+"")&&Z(n,l)},d(i){i&&C(e),i&&C(n)}}}function Bf(t){let e,l,n,i=t[1].upgrade.f+"",r,u,a=t[1].upgrade.t+"",c,f,_=Za(t[1].upgrade.e)+"",p;return{c(){e=m("div"),l=m("div"),n=T("Previous upgrade attempt from "),r=T(i),u=T(" to "),c=T(a),f=T(" failed. "),p=T(_),o(l,"class","bd-yellow"),o(e,"class","my-2")},m(b,v){M(b,e,v),s(e,l),s(l,n),s(l,r),s(l,u),s(l,c),s(l,f),s(l,p)},p(b,v){v&2&&i!==(i=b[1].upgrade.f+"")&&Z(r,i),v&2&&a!==(a=b[1].upgrade.t+"")&&Z(c,a),v&2&&_!==(_=Za(b[1].upgrade.e)+"")&&Z(p,_)},d(b){b&&C(e)}}}function Uf(t){let e,l,n,i=t[2].tag_name+"",r,u,a,c,f,_,p=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Hf(t),b=t[1].fwconsent===2&&jf();return{c(){e=m("div"),l=T(`Latest version: - `),n=m("a"),r=T(i),a=h(),p&&p.c(),c=h(),b&&b.c(),f=Ve(),o(n,"href",u=t[2].html_url),o(n,"class","ml-2 text-blue-600 hover:text-blue-800"),o(n,"target","_blank"),o(n,"rel","noreferrer"),o(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,r),s(e,a),p&&p.m(e,null),M(v,c,d),b&&b.m(v,d),M(v,f,d),_=!0},p(v,d){(!_||d&4)&&i!==(i=v[2].tag_name+"")&&Z(r,i),(!_||d&4&&u!==(u=v[2].html_url))&&o(n,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?p?(p.p(v,d),d&7&&D(p,1)):(p=Hf(v),p.c(),D(p,1),p.m(e,null)):p&&(De(),q(p,1,1,()=>{p=null}),Ie()),v[1].fwconsent===2?b||(b=jf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){_||(D(p),_=!0)},o(v){q(p),_=!1},d(v){v&&C(e),p&&p.d(),v&&C(c),b&&b.d(v),v&&C(f)}}}function Hf(t){let e,l,n,i,r,u;return n=new Qc({}),{c(){e=m("div"),l=m("button"),ie(n.$$.fragment),o(e,"class","flex-none ml-2 text-green-500"),o(e,"title","Install this version")},m(a,c){M(a,e,c),s(e,l),le(n,l,null),i=!0,r||(u=ee(l,"click",t[10]),r=!0)},p:fe,i(a){i||(D(n.$$.fragment,a),i=!0)},o(a){q(n.$$.fragment,a),i=!1},d(a){a&&C(e),ne(n),r=!1,u()}}}function jf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',o(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Wf(t){let e,l=Ms(be(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=T(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&2&&l!==(l=Ms(be(i[1].chip,i[1].board))+"")&&Z(n,l)},d(i){i&&C(e)}}}function zf(t){let e,l,n,i,r,u;function a(_,p){return _[4].length==0?Ep:Pp}let c=a(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),sc(n,"display","none"),o(n,"name","file"),o(n,"type","file"),o(n,"accept",".bin"),o(l,"action","/firmware"),o(l,"enctype","multipart/form-data"),o(l,"method","post"),o(l,"autocomplete","off"),o(e,"class","my-2 flex")},m(_,p){M(_,e,p),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),r||(u=[ee(n,"change",t[13]),ee(l,"submit",t[15])],r=!0)},p(_,p){c===(c=a(_))&&f?f.p(_,p):(f.d(1),f=c(_),f&&(f.c(),f.m(l,null)))},d(_){_&&C(e),t[12](null),f.d(),r=!1,ze(u)}}}function Pp(t){let e=t[4][0].name+"",l,n,i;return{c(){l=T(e),n=h(),i=m("button"),i.textContent="Upload",o(i,"type","submit"),o(i,"class","btn-pri-sm float-right")},m(r,u){M(r,l,u),M(r,n,u),M(r,i,u)},p(r,u){u&16&&e!==(e=r[4][0].name+"")&&Z(l,e)},d(r){r&&C(l),r&&C(n),r&&C(i)}}}function Ep(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",o(e,"type","button"),o(e,"class","btn-pri-sm float-right")},m(i,r){M(i,e,r),l||(n=ee(e,"click",t[14]),l=!0)},p:fe,d(i){i&&C(e),l=!1,n()}}}function Gf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S=t[9],y=[];for(let P=0;P Include Secrets
(SSID, PSK, passwords and tokens)',c=h(),$&&$.c(),f=h(),_=m("form"),p=m("input"),b=h(),B.c(),o(l,"class","text-sm"),o(a,"class","my-1 mx-3 col-span-2"),o(r,"class","grid grid-cols-2"),o(i,"method","get"),o(i,"action","/configfile.cfg"),o(i,"autocomplete","off"),sc(p,"display","none"),o(p,"name","file"),o(p,"type","file"),o(p,"accept",".cfg"),o(_,"action","/configfile"),o(_,"enctype","multipart/form-data"),o(_,"method","post"),o(_,"autocomplete","off"),o(e,"class","cnt")},m(P,L){M(P,e,L),s(e,l),s(e,n),s(e,i),s(i,r);for(let O=0;O{A=null}),Ie());const _e={};pe&8388608&&(_e.$$scope={dirty:pe,ctx:re}),x.$set(_e),re[1].meter?I?I.p(re,pe):(I=Of(re),I.c(),I.m(e,V)):I&&(I.d(1),I=null),re[1].net?Q?Q.p(re,pe):(Q=Ff(re),Q.c(),Q.m(e,W)):Q&&(Q.d(1),Q=null),(!w||pe&2)&&oe!==(oe=re[1].version+"")&&Z(ue,oe),re[1].upgrade.t&&re[1].upgrade.t!=re[1].version?J?J.p(re,pe):(J=Bf(re),J.c(),J.m(U,me)):J&&(J.d(1),J=null),re[2]?se?(se.p(re,pe),pe&4&&D(se,1)):(se=Uf(re),se.c(),D(se,1),se.m(U,$e)):se&&(De(),q(se,1,1,()=>{se=null}),Ie()),pe&3&&(He=(re[1].security==0||re[0].a)&&oi(re[1].board)),He?ce?ce.p(re,pe):(ce=Wf(re),ce.c(),ce.m(U,Re)):ce&&(ce.d(1),ce=null),re[1].security==0||re[0].a?ve?ve.p(re,pe):(ve=zf(re),ve.c(),ve.m(U,null)):ve&&(ve.d(1),ve=null),re[1].security==0||re[0].a?Se?Se.p(re,pe):(Se=Gf(re),Se.c(),Se.m(e,null)):Se&&(Se.d(1),Se=null);const ye={};pe&32&&(ye.active=re[5]),Te.$set(ye);const vt={};pe&256&&(vt.active=re[8]),Me.$set(vt)},i(re){w||(D(y.$$.fragment,re),D(A),D(x.$$.fragment,re),D(se),D(Te.$$.fragment,re),D(Me.$$.fragment,re),w=!0)},o(re){q(y.$$.fragment,re),q(A),q(x.$$.fragment,re),q(se),q(Te.$$.fragment,re),q(Me.$$.fragment,re),w=!1},d(re){re&&C(e),ne(y),A&&A.d(),ne(x),I&&I.d(),Q&&Q.d(),J&&J.d(),se&&se.d(),ce&&ce.d(),ve&&ve.d(),Se&&Se.d(),re&&C(we),ne(Te,re),re&&C(Le),ne(Me,re),g=!1,k()}}}async function Lp(){await(await fetch("/reboot",{method:"POST"})).json()}function Op(t,e,l){let{data:n}=e,{sysinfo:i}=e,r=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};Sr.subscribe(O=>{l(2,u=Kc(i.version,O)),u||l(2,u=O[0])});function a(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Ms(be(i.chip,i.board))))&&(Rt.update(O=>(O.upgrading=!0,O)),Vc(u.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Rt.update(O=>(O.booting=!0,O)),Lp())};let f,_=[],p=!1,b,v=[],d=!1;wr();function S(O){ws[O?"unshift":"push"](()=>{f=O,l(3,f)})}function y(){_=this.files,l(4,_)}const $=()=>{f.click()},N=()=>l(5,p=!0);function E(O){ws[O?"unshift":"push"](()=>{b=O,l(6,b)})}function B(){v=this.files,l(7,v)}const P=()=>{b.click()},L=()=>l(8,d=!0);return t.$$set=O=>{"data"in O&&l(0,n=O.data),"sysinfo"in O&&l(1,i=O.sysinfo)},[n,i,u,f,_,p,b,v,d,r,a,c,S,y,$,N,E,B,P,L]}class Fp extends Ee{constructor(e){super(),Pe(this,e,Op,Rp,Ne,{data:0,sysinfo:1})}}function Yf(t){let e,l,n=be(t[0],7)+"",i,r,u=be(t[0],5)+"",a,c,f=be(t[0],4)+"",_,p,b=be(t[0],3)+"",v,d,S,y,$=be(t[0],2)+"",N,E,B=be(t[0],1)+"",P,L,O=be(t[0],0)+"",F,x,H,z,G=be(t[0],101)+"",V,W,U=be(t[0],100)+"",K;return{c(){e=m("optgroup"),l=m("option"),i=T(n),r=m("option"),a=T(u),c=m("option"),_=T(f),p=m("option"),v=T(b),d=h(),S=m("optgroup"),y=m("option"),N=T($),E=m("option"),P=T(B),L=m("option"),F=T(O),x=h(),H=m("optgroup"),z=m("option"),V=T(G),W=m("option"),K=T(U),l.__value=7,l.value=l.__value,r.__value=5,r.value=r.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,o(e,"label","amsleser.no"),y.__value=2,y.value=y.__value,E.__value=1,E.value=E.__value,L.__value=0,L.value=L.__value,o(S,"label","Custom hardware"),z.__value=101,z.value=z.__value,W.__value=100,W.value=W.__value,o(H,"label","Generic hardware")},m(j,Y){M(j,e,Y),s(e,l),s(l,i),s(e,r),s(r,a),s(e,c),s(c,_),s(e,p),s(p,v),M(j,d,Y),M(j,S,Y),s(S,y),s(y,N),s(S,E),s(E,P),s(S,L),s(L,F),M(j,x,Y),M(j,H,Y),s(H,z),s(z,V),s(H,W),s(W,K)},p(j,Y){Y&1&&n!==(n=be(j[0],7)+"")&&Z(i,n),Y&1&&u!==(u=be(j[0],5)+"")&&Z(a,u),Y&1&&f!==(f=be(j[0],4)+"")&&Z(_,f),Y&1&&b!==(b=be(j[0],3)+"")&&Z(v,b),Y&1&&$!==($=be(j[0],2)+"")&&Z(N,$),Y&1&&B!==(B=be(j[0],1)+"")&&Z(P,B),Y&1&&O!==(O=be(j[0],0)+"")&&Z(F,O),Y&1&&G!==(G=be(j[0],101)+"")&&Z(V,G),Y&1&&U!==(U=be(j[0],100)+"")&&Z(K,U)},d(j){j&&C(e),j&&C(d),j&&C(S),j&&C(x),j&&C(H)}}}function Qf(t){let e,l,n=be(t[0],201)+"",i,r,u=be(t[0],202)+"",a,c,f=be(t[0],203)+"",_,p,b=be(t[0],200)+"",v;return{c(){e=m("optgroup"),l=m("option"),i=T(n),r=m("option"),a=T(u),c=m("option"),_=T(f),p=m("option"),v=T(b),l.__value=201,l.value=l.__value,r.__value=202,r.value=r.__value,c.__value=203,c.value=c.__value,p.__value=200,p.value=p.__value,o(e,"label","Generic hardware")},m(d,S){M(d,e,S),s(e,l),s(l,i),s(e,r),s(r,a),s(e,c),s(c,_),s(e,p),s(p,v)},p(d,S){S&1&&n!==(n=be(d[0],201)+"")&&Z(i,n),S&1&&u!==(u=be(d[0],202)+"")&&Z(a,u),S&1&&f!==(f=be(d[0],203)+"")&&Z(_,f),S&1&&b!==(b=be(d[0],200)+"")&&Z(v,b)},d(d){d&&C(e)}}}function Xf(t){let e,l,n=be(t[0],7)+"",i,r,u=be(t[0],6)+"",a,c,f=be(t[0],5)+"",_,p,b,v,d=be(t[0],51)+"",S,y,$=be(t[0],50)+"",N;return{c(){e=m("optgroup"),l=m("option"),i=T(n),r=m("option"),a=T(u),c=m("option"),_=T(f),p=h(),b=m("optgroup"),v=m("option"),S=T(d),y=m("option"),N=T($),l.__value=7,l.value=l.__value,r.__value=6,r.value=r.__value,c.__value=5,c.value=c.__value,o(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,y.__value=50,y.value=y.__value,o(b,"label","Generic hardware")},m(E,B){M(E,e,B),s(e,l),s(l,i),s(e,r),s(r,a),s(e,c),s(c,_),M(E,p,B),M(E,b,B),s(b,v),s(v,S),s(b,y),s(y,N)},p(E,B){B&1&&n!==(n=be(E[0],7)+"")&&Z(i,n),B&1&&u!==(u=be(E[0],6)+"")&&Z(a,u),B&1&&f!==(f=be(E[0],5)+"")&&Z(_,f),B&1&&d!==(d=be(E[0],51)+"")&&Z(S,d),B&1&&$!==($=be(E[0],50)+"")&&Z(N,$)},d(E){E&&C(e),E&&C(p),E&&C(b)}}}function Zf(t){let e,l,n=be(t[0],8)+"",i,r,u,a,c=be(t[0],71)+"",f,_,p=be(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=T(n),r=h(),u=m("optgroup"),a=m("option"),f=T(c),_=m("option"),b=T(p),l.__value=8,l.value=l.__value,o(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,_.__value=70,_.value=_.__value,o(u,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,r,d),M(v,u,d),s(u,a),s(a,f),s(u,_),s(_,b)},p(v,d){d&1&&n!==(n=be(v[0],8)+"")&&Z(i,n),d&1&&c!==(c=be(v[0],71)+"")&&Z(f,c),d&1&&p!==(p=be(v[0],70)+"")&&Z(b,p)},d(v){v&&C(e),v&&C(r),v&&C(u)}}}function Jf(t){let e,l,n=be(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=T(n),l.__value=200,l.value=l.__value,o(e,"label","Generic hardware")},m(r,u){M(r,e,u),s(e,l),s(l,i)},p(r,u){u&1&&n!==(n=be(r[0],200)+"")&&Z(i,n)},d(r){r&&C(e)}}}function qp(t){let e,l,n,i,r,u,a,c=t[0]=="esp8266"&&Yf(t),f=t[0]=="esp32"&&Qf(t),_=t[0]=="esp32s2"&&Xf(t),p=t[0]=="esp32c3"&&Zf(t),b=t[0]=="esp32solo"&&Jf(t);return{c(){e=m("option"),l=h(),c&&c.c(),n=h(),f&&f.c(),i=h(),_&&_.c(),r=h(),p&&p.c(),u=h(),b&&b.c(),a=Ve(),e.__value=-1,e.value=e.__value},m(v,d){M(v,e,d),M(v,l,d),c&&c.m(v,d),M(v,n,d),f&&f.m(v,d),M(v,i,d),_&&_.m(v,d),M(v,r,d),p&&p.m(v,d),M(v,u,d),b&&b.m(v,d),M(v,a,d)},p(v,[d]){v[0]=="esp8266"?c?c.p(v,d):(c=Yf(v),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),v[0]=="esp32"?f?f.p(v,d):(f=Qf(v),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),v[0]=="esp32s2"?_?_.p(v,d):(_=Xf(v),_.c(),_.m(r.parentNode,r)):_&&(_.d(1),_=null),v[0]=="esp32c3"?p?p.p(v,d):(p=Zf(v),p.c(),p.m(u.parentNode,u)):p&&(p.d(1),p=null),v[0]=="esp32solo"?b?b.p(v,d):(b=Jf(v),b.c(),b.m(a.parentNode,a)):b&&(b.d(1),b=null)},i:fe,o:fe,d(v){v&&C(e),v&&C(l),c&&c.d(v),v&&C(n),f&&f.d(v),v&&C(i),_&&_.d(v),v&&C(r),p&&p.d(v),v&&C(u),b&&b.d(v),v&&C(a)}}}function Bp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Up extends Ee{constructor(e){super(),Pe(this,e,Bp,qp,Ne,{chip:0})}}function xf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",o(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function ec(t){let e,l,n,i,r,u,a;return u=new Zc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=T("HAN GPIO"),n=m("br"),i=h(),r=m("select"),ie(u.$$.fragment),o(r,"name","vh"),o(r,"class","in-s"),o(e,"class","my-3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),le(u,r,null),a=!0},p(c,f){const _={};f&1&&(_.chip=c[0].chip),u.$set(_)},i(c){a||(D(u.$$.fragment,c),a=!0)},o(c){q(u.$$.fragment,c),a=!1},d(c){c&&C(e),ne(u)}}}function Hp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,H,z,G,V,W=t[0].usrcfg&&xf();d=new Up({props:{chip:t[0].chip}});let U=t[0].board&&t[0].board>20&&ec(t);return H=new It({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),r=h(),u=m("strong"),u.textContent="Initial configuration",a=h(),W&&W.c(),c=h(),f=m("div"),_=T("Board type"),p=m("br"),b=h(),v=m("select"),ie(d.$$.fragment),S=h(),U&&U.c(),y=h(),$=m("div"),N=m("label"),E=m("input"),B=T(" Clear all other configuration"),P=h(),L=m("div"),L.innerHTML='',O=h(),F=m("span"),F.textContent="\xA0",x=h(),ie(H.$$.fragment),o(i,"type","hidden"),o(i,"name","v"),i.value="true",o(u,"class","text-sm"),o(v,"name","vb"),o(v,"class","in-s"),t[0].board===void 0&&Qe(()=>t[4].call(v)),o(f,"class","my-3"),o(E,"type","checkbox"),o(E,"name","vr"),E.__value="true",E.value=E.__value,o(E,"class","rounded mb-1"),o($,"class","my-3"),o(L,"class","my-3"),o(F,"class","clear-both"),o(n,"autocomplete","off"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(K,j){M(K,e,j),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),s(n,a),W&&W.m(n,null),s(n,c),s(n,f),s(f,_),s(f,p),s(f,b),s(f,v),le(d,v,null),qe(v,t[0].board,!0),s(n,S),U&&U.m(n,null),s(n,y),s(n,$),s($,N),s(N,E),E.checked=t[2],s(N,B),s(n,P),s(n,L),s(n,O),s(n,F),M(K,x,j),le(H,K,j),z=!0,G||(V=[ee(v,"change",t[4]),ee(E,"change",t[5]),ee(n,"submit",Ss(t[3]))],G=!0)},p(K,[j]){K[0].usrcfg?W||(W=xf(),W.c(),W.m(n,c)):W&&(W.d(1),W=null);const Y={};j&1&&(Y.chip=K[0].chip),d.$set(Y),j&1&&qe(v,K[0].board),K[0].board&&K[0].board>20?U?(U.p(K,j),j&1&&D(U,1)):(U=ec(K),U.c(),D(U,1),U.m(n,y)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),j&4&&(E.checked=K[2]);const X={};j&2&&(X.active=K[1]),H.$set(X)},i(K){z||(D(d.$$.fragment,K),D(U),D(H.$$.fragment,K),z=!0)},o(K){q(d.$$.fragment,K),q(U),q(H.$$.fragment,K),z=!1},d(K){K&&C(e),W&&W.d(),ne(d),U&&U.d(),K&&C(x),ne(H,K),G=!1,ze(V)}}}function jp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function r(f){l(1,i=!0);const _=new FormData(f.target),p=new URLSearchParams;for(let d of _){const[S,y]=d;p.append(S,y)}let v=await(await fetch("/save",{method:"POST",body:p})).json();l(1,i=!1),Rt.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d)),ri(n.usrcfg?"/":"/setup")}let u=!1;Rt.subscribe(f=>{l(0,n=f),f.fwconsent===1&&l(2,u=!n.usrcfg)});function a(){n.board=dt(this),l(0,n)}function c(){u=this.checked,l(2,u)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},[n,i,u,r,a,c]}class Wp extends Ee{constructor(e){super(),Pe(this,e,jp,Hp,Ne,{sysinfo:0})}}function tc(t){let e,l,n,i,r,u,a,c;return a=new Jc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),r=h(),u=m("select"),ie(a.$$.fragment),o(i,"name","si"),o(i,"type","text"),o(i,"class","in-f w-full"),i.required=t[1],o(u,"name","su"),o(u,"class","in-l"),u.required=t[1],o(n,"class","flex")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),s(n,r),s(n,u),le(a,u,null),c=!0},p(f,_){(!c||_&2)&&(i.required=f[1]),(!c||_&2)&&(u.required=f[1])},i(f){c||(D(a.$$.fragment,f),c=!0)},o(f){q(a.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(l),f&&C(n),ne(a)}}}function lc(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
-
-
DNS
-
`,o(e,"class","my-3 flex")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function zp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,H,z,G,V=t[1]&&tc(t),W=t[1]&&lc();return x=new It({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),r=h(),u=m("strong"),u.textContent="Setup",a=h(),c=m("div"),c.innerHTML=`SSID
- `,f=h(),_=m("div"),_.innerHTML=`PSK
- `,p=h(),b=m("div"),v=T(`Hostname - `),d=m("input"),S=h(),y=m("div"),$=m("label"),N=m("input"),E=T(" Static IP"),B=h(),V&&V.c(),P=h(),W&&W.c(),L=h(),O=m("div"),O.innerHTML='',F=h(),ie(x.$$.fragment),o(i,"type","hidden"),o(i,"name","s"),i.value="true",o(u,"class","text-sm"),o(c,"class","my-3"),o(_,"class","my-3"),o(d,"name","sh"),o(d,"type","text"),o(d,"class","in-s"),o(d,"maxlength","32"),o(d,"pattern","[a-z0-9_-]+"),o(d,"placeholder","Optional, ex.: ams-reader"),o(d,"autocomplete","off"),o(N,"type","checkbox"),o(N,"name","sm"),N.__value="static",N.value=N.__value,o(N,"class","rounded mb-1"),o(y,"class","my-3"),o(O,"class","my-3"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(U,K){M(U,e,K),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),s(n,a),s(n,c),s(n,f),s(n,_),s(n,p),s(n,b),s(b,v),s(b,d),te(d,t[0].hostname),s(n,S),s(n,y),s(y,$),s($,N),N.checked=t[1],s($,E),s(y,B),V&&V.m(y,null),s(n,P),W&&W.m(n,null),s(n,L),s(n,O),M(U,F,K),le(x,U,K),H=!0,z||(G=[ee(d,"input",t[4]),ee(N,"change",t[5]),ee(n,"submit",Ss(t[3]))],z=!0)},p(U,[K]){K&1&&d.value!==U[0].hostname&&te(d,U[0].hostname),K&2&&(N.checked=U[1]),U[1]?V?(V.p(U,K),K&2&&D(V,1)):(V=tc(U),V.c(),D(V,1),V.m(y,null)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),U[1]?W||(W=lc(),W.c(),W.m(n,L)):W&&(W.d(1),W=null);const j={};K&4&&(j.active=U[2]),x.$set(j)},i(U){H||(D(V),D(x.$$.fragment,U),H=!0)},o(U){q(V),q(x.$$.fragment,U),H=!1},d(U){U&&C(e),V&&V.d(),W&&W.d(),U&&C(F),ne(x,U),z=!1,ze(G)}}}function Gp(t,e,l){let{sysinfo:n={}}=e,i=!1,r=!1,u=0;function a(){var p="";u++;var b=function(){setTimeout(a,1e3)};if(n.net.ip&&u%3==0){if(!n.net.ip){b();return}p="http://"+n.net.ip}else n.hostname&&u%3==1?p="http://"+n.hostname:n.hostname&&u%3==2?p="http://"+n.hostname+".local":p="";console&&console.log("Trying url "+p),Rt.update(d=>(d.trying=p,d));var v=new XMLHttpRequest;v.timeout=5e3,v.addEventListener("abort",b),v.addEventListener("error",b),v.addEventListener("timeout",b),v.addEventListener("load",function(d){window.location.href=p||"/"}),v.open("GET",p+"/is-alive",!0),v.send()}async function c(p){l(2,r=!0);const b=new FormData(p.target),v=new URLSearchParams;for(let y of b){const[$,N]=y;v.append($,N)}let S=await(await fetch("/save",{method:"POST",body:v})).json();l(2,r=!1),Rt.update(y=>(y.hostname=b.get("sh"),y.usrcfg=S.success,y.booting=S.reboot,i&&(y.net.ip=b.get("si"),y.net.mask=b.get("su"),y.net.gw=b.get("sg"),y.net.dns1=b.get("sd")),setTimeout(a,5e3),y))}function f(){n.hostname=this.value,l(0,n)}function _(){i=this.checked,l(1,i)}return t.$$set=p=>{"sysinfo"in p&&l(0,n=p.sysinfo)},[n,i,r,c,f,_]}class Vp extends Ee{constructor(e){super(),Pe(this,e,Gp,zp,Ne,{sysinfo:0})}}function Kp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$;return d=new It({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=T("Upload "),r=T(t[1]),u=h(),a=m("p"),a.textContent="Select a suitable file and click upload",c=h(),f=m("form"),_=m("input"),p=h(),b=m("div"),b.innerHTML='',v=h(),ie(d.$$.fragment),o(a,"class","mb-4"),o(_,"name","file"),o(_,"type","file"),o(b,"class","w-full text-right mt-4"),o(f,"action",t[0]),o(f,"enctype","multipart/form-data"),o(f,"method","post"),o(f,"autocomplete","off"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(N,E){M(N,e,E),s(e,l),s(l,n),s(n,i),s(n,r),s(l,u),s(l,a),s(l,c),s(l,f),s(f,_),s(f,p),s(f,b),M(N,v,E),le(d,N,E),S=!0,y||($=ee(f,"submit",t[3]),y=!0)},p(N,[E]){(!S||E&2)&&Z(r,N[1]),(!S||E&1)&&o(f,"action",N[0]);const B={};E&4&&(B.active=N[2]),d.$set(B)},i(N){S||(D(d.$$.fragment,N),S=!0)},o(N){q(d.$$.fragment,N),S=!1},d(N){N&&C(e),N&&C(v),ne(d,N),y=!1,$()}}}function Yp(t,e,l){let{action:n}=e,{title:i}=e,r=!1;const u=()=>l(2,r=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,r,u]}class Tr extends Ee{constructor(e){super(),Pe(this,e,Yp,Kp,Ne,{action:0,title:1})}}function Qp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,H,z,G,V,W,U;return G=new It({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",r=h(),u=m("hr"),a=h(),c=m("div"),f=T("Enable one-click upgrade? (implies data collection)"),_=m("br"),p=h(),b=m("a"),v=T("Read more"),d=m("br"),S=h(),y=m("label"),$=m("input"),E=T(" Yes"),B=m("label"),P=m("input"),O=T(" No"),F=m("br"),x=h(),H=m("div"),H.innerHTML='',z=h(),ie(G.$$.fragment),o(b,"href",Ht("Data-collection-on-one-click-firmware-upgrade")),o(b,"target","_blank"),o(b,"class","text-blue-600 hover:text-blue-800"),o($,"type","radio"),o($,"name","sf"),$.value=1,$.checked=N=t[0].fwconsent===1,o($,"class","rounded m-2"),$.required=!0,o(P,"type","radio"),o(P,"name","sf"),P.value=2,P.checked=L=t[0].fwconsent===2,o(P,"class","rounded m-2"),P.required=!0,o(c,"class","my-3"),o(H,"class","my-3"),o(n,"autocomplete","off"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(K,j){M(K,e,j),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),s(n,a),s(n,c),s(c,f),s(c,_),s(c,p),s(c,b),s(b,v),s(c,d),s(c,S),s(c,y),s(y,$),s(y,E),s(c,B),s(B,P),s(B,O),s(c,F),s(n,x),s(n,H),M(K,z,j),le(G,K,j),V=!0,W||(U=ee(n,"submit",Ss(t[2])),W=!0)},p(K,[j]){(!V||j&1&&N!==(N=K[0].fwconsent===1))&&($.checked=N),(!V||j&1&&L!==(L=K[0].fwconsent===2))&&(P.checked=L);const Y={};j&2&&(Y.active=K[1]),G.$set(Y)},i(K){V||(D(G.$$.fragment,K),V=!0)},o(K){q(G.$$.fragment,K),V=!1},d(K){K&&C(e),K&&C(z),ne(G,K),W=!1,U()}}}function Xp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function r(u){l(1,i=!0);const a=new FormData(u.target),c=new URLSearchParams;for(let p of a){const[b,v]=p;c.append(b,v)}let _=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),Rt.update(p=>(p.fwconsent=a.sf===!0?1:a.sf===!1?2:0,p.booting=_.reboot,p)),ri("/")}return t.$$set=u=>{"sysinfo"in u&&l(0,n=u.sysinfo)},[n,i,r]}class Zp extends Ee{constructor(e){super(),Pe(this,e,Xp,Qp,Ne,{sysinfo:0})}}function Jp(t){let e,l;return e=new jm({props:{data:t[1],sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&2&&(r.data=n[1]),i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function xp(t){let e,l;return e=new Sp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function e_(t){let e,l;return e=new Fp({props:{sysinfo:t[0],data:t[1]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),i&2&&(r.data=n[1]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function t_(t){let e,l;return e=new Tr({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function l_(t){let e,l;return e=new Tr({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function n_(t){let e,l;return e=new Tr({props:{title:"private key",action:"/mqtt-key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function i_(t){let e,l;return e=new Zp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function s_(t){let e,l;return e=new Vp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function r_(t){let e,l;return e=new Wp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function o_(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,E,B;return e=new lm({props:{data:t[1]}}),n=new Sl({props:{path:"/",$$slots:{default:[Jp]},$$scope:{ctx:t}}}),r=new Sl({props:{path:"/configuration",$$slots:{default:[xp]},$$scope:{ctx:t}}}),a=new Sl({props:{path:"/status",$$slots:{default:[e_]},$$scope:{ctx:t}}}),f=new Sl({props:{path:"/mqtt-ca",$$slots:{default:[t_]},$$scope:{ctx:t}}}),p=new Sl({props:{path:"/mqtt-cert",$$slots:{default:[l_]},$$scope:{ctx:t}}}),v=new Sl({props:{path:"/mqtt-key",$$slots:{default:[n_]},$$scope:{ctx:t}}}),S=new Sl({props:{path:"/consent",$$slots:{default:[i_]},$$scope:{ctx:t}}}),$=new Sl({props:{path:"/setup",$$slots:{default:[s_]},$$scope:{ctx:t}}}),E=new Sl({props:{path:"/vendor",$$slots:{default:[r_]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment),l=h(),ie(n.$$.fragment),i=h(),ie(r.$$.fragment),u=h(),ie(a.$$.fragment),c=h(),ie(f.$$.fragment),_=h(),ie(p.$$.fragment),b=h(),ie(v.$$.fragment),d=h(),ie(S.$$.fragment),y=h(),ie($.$$.fragment),N=h(),ie(E.$$.fragment)},m(P,L){le(e,P,L),M(P,l,L),le(n,P,L),M(P,i,L),le(r,P,L),M(P,u,L),le(a,P,L),M(P,c,L),le(f,P,L),M(P,_,L),le(p,P,L),M(P,b,L),le(v,P,L),M(P,d,L),le(S,P,L),M(P,y,L),le($,P,L),M(P,N,L),le(E,P,L),B=!0},p(P,L){const O={};L&2&&(O.data=P[1]),e.$set(O);const F={};L&7&&(F.$$scope={dirty:L,ctx:P}),n.$set(F);const x={};L&5&&(x.$$scope={dirty:L,ctx:P}),r.$set(x);const H={};L&7&&(H.$$scope={dirty:L,ctx:P}),a.$set(H);const z={};L&4&&(z.$$scope={dirty:L,ctx:P}),f.$set(z);const G={};L&4&&(G.$$scope={dirty:L,ctx:P}),p.$set(G);const V={};L&4&&(V.$$scope={dirty:L,ctx:P}),v.$set(V);const W={};L&5&&(W.$$scope={dirty:L,ctx:P}),S.$set(W);const U={};L&5&&(U.$$scope={dirty:L,ctx:P}),$.$set(U);const K={};L&5&&(K.$$scope={dirty:L,ctx:P}),E.$set(K)},i(P){B||(D(e.$$.fragment,P),D(n.$$.fragment,P),D(r.$$.fragment,P),D(a.$$.fragment,P),D(f.$$.fragment,P),D(p.$$.fragment,P),D(v.$$.fragment,P),D(S.$$.fragment,P),D($.$$.fragment,P),D(E.$$.fragment,P),B=!0)},o(P){q(e.$$.fragment,P),q(n.$$.fragment,P),q(r.$$.fragment,P),q(a.$$.fragment,P),q(f.$$.fragment,P),q(p.$$.fragment,P),q(v.$$.fragment,P),q(S.$$.fragment,P),q($.$$.fragment,P),q(E.$$.fragment,P),B=!1},d(P){ne(e,P),P&&C(l),ne(n,P),P&&C(i),ne(r,P),P&&C(u),ne(a,P),P&&C(c),ne(f,P),P&&C(_),ne(p,P),P&&C(b),ne(v,P),P&&C(d),ne(S,P),P&&C(y),ne($,P),P&&C(N),ne(E,P)}}}function a_(t){let e,l,n,i;const r=[c_,f_],u=[];function a(c,f){return c[0].trying?0:1}return e=a(t),l=u[e]=r[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=r[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function u_(t){let e,l;return e=new It({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function f_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function c_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function m_(t){let e,l,n,i,r,u;l=new Dc({props:{$$slots:{default:[o_]},$$scope:{ctx:t}}});const a=[u_,a_],c=[];function f(_,p){return _[0].upgrading?0:_[0].booting?1:-1}return~(i=f(t))&&(r=c[i]=a[i](t)),{c(){e=m("div"),ie(l.$$.fragment),n=h(),r&&r.c(),o(e,"class","container mx-auto m-3")},m(_,p){M(_,e,p),le(l,e,null),s(e,n),~i&&c[i].m(e,null),u=!0},p(_,[p]){const b={};p&7&&(b.$$scope={dirty:p,ctx:_}),l.$set(b);let v=i;i=f(_),i===v?~i&&c[i].p(_,p):(r&&(De(),q(c[v],1,1,()=>{c[v]=null}),Ie()),~i?(r=c[i],r?r.p(_,p):(r=c[i]=a[i](_),r.c()),D(r,1),r.m(e,null)):r=null)},i(_){u||(D(l.$$.fragment,_),D(r),u=!0)},o(_){q(l.$$.fragment,_),q(r),u=!1},d(_){_&&C(e),ne(l),~i&&c[i].d()}}}function p_(t,e,l){let n={};Rt.subscribe(r=>{l(0,n=r),n.vndcfg===!1?ri("/vendor"):n.usrcfg===!1?ri("/setup"):n.fwconsent===0&&ri("/consent")}),wr();let i={};return M1.subscribe(r=>{l(1,i=r)}),[n,i]}class __ extends Ee{constructor(e){super(),Pe(this,e,p_,m_,Ne,{})}}new __({target:document.getElementById("app")}); +Occurred in: ${i}`:"",f=hf(e),r=Wd(t)?t(f):t;return`<${f}> ${r}${o}`}const nv=e=>(...t)=>e(fh(...t)),iv=nv(e=>{throw new Error(e)}),Wo=nv(console.warn),Fm=4,uh=3,rh=2,ch=1,_h=1;function mh(e,t){const l=e.default?0:Tn(e.fullPath).reduce((n,i)=>{let o=n;return o+=Fm,xv(i)?o+=_h:eh(i)?o+=rh:Jd(i)?o-=Fm+ch:o+=uh,o},0);return{route:e,score:l,index:t}}function ph(e){return e.map(mh).sort((t,l)=>t.scorel.score?-1:t.index-l.index)}function sv(e,t){let l,n;const[i]=t.split("?"),o=Tn(i),f=o[0]==="",r=ph(e);for(let c=0,a=r.length;c({..._,params:v,uri:A});if(_.default){n=d(t);continue}const h=Tn(_.fullPath),g=Math.max(o.length,h.length);let M=0;for(;M{a===".."?c.pop():a!=="."&&c.push(a)}),Ha(`/${c.join("/")}`,n)}function Bm(e,t){const{pathname:l,hash:n="",search:i="",state:o}=e,f=Tn(t,!0),r=Tn(l,!0);for(;f.length;)f[0]!==r[0]&&iv(bi,`Invalid state: All locations must begin with the basepath "${t}", found "${l}"`),f.shift(),r.shift();return{pathname:Bs(...r),hash:n,search:i,state:o}}const Um=e=>e.length===1?"":e,bf=e=>{const t=e.indexOf("?"),l=e.indexOf("#"),n=t!==-1,i=l!==-1,o=i?Um(Ts(e,l)):"",f=i?Ts(e,0,l):e,r=n?Um(Ts(f,t)):"";return{pathname:(n?Ts(f,0,t):f)||"/",search:r,hash:o}},vh=e=>{const{pathname:t,search:l,hash:n}=e;return t+l+n};function hh(e,t,l){return Bs(l,dh(e,t))}function bh(e,t){const l=df(th(e)),n=Tn(l,!0),i=Tn(t,!0).slice(0,n.length),o=ov({fullPath:l},Bs(...i));return o&&o.uri}const ya="POP",gh="PUSH",kh="REPLACE";function za(e){return{...e.location,pathname:encodeURI(decodeURI(e.location.pathname)),state:e.history.state,_key:e.history.state&&e.history.state._key||"initial"}}function wh(e){let t=[],l=za(e),n=ya;const i=(o=t)=>o.forEach(f=>f({location:l,action:n}));return{get location(){return l},listen(o){t.push(o);const f=()=>{l=za(e),n=ya,i([o])};i([o]);const r=Kd(e,"popstate",f);return()=>{r(),t=t.filter(c=>c!==o)}},navigate(o,f){const{state:r={},replace:c=!1}=f||{};if(n=c?kh:gh,Gd(o))f&&Wo(lv,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=ya,e.history.go(o);else{const a={...r,_key:Xv()};try{e.history[c?"replaceState":"pushState"](a,"",o)}catch{e.location[c?"replace":"assign"](o)}}l=za(e),i()}}}function Wa(e,t){return{...bf(t),state:e}}function Mh(e="/"){let t=0,l=[Wa(null,e)];return{get entries(){return l},get location(){return l[t]},addEventListener(){},removeEventListener(){},history:{get state(){return l[t].state},pushState(n,i,o){t++,l=l.slice(0,t),l.push(Wa(n,o))},replaceState(n,i,o){l[t]=Wa(n,o)},go(n){const i=t+n;i<0||i>l.length-1||(t=i)}}}}const Sh=!!(!xn&&window.document&&window.document.createElement),Ch=!xn&&window.location.origin==="null",av=wh(Sh&&!Ch?window:Mh()),{navigate:hi}=av;let jn=null,fv=!0;function Nh(e,t){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;njn.level||e.level===jn.level&&Nh(e.routerId,jn.routerId))&&(jn=e)}function Ph(){jn=null}function Eh(){fv=!1}function jm(e){if(!e)return!1;const t="tabindex";try{if(!e.hasAttribute(t)){e.setAttribute(t,"-1");let l;l=Kd(e,"blur",()=>{e.removeAttribute(t),l()})}return e.focus(),document.activeElement===e}catch{return!1}}function Ah(e,t){return Number(e.dataset.svnavRouteEnd)===t}function Dh(e){return/^H[1-6]$/i.test(e.tagName)}function Hm(e,t=document){return t.querySelector(e)}function qh(e){let l=Hm(`[data-svnav-route-start="${e}"]`).nextElementSibling;for(;!Ah(l,e);){if(Dh(l))return l;const n=Hm("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function Oh(e){Promise.resolve(is(e.focusElement)).then(t=>{const l=t||qh(e.id);l||Wo(bi,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,e,Ko),!jm(l)&&jm(document.documentElement)})}const Ih=(e,t,l)=>(n,i)=>Gv().then(()=>{if(!jn||fv){Eh();return}if(n&&Oh(jn.route),e.announcements&&i){const{path:o,fullPath:f,meta:r,params:c,uri:a}=jn.route,_=e.createAnnouncement({path:o,fullPath:f,meta:r,params:c,uri:a},is(l));Promise.resolve(_).then(p=>{t.set(p)})}Ph()}),Lh="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function Rh(e){let t,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Yd(e[6],Lh)],i={};for(let o=0;o`Navigated to ${ie.uri}`,announcements:!0,...h},A=_,I=df(_),q=$n(Qa),L=$n(os),O=!q,U=Bh(),E=d&&!(L&&!L.manageFocus),B=xt("");Cn(e,B,ie=>l(0,r=ie));const z=L?L.disableInlineStyles:g,W=xt([]);Cn(e,W,ie=>l(20,f=ie));const F=xt(null);Cn(e,F,ie=>l(18,i=ie));let R=!1;const K=O?0:L.level+1,H=O?xt((()=>Bm(xn?bf(p):v.location,I))()):q;Cn(e,H,ie=>l(17,n=ie));const Y=xt(n);Cn(e,Y,ie=>l(19,o=ie));const X=Ih(M,B,H),J=ie=>oe=>oe.filter(ae=>ae.id!==ie);function $(ie){if(xn){if(R)return;const oe=ov(ie,n.pathname);if(oe)return R=!0,oe}else W.update(oe=>{const ae=J(ie.id)(oe);return ae.push(ie),ae})}function ce(ie){W.update(J(ie))}return!O&&_!==ym&&Wo(bi,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),O&&(Ud(()=>v.listen(oe=>{const ae=Bm(oe.location,I);Y.set(n),H.set(ae)})),qs(Qa,H)),qs(os,{activeRoute:F,registerRoute:$,unregisterRoute:ce,manageFocus:E,level:K,id:U,history:O?v:L.history,basepath:O?I:L.basepath,disableInlineStyles:z}),e.$$set=ie=>{"basepath"in ie&&l(11,_=ie.basepath),"url"in ie&&l(12,p=ie.url),"history"in ie&&l(13,v=ie.history),"primary"in ie&&l(14,d=ie.primary),"a11y"in ie&&l(15,h=ie.a11y),"disableInlineStyles"in ie&&l(16,g=ie.disableInlineStyles),"$$scope"in ie&&l(21,a=ie.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&2048&&_!==A&&Wo(bi,'You cannot change the "basepath" prop. It is ignored.'),e.$$.dirty[0]&1179648){const ie=sv(f,n.pathname);F.set(ie)}if(e.$$.dirty[0]&655360&&O){const ie=!!n.hash,oe=!ie&&E,ae=!ie||n.pathname!==o.pathname;X(oe,ae)}e.$$.dirty[0]&262144&&E&&i&&i.primary&&Th({level:K,routerId:U,route:i})},[r,M,O,U,E,B,z,W,F,H,Y,_,p,v,d,h,g,n,i,o,f,a,c]}class jh extends mt{constructor(t){super(),_t(this,t,Uh,Fh,ct,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const uv=jh;function Us(e,t,l=os,n=bi){$n(l)||iv(e,o=>`You cannot use ${o} outside of a ${hf(n)}.`,t)}const Hh=e=>{const{subscribe:t}=$n(e);return{subscribe:t}};function rv(){return Us(xd),Hh(Qa)}function cv(){const{history:e}=$n(os);return e}function _v(){const e=$n(Xd);return e?Zv(e,t=>t.base):xt("/")}function mv(){Us(tv);const e=_v(),{basepath:t}=$n(os);return n=>hh(n,is(e),t)}function yh(){Us(ev);const e=mv(),{navigate:t}=cv();return(n,i)=>{const o=Gd(n)?n:e(n);return t(o,i)}}const zh=e=>({params:e&16,location:e&8}),zm=e=>({params:xn?is(e[10]):e[4],location:e[3],navigate:e[11]});function Wm(e){let t,l;return t=new uv({props:{primary:e[1],$$slots:{default:[Vh]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Wh(e){let t;const l=e[18].default,n=rf(l,e,e[19],zm);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),t=!0},p(i,o){n&&n.p&&(!t||o&524312)&&_f(n,l,i,i[19],t?cf(l,i[19],o,zh):mf(i[19]),zm)},i(i){t||(Q(n,i),t=!0)},o(i){ee(n,i),t=!1},d(i){n&&n.d(i)}}}function Gh(e){let t,l,n;const i=[{location:e[3]},{navigate:e[11]},xn?is(e[10]):e[4],e[12]];var o=e[0];function f(r){let c={};for(let a=0;a{Ce(_,1)}),dt()}o?(t=Om(o,f()),Ne(t.$$.fragment),Q(t.$$.fragment,1),Se(t,l.parentNode,l)):t=null}else o&&t.$set(a)},i(r){n||(t&&Q(t.$$.fragment,r),n=!0)},o(r){t&&ee(t.$$.fragment,r),n=!1},d(r){r&&T(l),t&&Ce(t,r)}}}function Vh(e){let t,l,n,i;const o=[Gh,Wh],f=[];function r(c,a){return c[0]!==null?0:1}return t=r(e),l=f[t]=o[t](e),{c(){l.c(),n=Ut()},m(c,a){f[t].m(c,a),P(c,n,a),i=!0},p(c,a){let _=t;t=r(c),t===_?f[t].p(c,a):(pt(),ee(f[_],1,1,()=>{f[_]=null}),dt(),l=f[t],l?l.p(c,a):(l=f[t]=o[t](c),l.c()),Q(l,1),l.m(n.parentNode,n))},i(c){i||(Q(l),i=!0)},o(c){ee(l),i=!1},d(c){f[t].d(c),c&&T(n)}}}function Kh(e){let t,l,n,i,o,f=[Ya(e[7]),{"data-svnav-route-start":e[5]}],r={};for(let p=0;p{c=null}),dt())},i(p){o||(Q(c),o=!0)},o(p){ee(c),o=!1},d(p){p&&T(t),p&&T(l),c&&c.d(p),p&&T(n),p&&T(i)}}}const Yh=Vd();function Qh(e,t,l){let n;const i=["path","component","meta","primary"];let o=yo(t,i),f,r,c,a,{$$slots:_={},$$scope:p}=t,{path:v=""}=t,{component:d=null}=t,{meta:h={}}=t,{primary:g=!0}=t;Us(Ko,t);const M=Yh(),{registerRoute:A,unregisterRoute:I,activeRoute:q,disableInlineStyles:L}=$n(os);Cn(e,q,R=>l(16,f=R));const O=_v();Cn(e,O,R=>l(17,c=R));const U=rv();Cn(e,U,R=>l(3,r=R));const E=xt(null);let B;const z=xt(),W=xt({});Cn(e,W,R=>l(4,a=R)),qs(Xd,z),qs(Jv,W),qs($v,E);const F=yh();return xn||zv(()=>I(M)),e.$$set=R=>{l(24,t=mn(mn({},t),Ho(R))),l(12,o=yo(t,i)),"path"in R&&l(13,v=R.path),"component"in R&&l(0,d=R.component),"meta"in R&&l(14,h=R.meta),"primary"in R&&l(1,g=R.primary),"$$scope"in R&&l(19,p=R.$$scope)},e.$$.update=()=>{if(e.$$.dirty&155658){const R=v==="",K=Bs(c,v),y={id:M,path:v,meta:h,default:R,fullPath:R?"":K,base:R?c:bh(K,r.pathname),primary:g,focusElement:E};z.set(y),l(15,B=A(y))}if(e.$$.dirty&98304&&l(2,n=!!(B||f&&f.id===M)),e.$$.dirty&98308&&n){const{params:R}=B||f;W.set(R)}},t=Ho(t),[d,g,n,r,a,M,q,L,O,U,W,F,o,v,h,B,f,c,_,p]}class Xh extends mt{constructor(t){super(),_t(this,t,Qh,Kh,ct,{path:13,component:0,meta:14,primary:1})}}const Sn=Xh;function Zh(e){let t,l,n,i;const o=e[13].default,f=rf(o,e,e[12],null);let r=[{href:e[0]},e[2],e[1]],c={};for(let a=0;al(11,p=E));const q=Wv(),L=mv(),{navigate:O}=cv();function U(E){q("click",E),Qv(E)&&(E.preventDefault(),O(n,{state:M,replace:f||g}))}return e.$$set=E=>{l(19,t=mn(mn({},t),Ho(E))),l(18,_=yo(t,a)),"to"in E&&l(5,h=E.to),"replace"in E&&l(6,g=E.replace),"state"in E&&l(7,M=E.state),"getProps"in E&&l(8,A=E.getProps),"$$scope"in E&&l(12,d=E.$$scope)},e.$$.update=()=>{e.$$.dirty&2080&&l(0,n=L(h,p)),e.$$.dirty&2049&&l(10,i=Xa(p.pathname,n)),e.$$.dirty&2049&&l(9,o=n===p.pathname),e.$$.dirty&2049&&(f=bf(n)===vh(p)),e.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(Wd(A)){const E=A({location:p,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...E}}return _})())},t=Ho(t),[n,c,r,I,U,h,g,M,A,o,i,p,d,v]}class $h extends mt{constructor(t){super(),_t(this,t,Jh,Zh,ct,{to:5,replace:6,state:7,getProps:8})}}const nn=$h;function Jn(e){return e===1?"green":e===2?"yellow":e===3?"red":"gray"}function xh(e,t){return e>218&&e<242?"#23ac05":e>212&&e<248?"#b1d900":e>208&&e<252?"#a3b200":"#b20000"}function gf(e,t){let l;return e>90?l="#b20000":e>85?l="#b19601":e>80?l="#a3b200":e>75?l="#569f12":l="#23ac05",l}function Is(e){return e>75?"#23ac05":e>50?"#77d900":e>25?"#94d900":"#569f12"}function Go(e){switch(e){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function ht(e){for(e=e.toString();e.length<2;)e="0"+e;return e}function Ge(e,t){switch(t){case 5:switch(e){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(e){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}}function ns(e){switch(e){case 2:case 4:case 7:return!0}return!1}function Ot(e,t){return e==1||e==2&&t}function Wl(e){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+e}function Bt(e,t){return isNaN(e)?"-":(isNaN(t)&&(t=e<1?2:e<10?1:0),e.toFixed(t))}function Nn(e,t){return e.setTime(e.getTime()+t*36e5),e}function Gm(e){return e=="EOE"?"ENTSO-E":e=="HKS"?"hvakosterstrommen.no":e=="EDS"?"Energi Data Service":e=="MIX"?"Mixed sources":"Unknown ("+e+")"}function Vm(e){return e=="EOE"?"https://transparency.entsoe.eu/-E":e=="HKS"?"https://www.hvakosterstrommen.no/":e=="EDS"?"https://www.energidataservice.dk/":"#"}let Io=0;function Ls(e,t){var l="";Io++;var n=function(){setTimeout(Ls,1e3,e,t)};if(e.net.ip&&Io%3==0){if(!e.net.ip){n();return}l="http://"+e.net.ip}else e.hostname&&Io%3==1?l="http://"+e.hostname:e.hostname&&Io%3==2?l="http://"+e.hostname+".local":l="";console&&console.log("Trying url "+l),t&&t(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(o){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function Vt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Km(e){return e.startsWith("esp32")?"esp32":e}function gl(e,t){let l=[e,t];return typeof e>"u"?(l[0]="-",l[1]=t):e>=1e9?(l[0]=(e/1e6).toFixed(e>1e10?0:1),l[1]="M"+t):e>1e4?(l[0]=(e/1e3).toFixed(e>1e6?0:e>1e5?1:2),l[1]="k"+t):(l[0]=e.toFixed(0),l[1]=t),l}let Bo={},Za=[];async function eb(e,t={}){const{timeout:l=8e3}=t,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(e,{...t,signal:n.signal});return clearTimeout(i),o}let Ga;async function pv(){if(Za.length){let e=Za.shift();delete Bo[e.resource];try{let t=await eb(e.resource,e.options);for(let l in e.callbacks)e.callbacks[l](t)}catch(t){console.error("Error calling "+e.resource,t);for(let l in e.callbacks)e.callbacks[l]()}}Ga&&clearTimeout(Ga),Ga=setTimeout(pv,100)}pv();async function pn(e,t={}){let l;return Bo[e]?l=Bo[e]:(l={resource:e,options:t,callbacks:[]},Bo[e]=l,Za.push(l)),new Promise(i=>l.callbacks.push(i))}let _n={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};const wl=xt(_n);async function kf(){_n=await(await pn("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),wl.set(_n)}function tb(e){wl.update(t=>(t.trying=e,t))}let Lo=0,Ym=-127,Qm=null,lb={};const dv=Qd(lb,e=>{let t,l;async function n(){pn("data.json").then(i=>i.json()).then(i=>{e(i),Ym!=i.t&&(Ym=i.t,setTimeout(kv,2e3)),Qm==null&&i.pe&&i.p!=null&&(Qm=i.p,hv()),_n.upgrading?window.location.reload():(!_n||!_n.chip||_n.booting||Lo>1&&!ns(_n.board))&&(kf(),mi&&clearTimeout(mi),mi=setTimeout(Mf,2e3),pi&&clearTimeout(pi),pi=setTimeout(Sf,3e3));let o=5e3;if(ns(_n.board)&&i.v>2.5){let f=3.3-Math.min(3.3,i.v);f>0&&(o=Math.max(f,.1)*10*5e3)}o>5e3&&console.log("Next in "+o+"ms"),t&&clearTimeout(t),t=setTimeout(n,o),Lo=0}).catch(i=>{Lo++,Lo>3?(e({em:3,hm:0,wm:0,mm:0}),t=setTimeout(n,15e3),l||(l=setTimeout(Ls,5e3,_n,tb))):t=setTimeout(n,ns(_n.board)?1e4:5e3)})}return n(),function(){clearTimeout(t)}});let Ja={},Ps;const wf=xt(Ja);async function vv(){let e=!1;if(wf.update(t=>{for(var l=0;l<36;l++){if(t[ht(l)]==null){e=l<12;break}t[ht(l)]=t[ht(l+1)]}return t}),e)hv();else{let t=new Date;Ps=setTimeout(vv,(60-t.getMinutes())*6e4)}}async function hv(){Ps&&(clearTimeout(Ps),Ps=0),Ja=await(await pn("energyprice.json")).json(),wf.set(Ja);let t=new Date;Ps=setTimeout(vv,(60-t.getMinutes())*6e4)}let $a={},mi;async function Mf(){mi&&(clearTimeout(mi),mi=0),$a=await(await pn("dayplot.json")).json(),bv.set($a);let t=new Date;mi=setTimeout(Mf,(60-t.getMinutes())*6e4+20)}const bv=xt($a,e=>(Mf(),function(){}));let xa={},pi;async function Sf(){pi&&(clearTimeout(pi),pi=0),xa=await(await pn("monthplot.json")).json(),gv.set(xa);let t=new Date;pi=setTimeout(Sf,(24-t.getHours())*36e5+40)}const gv=xt(xa,e=>(Sf(),function(){}));let ef={};async function kv(){ef=await(await pn("temperature.json")).json(),wv.set(ef)}const wv=xt(ef,e=>(kv(),function(){}));let tf={},Ro;async function Mv(){Ro&&(clearTimeout(Ro),Ro=0),tf=await(await pn("tariff.json")).json(),Sv.set(tf);let t=new Date;Ro=setTimeout(Mv,(60-t.getMinutes())*6e4+30)}const Sv=xt(tf,e=>function(){});let lf=[];const Cf=xt(lf);async function nb(){lf=await(await pn("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Cf.set(lf)}let es=0,ib={data:[]};async function Uo(){let t=await(await pn(es<0?"realtime.json":"realtime.json?offset="+es)).json();Cv.update(l=>{for(let n=0;n=0&&(es+=t.size,eso&&(r=p):g==i+1&&(c=p);else if(h==n+1)if(a){let A=a.tag_name.substring(1).split(".");parseInt(A[0]);let I=parseInt(A[1]);parseInt(A[2]),g==I&&(a=p)}else a=p}return c||a||r||!1}else return t[0]}function Xm(e){var c,a;let t=((a=(c=e[1].header)==null?void 0:c.uptime)!=null?a:"Up")+"",l,n,i;function o(_,p){return _[2]>1?cb:_[2]>0?rb:_[3]>1?ub:_[3]>0?fb:_[4]>1?ab:_[4]>0?ob:sb}let f=o(e),r=f(e);return{c(){l=k(t),n=b(),r.c(),i=Ut()},m(_,p){P(_,l,p),P(_,n,p),r.m(_,p),P(_,i,p)},p(_,p){var v,d;p&2&&t!==(t=((d=(v=_[1].header)==null?void 0:v.uptime)!=null?d:"Up")+"")&&C(l,t),f===(f=o(_))&&r?r.p(_,p):(r.d(1),r=f(_),r&&(r.c(),r.m(i.parentNode,i)))},d(_){_&&T(l),_&&T(n),r.d(_),_&&T(i)}}}function sb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.seconds)!=null?f:"s")+"",i;return{c(){t=k(e[0]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&1&&C(t,r[0]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.seconds)!=null?_:"s")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function ob(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.minute)!=null?f:"m")+"",i;return{c(){t=k(e[4]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&16&&C(t,r[4]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.minute)!=null?_:"m")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function ab(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.minutes)!=null?f:"m")+"",i;return{c(){t=k(e[4]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&16&&C(t,r[4]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.minutes)!=null?_:"m")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function fb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.hour)!=null?f:"h")+"",i;return{c(){t=k(e[3]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&8&&C(t,r[3]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.hour)!=null?_:"h")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function ub(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.hours)!=null?f:"h")+"",i;return{c(){t=k(e[3]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&8&&C(t,r[3]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.hours)!=null?_:"h")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function rb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.day)!=null?f:"d")+"",i;return{c(){t=k(e[2]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&4&&C(t,r[2]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.day)!=null?_:"d")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function cb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.days)!=null?f:"d")+"",i;return{c(){t=k(e[2]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&4&&C(t,r[2]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.days)!=null?_:"d")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function _b(e){let t,l=e[0]&&Xm(e);return{c(){l&&l.c(),t=Ut()},m(n,i){l&&l.m(n,i),P(n,t,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Xm(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},i:ze,o:ze,d(n){l&&l.d(n),n&&T(t)}}}function mb(e,t,l){let{epoch:n}=t,i={};Ml.subscribe(c=>{l(1,i=c)});let o=0,f=0,r=0;return e.$$set=c=>{"epoch"in c&&l(0,n=c.epoch)},e.$$.update=()=>{e.$$.dirty&1&&(l(2,o=Math.floor(n/86400)),l(3,f=Math.floor(n/3600)),l(4,r=Math.floor(n/60)))},[n,i,o,f,r]}class pb extends mt{constructor(t){super(),_t(this,t,mb,_b,ct,{epoch:0})}}function db(e){let t,l,n;return{c(){t=m("span"),l=k(e[2]),u(t,"title",e[1]),u(t,"class",n="bd-"+e[0])},m(i,o){P(i,t,o),s(t,l)},p(i,[o]){o&4&&C(l,i[2]),o&2&&u(t,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(t,"class",n)},i:ze,o:ze,d(i){i&&T(t)}}}function vb(e,t,l){let{color:n}=t,{title:i}=t,{text:o}=t;return e.$$set=f=>{"color"in f&&l(0,n=f.color),"title"in f&&l(1,i=f.title),"text"in f&&l(2,o=f.text)},[n,i,o]}class di extends mt{constructor(t){super(),_t(this,t,vb,db,ct,{color:0,title:1,text:2})}}function hb(e){let t,l=`${ht(e[0].getDate())}.${ht(e[0].getMonth()+1)}.${e[0].getFullYear()} ${ht(e[0].getHours())}:${ht(e[0].getMinutes())}`,n;return{c(){t=m("span"),n=k(l),u(t,"class",e[1])},m(i,o){P(i,t,o),s(t,n)},p(i,o){o&1&&l!==(l=`${ht(i[0].getDate())}.${ht(i[0].getMonth()+1)}.${i[0].getFullYear()} ${ht(i[0].getHours())}:${ht(i[0].getMinutes())}`)&&C(n,l),o&2&&u(t,"class",i[1])},d(i){i&&T(t)}}}function bb(e){var n;let t=`${ht(e[0].getDate())}. ${e[2].months?(n=e[2].months)==null?void 0:n[e[0].getMonth()]:ht(e[0].getMonth())} ${ht(e[0].getHours())}:${ht(e[0].getMinutes())}`,l;return{c(){l=k(t)},m(i,o){P(i,l,o)},p(i,o){var f;o&5&&t!==(t=`${ht(i[0].getDate())}. ${i[2].months?(f=i[2].months)==null?void 0:f[i[0].getMonth()]:ht(i[0].getMonth())} ${ht(i[0].getHours())}:${ht(i[0].getMinutes())}`)&&C(l,t)},d(i){i&&T(l)}}}function gb(e){let t;function l(o,f){return o[3]?bb:hb}let n=l(e),i=n(e);return{c(){i.c(),t=Ut()},m(o,f){i.m(o,f),P(o,t,f)},p(o,[f]){n===(n=l(o))&&i?i.p(o,f):(i.d(1),i=n(o),i&&(i.c(),i.m(t.parentNode,t)))},i:ze,o:ze,d(o){i.d(o),o&&T(t)}}}function kb(e,t,l){let n={};Ml.subscribe(c=>{l(2,n=c)});let{timestamp:i}=t,{fullTimeColor:o}=t,{offset:f}=t,r;return e.$$set=c=>{"timestamp"in c&&l(0,i=c.timestamp),"fullTimeColor"in c&&l(1,o=c.fullTimeColor),"offset"in c&&l(4,f=c.offset)},e.$$.update=()=>{e.$$.dirty&17&&(l(3,r=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(f)||Nn(i,f-(24+i.getHours()-i.getUTCHours())%24))},[i,o,n,r,f]}class Ev extends mt{constructor(t){super(),_t(this,t,kb,gb,ct,{timestamp:0,fullTimeColor:1,offset:4})}}function wb(e){let t,l,n;return{c(){t=bt("svg"),l=bt("path"),n=bt("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"fill","none"),u(t,"viewBox","0 0 24 24"),u(t,"stroke-width","1.5"),u(t,"stroke","currentColor"),u(t,"class","w-6 h-6")},m(i,o){P(i,t,o),s(t,l),s(t,n)},p:ze,i:ze,o:ze,d(i){i&&T(t)}}}class Mb extends mt{constructor(t){super(),_t(this,t,null,wb,ct,{})}}function Sb(e){let t,l;return{c(){t=bt("svg"),l=bt("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"fill","none"),u(t,"viewBox","0 0 24 24"),u(t,"stroke-width","1.5"),u(t,"stroke","currentColor"),u(t,"class","w-6 h-6")},m(n,i){P(n,t,i),s(t,l)},p:ze,i:ze,o:ze,d(n){n&&T(t)}}}class Cb extends mt{constructor(t){super(),_t(this,t,null,Sb,ct,{})}}function Nb(e){let t,l;return{c(){t=bt("svg"),l=bt("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"fill","none"),u(t,"viewBox","0 0 24 24"),u(t,"stroke-width","1.5"),u(t,"stroke","currentColor"),u(t,"class","w-6 h-6")},m(n,i){P(n,t,i),s(t,l)},p:ze,i:ze,o:ze,d(n){n&&T(t)}}}class Tb extends mt{constructor(t){super(),_t(this,t,null,Nb,ct,{})}}function Pb(e){let t,l,n=e[2].version+"",i;return{c(){t=k("AMS reader "),l=m("span"),i=k(n)},m(o,f){P(o,t,f),P(o,l,f),s(l,i)},p(o,f){f&4&&n!==(n=o[2].version+"")&&C(i,n)},d(o){o&&T(t),o&&T(l)}}}function Zm(e){let t,l=(e[1].t>-50?e[1].t.toFixed(1):"-")+"",n,i;return{c(){t=m("div"),n=k(l),i=k("\xB0C"),u(t,"class","flex-none my-auto")},m(o,f){P(o,t,f),s(t,n),s(t,i)},p(o,f){f&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&C(n,l)},d(o){o&&T(t)}}}function Jm(e){var i,o,f,r,c;let t,l=((o=(i=e[4].header)==null?void 0:i.han)!=null?o:"HAN")+": "+((c=(r=(f=e[4].errors)==null?void 0:f.han)==null?void 0:r[e[1].he])!=null?c:e[1].he),n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(a,_){P(a,t,_),s(t,n)},p(a,_){var p,v,d,h,g;_&18&&l!==(l=((v=(p=a[4].header)==null?void 0:p.han)!=null?v:"HAN")+": "+((g=(h=(d=a[4].errors)==null?void 0:d.han)==null?void 0:h[a[1].he])!=null?g:a[1].he))&&C(n,l)},d(a){a&&T(t)}}}function $m(e){var i,o,f,r,c;let t,l=((o=(i=e[4].header)==null?void 0:i.mqtt)!=null?o:"MQTT")+": "+((c=(r=(f=e[4].errors)==null?void 0:f.mqtt)==null?void 0:r[e[1].me])!=null?c:e[1].me),n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(a,_){P(a,t,_),s(t,n)},p(a,_){var p,v,d,h,g;_&18&&l!==(l=((v=(p=a[4].header)==null?void 0:p.mqtt)!=null?v:"MQTT")+": "+((g=(h=(d=a[4].errors)==null?void 0:d.mqtt)==null?void 0:h[a[1].me])!=null?g:a[1].me))&&C(n,l)},d(a){a&&T(t)}}}function xm(e){var i,o,f,r,c;let t,l=((o=(i=e[4].header)==null?void 0:i.price)!=null?o:"PS")+": "+((c=(r=(f=e[4].errors)==null?void 0:f.price)==null?void 0:r[e[1].ee])!=null?c:e[1].ee),n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(a,_){P(a,t,_),s(t,n)},p(a,_){var p,v,d,h,g;_&18&&l!==(l=((v=(p=a[4].header)==null?void 0:p.price)!=null?v:"PS")+": "+((g=(h=(d=a[4].errors)==null?void 0:d.price)==null?void 0:h[a[1].ee])!=null?g:a[1].ee))&&C(n,l)},d(a){a&&T(t)}}}function ep(e){let t,l,n,i,o,f,r,c;return l=new nn({props:{to:"/configuration",$$slots:{default:[Eb]},$$scope:{ctx:e}}}),f=new nn({props:{to:"/status",$$slots:{default:[Ab]},$$scope:{ctx:e}}}),{c(){var a,_,p,v;t=m("div"),Ne(l.$$.fragment),i=b(),o=m("div"),Ne(f.$$.fragment),u(t,"class","flex-none px-1 mt-1"),u(t,"title",n=(_=(a=e[4].header)==null?void 0:a.config)!=null?_:""),u(o,"class","flex-none px-1 mt-1"),u(o,"title",r=(v=(p=e[4].header)==null?void 0:p.status)!=null?v:"")},m(a,_){P(a,t,_),Se(l,t,null),P(a,i,_),P(a,o,_),Se(f,o,null),c=!0},p(a,_){var d,h,g,M;const p={};_&64&&(p.$$scope={dirty:_,ctx:a}),l.$set(p),(!c||_&16&&n!==(n=(h=(d=a[4].header)==null?void 0:d.config)!=null?h:""))&&u(t,"title",n);const v={};_&64&&(v.$$scope={dirty:_,ctx:a}),f.$set(v),(!c||_&16&&r!==(r=(M=(g=a[4].header)==null?void 0:g.status)!=null?M:""))&&u(o,"title",r)},i(a){c||(Q(l.$$.fragment,a),Q(f.$$.fragment,a),c=!0)},o(a){ee(l.$$.fragment,a),ee(f.$$.fragment,a),c=!1},d(a){a&&T(t),Ce(l),a&&T(i),a&&T(o),Ce(f)}}}function Eb(e){let t,l;return t=new Mb({}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Ab(e){let t,l;return t=new Cb({}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function tp(e){let t,l;function n(f,r){return f[2].security==0||f[1].a?qb:Db}let i=n(e),o=i(e);return{c(){var f,r;t=m("div"),o.c(),u(t,"class","flex-none mr-3 text-yellow-500"),u(t,"title",l=((r=(f=e[4].header)==null?void 0:f.new_version)!=null?r:"New version")+": "+e[3].tag_name)},m(f,r){P(f,t,r),o.m(t,null)},p(f,r){var c,a;i===(i=n(f))&&o?o.p(f,r):(o.d(1),o=i(f),o&&(o.c(),o.m(t,null))),r&24&&l!==(l=((a=(c=f[4].header)==null?void 0:c.new_version)!=null?a:"New version")+": "+f[3].tag_name)&&u(t,"title",l)},d(f){f&&T(t),o.d()}}}function Db(e){var r,c;let t,l=((c=(r=e[4].header)==null?void 0:r.new_version)!=null?c:"New version")+"",n,i,o=e[3].tag_name+"",f;return{c(){t=m("span"),n=k(l),i=k(": "),f=k(o)},m(a,_){P(a,t,_),s(t,n),s(t,i),s(t,f)},p(a,_){var p,v;_&16&&l!==(l=((v=(p=a[4].header)==null?void 0:p.new_version)!=null?v:"New version")+"")&&C(n,l),_&8&&o!==(o=a[3].tag_name+"")&&C(f,o)},d(a){a&&T(t)}}}function qb(e){var _,p;let t,l,n=((p=(_=e[4].header)==null?void 0:_.new_version)!=null?p:"New version")+"",i,o,f=e[3].tag_name+"",r,c,a;return{c(){t=m("button"),l=m("span"),i=k(n),o=k(": "),r=k(f),u(l,"class","mt-1"),u(t,"class","flex")},m(v,d){P(v,t,d),s(t,l),s(l,i),s(l,o),s(l,r),c||(a=re(t,"click",e[5]),c=!0)},p(v,d){var h,g;d&16&&n!==(n=((g=(h=v[4].header)==null?void 0:h.new_version)!=null?g:"New version")+"")&&C(i,n),d&8&&f!==(f=v[3].tag_name+"")&&C(r,f)},d(v){v&&T(t),c=!1,a()}}}function Ob(e){var te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt,Te;let t,l,n,i,o,f,r,c,a,_,p,v=((le=(te=e[4].header)==null?void 0:te.mem)!=null?le:"Free")+"",d,h,g=(e[1].m?(e[1].m/1e3).toFixed(1):"-")+"",M,A,I,q,L,O,U,E,B,z,W,F,R,K,y,H,Y,X,J,$,ce,ie,oe,ae,se,x,me,pe,V,Z,ge;i=new nn({props:{to:"/",$$slots:{default:[Pb]},$$scope:{ctx:e}}}),c=new pb({props:{epoch:e[1].u}});let ve=e[1].t>-50&&Zm(e);L=new di({props:{title:(de=(fe=e[4].header)==null?void 0:fe.esp)!=null?de:"ESP",text:e[2].booting?(Pe=(qe=e[4].header)==null?void 0:qe.booting)!=null?Pe:"Booting":e[1].v>2?e[1].v.toFixed(2)+"V":(Fe=(we=e[4].header)==null?void 0:we.esp)!=null?Fe:"ESP",color:Jn(e[2].booting?2:e[1].em)}}),U=new di({props:{title:(ke=(Ae=e[4].header)==null?void 0:Ae.han)!=null?ke:"HAN",text:(He=(De=e[4].header)==null?void 0:De.han)!=null?He:"HAN",color:Jn(e[2].booting?9:e[1].hm)}}),B=new di({props:{title:(je=(Oe=e[4].header)==null?void 0:Oe.wifi)!=null?je:"WiFi",text:e[1].r?e[1].r.toFixed(0)+"dBm":(We=(Ye=e[4].header)==null?void 0:Ye.wifi)!=null?We:"WiFi",color:Jn(e[2].booting?9:e[1].wm)}}),W=new di({props:{title:(xe=($e=e[4].header)==null?void 0:$e.mqtt)!=null?xe:"MQTT",text:(Te=(tt=e[4].header)==null?void 0:tt.mqtt)!=null?Te:"MQTT",color:Jn(e[2].booting?9:e[1].mm)}});let S=(e[1].he<0||e[1].he>0)&&Jm(e),w=e[1].me<0&&$m(e),N=(e[1].ee>0||e[1].ee<0)&&xm(e);oe=new Ev({props:{timestamp:e[1].c?new Date(e[1].c*1e3):new Date(0),offset:e[2].clock_offset,fullTimeColor:"text-red-500"}});let D=e[2].vndcfg&&e[2].usrcfg&&ep(e);pe=new Tb({});let j=e[2].fwconsent===1&&e[3]&&tp(e);return{c(){var ue,Ie;t=m("nav"),l=m("div"),n=m("div"),Ne(i.$$.fragment),o=b(),f=m("div"),r=m("div"),Ne(c.$$.fragment),a=b(),ve&&ve.c(),_=b(),p=m("div"),d=k(v),h=k(": "),M=k(g),A=k("kb"),I=b(),q=m("div"),Ne(L.$$.fragment),O=b(),Ne(U.$$.fragment),E=b(),Ne(B.$$.fragment),z=b(),Ne(W.$$.fragment),F=b(),S&&S.c(),R=b(),w&&w.c(),K=b(),N&&N.c(),y=b(),H=m("div"),Y=m("div"),X=m("a"),J=m("img"),ce=b(),ie=m("div"),Ne(oe.$$.fragment),ae=b(),D&&D.c(),se=b(),x=m("div"),me=m("a"),Ne(pe.$$.fragment),Z=b(),j&&j.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(p,"class","flex-none my-auto"),u(f,"class","flex-none my-auto p-2 flex space-x-4"),u(q,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(J,"class","logo"),jo(J.src,$=(e[0]+"/logo.svg").replace("//","/"))||u(J,"src",$),u(J,"alt","GitHub repo"),u(X,"class","float-right"),u(X,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(X,"target","_blank"),u(X,"rel","noreferrer"),u(X,"aria-label","GitHub"),u(Y,"class","flex-none"),u(ie,"class","flex-none my-auto px-2"),u(me,"href",Wl("")),u(me,"target","_blank"),u(me,"rel","noreferrer"),u(x,"class","flex-none px-1 mt-1"),u(x,"title",V=(Ie=(ue=e[4].header)==null?void 0:ue.doc)!=null?Ie:""),u(H,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(t,"class","hdr")},m(ue,Ie){P(ue,t,Ie),s(t,l),s(l,n),Se(i,n,null),s(l,o),s(l,f),s(f,r),Se(c,r,null),s(f,a),ve&&ve.m(f,null),s(f,_),s(f,p),s(p,d),s(p,h),s(p,M),s(p,A),s(l,I),s(l,q),Se(L,q,null),s(q,O),Se(U,q,null),s(q,E),Se(B,q,null),s(q,z),Se(W,q,null),s(l,F),S&&S.m(l,null),s(l,R),w&&w.m(l,null),s(l,K),N&&N.m(l,null),s(l,y),s(l,H),s(H,Y),s(Y,X),s(X,J),s(H,ce),s(H,ie),Se(oe,ie,null),s(H,ae),D&&D.m(H,null),s(H,se),s(H,x),s(x,me),Se(pe,me,null),s(H,Z),j&&j.m(H,null),ge=!0},p(ue,[Ie]){var gt,At,Pt,Be,ye,It,vt,nt,Tt,it,at,rt,jt,Lt,Ht,yt,Me,Ve,Rt,Gt,zt,Dt;const kt={};Ie&68&&(kt.$$scope={dirty:Ie,ctx:ue}),i.$set(kt);const lt={};Ie&2&&(lt.epoch=ue[1].u),c.$set(lt),ue[1].t>-50?ve?ve.p(ue,Ie):(ve=Zm(ue),ve.c(),ve.m(f,_)):ve&&(ve.d(1),ve=null),(!ge||Ie&16)&&v!==(v=((At=(gt=ue[4].header)==null?void 0:gt.mem)!=null?At:"Free")+"")&&C(d,v),(!ge||Ie&2)&&g!==(g=(ue[1].m?(ue[1].m/1e3).toFixed(1):"-")+"")&&C(M,g);const wt={};Ie&16&&(wt.title=(Be=(Pt=ue[4].header)==null?void 0:Pt.esp)!=null?Be:"ESP"),Ie&22&&(wt.text=ue[2].booting?(It=(ye=ue[4].header)==null?void 0:ye.booting)!=null?It:"Booting":ue[1].v>2?ue[1].v.toFixed(2)+"V":(nt=(vt=ue[4].header)==null?void 0:vt.esp)!=null?nt:"ESP"),Ie&6&&(wt.color=Jn(ue[2].booting?2:ue[1].em)),L.$set(wt);const st={};Ie&16&&(st.title=(it=(Tt=ue[4].header)==null?void 0:Tt.han)!=null?it:"HAN"),Ie&16&&(st.text=(rt=(at=ue[4].header)==null?void 0:at.han)!=null?rt:"HAN"),Ie&6&&(st.color=Jn(ue[2].booting?9:ue[1].hm)),U.$set(st);const ot={};Ie&16&&(ot.title=(Lt=(jt=ue[4].header)==null?void 0:jt.wifi)!=null?Lt:"WiFi"),Ie&18&&(ot.text=ue[1].r?ue[1].r.toFixed(0)+"dBm":(yt=(Ht=ue[4].header)==null?void 0:Ht.wifi)!=null?yt:"WiFi"),Ie&6&&(ot.color=Jn(ue[2].booting?9:ue[1].wm)),B.$set(ot);const et={};Ie&16&&(et.title=(Ve=(Me=ue[4].header)==null?void 0:Me.mqtt)!=null?Ve:"MQTT"),Ie&16&&(et.text=(Gt=(Rt=ue[4].header)==null?void 0:Rt.mqtt)!=null?Gt:"MQTT"),Ie&6&&(et.color=Jn(ue[2].booting?9:ue[1].mm)),W.$set(et),ue[1].he<0||ue[1].he>0?S?S.p(ue,Ie):(S=Jm(ue),S.c(),S.m(l,R)):S&&(S.d(1),S=null),ue[1].me<0?w?w.p(ue,Ie):(w=$m(ue),w.c(),w.m(l,K)):w&&(w.d(1),w=null),ue[1].ee>0||ue[1].ee<0?N?N.p(ue,Ie):(N=xm(ue),N.c(),N.m(l,y)):N&&(N.d(1),N=null),(!ge||Ie&1&&!jo(J.src,$=(ue[0]+"/logo.svg").replace("//","/")))&&u(J,"src",$);const Nt={};Ie&2&&(Nt.timestamp=ue[1].c?new Date(ue[1].c*1e3):new Date(0)),Ie&4&&(Nt.offset=ue[2].clock_offset),oe.$set(Nt),ue[2].vndcfg&&ue[2].usrcfg?D?(D.p(ue,Ie),Ie&4&&Q(D,1)):(D=ep(ue),D.c(),Q(D,1),D.m(H,se)):D&&(pt(),ee(D,1,1,()=>{D=null}),dt()),(!ge||Ie&16&&V!==(V=(Dt=(zt=ue[4].header)==null?void 0:zt.doc)!=null?Dt:""))&&u(x,"title",V),ue[2].fwconsent===1&&ue[3]?j?j.p(ue,Ie):(j=tp(ue),j.c(),j.m(H,null)):j&&(j.d(1),j=null)},i(ue){ge||(Q(i.$$.fragment,ue),Q(c.$$.fragment,ue),Q(L.$$.fragment,ue),Q(U.$$.fragment,ue),Q(B.$$.fragment,ue),Q(W.$$.fragment,ue),Q(oe.$$.fragment,ue),Q(D),Q(pe.$$.fragment,ue),ge=!0)},o(ue){ee(i.$$.fragment,ue),ee(c.$$.fragment,ue),ee(L.$$.fragment,ue),ee(U.$$.fragment,ue),ee(B.$$.fragment,ue),ee(W.$$.fragment,ue),ee(oe.$$.fragment,ue),ee(D),ee(pe.$$.fragment,ue),ge=!1},d(ue){ue&&T(t),Ce(i),Ce(c),ve&&ve.d(),Ce(L),Ce(U),Ce(B),Ce(W),S&&S.d(),w&&w.d(),N&&N.d(),Ce(oe),D&&D.d(),Ce(pe),j&&j.d()}}}function Ib(e,t,l){let{basepath:n="/"}=t,{data:i={}}=t,o={},f={};function r(){var a,_;confirm(((_=(a=c.header)==null?void 0:a.upgrade)!=null?_:"Upgrade to {0}?").replace("{0}",f.tag_name))&&(!ns(o.board)||confirm(Vo(Ge(o.chip,o.board))))&&(wl.update(p=>(p.upgrading=!0,p)),Tv(f.tag_name))}wl.subscribe(a=>{l(2,o=a),a.fwconsent===1&&nb()}),Cf.subscribe(a=>{l(3,f=Pv(o.version,a))});let c={};return Ml.subscribe(a=>{l(4,c=a)}),e.$$set=a=>{"basepath"in a&&l(0,n=a.basepath),"data"in a&&l(1,i=a.data)},[n,i,o,f,c,r]}class Lb extends mt{constructor(t){super(),_t(this,t,Ib,Ob,ct,{basepath:0,data:1})}}function Rb(e){let t,l,n,i;return{c(){t=bt("svg"),l=bt("path"),n=bt("path"),u(l,"d",Va(150,150,115,210,510)),u(l,"stroke","rgba(128, 128, 128, 0.15)"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Va(150,150,115,210,210+300*e[0]/100)),u(n,"stroke",e[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(t,"viewBox","0 0 300 300"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"height","100%")},m(o,f){P(o,t,f),s(t,l),s(t,n)},p(o,[f]){f&1&&i!==(i=Va(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),f&2&&u(n,"stroke",o[1])},i:ze,o:ze,d(o){o&&T(t)}}}function lp(e,t,l,n){var i=(n-90)*Math.PI/180;return{x:e+l*Math.cos(i),y:t+l*Math.sin(i)}}function Va(e,t,l,n,i){var o=lp(e,t,l,i),f=lp(e,t,l,n),r=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,r,0,f.x,f.y].join(" ");return c}function Fb(e,t,l){let{pct:n=0}=t,{color:i="red"}=t;return e.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class Bb extends mt{constructor(t){super(),_t(this,t,Fb,Rb,ct,{pct:0,color:1})}}function np(e){let t,l,n,i,o,f,r,c;return{c(){t=m("br"),l=b(),n=m("span"),i=k(e[1]),o=b(),f=m("span"),r=k(e[2]),c=k("/kWh"),u(n,"class","pl-sub"),u(f,"class","pl-snt")},m(a,_){P(a,t,_),P(a,l,_),P(a,n,_),s(n,i),P(a,o,_),P(a,f,_),s(f,r),s(f,c)},p(a,_){_&2&&C(i,a[1]),_&4&&C(r,a[2])},d(a){a&&T(t),a&&T(l),a&&T(n),a&&T(o),a&&T(f)}}}function Ub(e){let t,l,n,i,o,f,r,c,a,_,p=e[4][0]+"",v,d,h,g=e[4][1]+"",M,A,I;l=new Bb({props:{pct:e[5],color:e[3](e[5],document.documentElement.classList.contains("dark"))}});let q=e[1]&&np(e);return{c(){t=m("div"),Ne(l.$$.fragment),n=b(),i=m("span"),o=m("span"),f=k(e[0]),r=b(),c=m("br"),a=b(),_=m("span"),v=k(p),d=b(),h=m("span"),M=k(g),A=b(),q&&q.c(),u(o,"class","pl-lab"),u(_,"class","pl-val"),u(h,"class","pl-unt"),u(i,"class","pl-ov"),u(t,"class","pl-root")},m(L,O){P(L,t,O),Se(l,t,null),s(t,n),s(t,i),s(i,o),s(o,f),s(i,r),s(i,c),s(i,a),s(i,_),s(_,v),s(i,d),s(i,h),s(h,M),s(i,A),q&&q.m(i,null),I=!0},p(L,[O]){const U={};O&32&&(U.pct=L[5]),O&40&&(U.color=L[3](L[5],document.documentElement.classList.contains("dark"))),l.$set(U),(!I||O&1)&&C(f,L[0]),(!I||O&16)&&p!==(p=L[4][0]+"")&&C(v,p),(!I||O&16)&&g!==(g=L[4][1]+"")&&C(M,g),L[1]?q?q.p(L,O):(q=np(L),q.c(),q.m(i,null)):q&&(q.d(1),q=null)},i(L){I||(Q(l.$$.fragment,L),I=!0)},o(L){ee(l.$$.fragment,L),I=!1},d(L){L&&T(t),Ce(l),q&&q.d()}}}function jb(e,t,l){let{val:n}=t,{max:i}=t,{unit:o}=t,{label:f}=t,{sub:r=""}=t,{subunit:c=""}=t,{colorFn:a}=t,_,p=0;return e.$$set=v=>{"val"in v&&l(6,n=v.val),"max"in v&&l(7,i=v.max),"unit"in v&&l(8,o=v.unit),"label"in v&&l(0,f=v.label),"sub"in v&&l(1,r=v.sub),"subunit"in v&&l(2,c=v.subunit),"colorFn"in v&&l(3,a=v.colorFn)},e.$$.update=()=>{e.$$.dirty&448&&(l(4,_=gl(n,o)),l(5,p=Math.min(n,i)/i*100))},[f,r,c,a,_,p,n,i,o]}class Av extends mt{constructor(t){super(),_t(this,t,jb,Ub,ct,{val:6,max:7,unit:8,label:0,sub:1,subunit:2,colorFn:3})}}function ip(e,t,l){const n=e.slice();return n[11]=t[l],n[13]=l,n}function sp(e,t,l){const n=e.slice();return n[11]=t[l],n[13]=l,n}function op(e,t,l){const n=e.slice();return n[15]=t[l],n}function ap(e){let t,l,n,i,o,f,r=e[0].title&&fp(e),c=e[0].y.ticks,a=[];for(let h=0;he[9].call(t))},m(o,f){P(o,t,f),s(t,n),i=pf(t,e[9].bind(t))},p(o,f){f&1&&l!==(l=o[0].title+"")&&C(n,l)},d(o){o&&T(t),i()}}}function up(e){let t,l,n,i=e[15].label+"",o,f,r,c;return{c(){t=bt("g"),l=bt("line"),n=bt("text"),o=k(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",f=e[15].align=="right"?"85%":""),u(t,"class",r="tick tick-"+e[15].value+" tick-"+e[15].color),u(t,"transform",c="translate(0, "+e[7](e[15].value)+")")},m(a,_){P(a,t,_),s(t,l),s(t,n),s(n,o)},p(a,_){_&1&&i!==(i=a[15].label+"")&&C(o,i),_&1&&f!==(f=a[15].align=="right"?"85%":"")&&u(n,"x",f),_&1&&r!==(r="tick tick-"+a[15].value+" tick-"+a[15].color)&&u(t,"class",r),_&129&&c!==(c="translate(0, "+a[7](a[15].value)+")")&&u(t,"transform",c)},d(a){a&&T(t)}}}function rp(e){let t=!isNaN(e[7](e[15].value)),l,n=t&&up(e);return{c(){n&&n.c(),l=Ut()},m(i,o){n&&n.m(i,o),P(i,l,o)},p(i,o){o&129&&(t=!isNaN(i[7](i[15].value))),t?n?n.p(i,o):(n=up(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&T(l)}}}function cp(e){let t,l,n=(e[3]>20||e[13]%2==0)&&_p(e);return{c(){t=bt("g"),n&&n.c(),u(t,"class","tick"),u(t,"transform",l="translate("+e[6](e[13])+","+e[4]+")")},m(i,o){P(i,t,o),n&&n.m(t,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=_p(i),n.c(),n.m(t,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&u(t,"transform",l)},d(i){i&&T(t),n&&n.d()}}}function _p(e){let t,l=e[11].label+"",n,i;return{c(){t=bt("text"),n=k(l),u(t,"x",i=e[3]/2),u(t,"y","-4")},m(o,f){P(o,t,f),s(t,n)},p(o,f){f&1&&l!==(l=o[11].label+"")&&C(n,l),f&8&&i!==(i=o[3]/2)&&u(t,"x",i)},d(o){o&&T(t)}}}function mp(e){let t=!isNaN(e[6](e[13])),l,n=t&&cp(e);return{c(){n&&n.c(),l=Ut()},m(i,o){n&&n.m(i,o),P(i,l,o)},p(i,o){o&64&&(t=!isNaN(i[6](i[13]))),t?n?n.p(i,o):(n=cp(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&T(l)}}}function pp(e){let t,l,n=e[11].value!==void 0&&dp(e),i=e[11].value2>1e-4&&bp(e);return{c(){t=bt("g"),n&&n.c(),l=bt("g"),i&&i.c()},m(o,f){P(o,t,f),n&&n.m(t,null),P(o,l,f),i&&i.m(l,null)},p(o,f){o[11].value!==void 0?n?n.p(o,f):(n=dp(o),n.c(),n.m(t,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,f):(i=bp(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&T(t),n&&n.d(),o&&T(l),i&&i.d()}}}function dp(e){let t,l,n,i,o,f,r,c=e[3]>15&&vp(e);return{c(){t=bt("rect"),c&&c.c(),r=Ut(),u(t,"x",l=e[6](e[13])+2),u(t,"y",n=e[7](e[11].value)),u(t,"width",i=e[3]-4),u(t,"height",o=e[7](e[0].y.min)-e[7](Math.min(e[0].y.min,0)+e[11].value)),u(t,"fill",f=e[11].color)},m(a,_){P(a,t,_),c&&c.m(a,_),P(a,r,_)},p(a,_){_&64&&l!==(l=a[6](a[13])+2)&&u(t,"x",l),_&129&&n!==(n=a[7](a[11].value))&&u(t,"y",n),_&8&&i!==(i=a[3]-4)&&u(t,"width",i),_&129&&o!==(o=a[7](a[0].y.min)-a[7](Math.min(a[0].y.min,0)+a[11].value))&&u(t,"height",o),_&1&&f!==(f=a[11].color)&&u(t,"fill",f),a[3]>15?c?c.p(a,_):(c=vp(a),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(a){a&&T(t),c&&c.d(a),a&&T(r)}}}function vp(e){let t,l=e[11].label+"",n,i,o,f,r,c,a=e[11].title&&hp(e);return{c(){t=bt("text"),n=k(l),a&&a.c(),c=Ut(),u(t,"width",i=e[3]-4),u(t,"dominant-baseline","middle"),u(t,"text-anchor",o=e[3]e[7](0)-e[8]?e[11].color:"white"),u(t,"transform",r="translate("+(e[6](e[13])+e[3]/2)+" "+(e[7](e[11].value)>e[7](0)-e[8]?e[7](e[11].value)-e[8]:e[7](e[11].value)+10)+") rotate("+(e[11].labelAngle?e[11].labelAngle:e[3]_[7](0)-_[8]?_[11].color:"white")&&u(t,"fill",f),p&457&&r!==(r="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[11].labelAngle?_[11].labelAngle:_[3]15&&gp(e);return{c(){t=bt("rect"),c&&c.c(),r=Ut(),u(t,"x",l=e[6](e[13])+2),u(t,"y",n=e[7](0)),u(t,"width",i=e[3]-4),u(t,"height",o=e[7](e[0].y.min)-e[7](e[0].y.min+e[11].value2)),u(t,"fill",f=e[11].color2?e[11].color2:e[11].color)},m(a,_){P(a,t,_),c&&c.m(a,_),P(a,r,_)},p(a,_){_&64&&l!==(l=a[6](a[13])+2)&&u(t,"x",l),_&128&&n!==(n=a[7](0))&&u(t,"y",n),_&8&&i!==(i=a[3]-4)&&u(t,"width",i),_&129&&o!==(o=a[7](a[0].y.min)-a[7](a[0].y.min+a[11].value2))&&u(t,"height",o),_&1&&f!==(f=a[11].color2?a[11].color2:a[11].color)&&u(t,"fill",f),a[3]>15?c?c.p(a,_):(c=gp(a),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(a){a&&T(t),c&&c.d(a),a&&T(r)}}}function gp(e){let t,l=e[11].label2+"",n,i,o,f,r,c=e[11].title2&&kp(e);return{c(){t=bt("text"),n=k(l),c&&c.c(),r=Ut(),u(t,"width",i=e[3]-4),u(t,"dominant-baseline","middle"),u(t,"text-anchor","middle"),u(t,"fill",o=e[7](-e[11].value2)e[10].call(t))},m(i,o){P(i,t,o),n&&n.m(t,null),l=pf(t,e[10].bind(t))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=ap(i),n.c(),n.m(t,null)):n&&(n.d(1),n=null)},i:ze,o:ze,d(i){i&&T(t),n&&n.d(),l()}}}let vi=30;function yb(e,t,l){let{config:n}=t,i,o,f,r,c,a,_,p=0;function v(){p=this.clientHeight,l(5,p)}function d(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return e.$$set=h=>{"config"in h&&l(0,n=h.config)},e.$$.update=()=>{if(e.$$.dirty&63){l(4,a=o-p);let h=i-(n.padding.left+n.padding.right);l(3,f=h/n.points.length),l(8,_=fn.y.max?A=n.padding.bottom:Ma||A<0?0:A})}},[n,i,o,f,a,p,r,c,_,v,d]}class gi extends mt{constructor(t){super(),_t(this,t,yb,Hb,ct,{config:0})}}function zb(e){let t,l;return t=new gi({props:{config:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Wb(e,t,l){let{title:n}=t,{u1:i}=t,{u2:o}=t,{u3:f}=t,{ds:r}=t,c={};function a(_){return{label:Bt(_)+"V",title:_.toFixed(1)+" V",value:isNaN(_)?0:_,color:xh(_||0,document.documentElement.classList.contains("dark"))}}return e.$$set=_=>{"title"in _&&l(1,n=_.title),"u1"in _&&l(2,i=_.u1),"u2"in _&&l(3,o=_.u2),"u3"in _&&l(4,f=_.u3),"ds"in _&&l(5,r=_.ds)},e.$$.update=()=>{if(e.$$.dirty&62){let _=[],p=[];i>0&&(_.push({label:r===1?"L1-L2":"L1"}),p.push(a(i))),o>0&&(_.push({label:r===1?"L1-L3":"L2"}),p.push(a(o))),f>0&&(_.push({label:r===1?"L2-L3":"L3"}),p.push(a(f))),l(0,c={title:n,padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:_},points:p})}},[c,n,i,o,f,r]}class Gb extends mt{constructor(t){super(),_t(this,t,Wb,zb,ct,{title:1,u1:2,u2:3,u3:4,ds:5})}}function Vb(e){var D,j,te,le,fe,de,qe,Pe,we,Fe;let t,l,n=((j=(D=e[0].reactive)==null?void 0:D.title)!=null?j:"Reactive")+"",i,o,f,r,c=((le=(te=e[0].reactive)==null?void 0:te.instant_in)!=null?le:"Instant in")+"",a,_,p,v=e[1][0]+"",d,h,g=e[1][1]+"",M,A,I,q=((de=(fe=e[0].reactive)==null?void 0:fe.instant_out)!=null?de:"Instant out")+"",L,O,U,E=e[2][0]+"",B,z,W=e[2][1]+"",F,R,K,y,H=((Pe=(qe=e[0].reactive)==null?void 0:qe.total_in)!=null?Pe:"Total in")+"",Y,X,J,$=e[3][0]+"",ce,ie,oe=e[3][1]+"",ae,se,x,me=((Fe=(we=e[0].reactive)==null?void 0:we.total_out)!=null?Fe:"Total out")+"",pe,V,Z,ge=e[4][0]+"",ve,S,w=e[4][1]+"",N;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("div"),r=m("div"),a=k(c),_=b(),p=m("div"),d=k(v),h=b(),M=k(g),A=b(),I=m("div"),L=k(q),O=b(),U=m("div"),B=k(E),z=b(),F=k(W),R=b(),K=m("div"),y=m("div"),Y=k(H),X=b(),J=m("div"),ce=k($),ie=b(),ae=k(oe),se=b(),x=m("div"),pe=k(me),V=b(),Z=m("div"),ve=k(ge),S=b(),N=k(w),u(p,"class","text-right"),u(U,"class","text-right"),u(f,"class","grid grid-cols-2 mt-4"),u(J,"class","text-right"),u(Z,"class","text-right"),u(K,"class","grid grid-cols-2 mt-4"),u(t,"class","mx-2 text-sm")},m(Ae,ke){P(Ae,t,ke),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(r,a),s(f,_),s(f,p),s(p,d),s(p,h),s(p,M),s(f,A),s(f,I),s(I,L),s(f,O),s(f,U),s(U,B),s(U,z),s(U,F),s(t,R),s(t,K),s(K,y),s(y,Y),s(K,X),s(K,J),s(J,ce),s(J,ie),s(J,ae),s(K,se),s(K,x),s(x,pe),s(K,V),s(K,Z),s(Z,ve),s(Z,S),s(Z,N)},p(Ae,[ke]){var De,He,Oe,je,Ye,We,$e,xe,tt,Te;ke&1&&n!==(n=((He=(De=Ae[0].reactive)==null?void 0:De.title)!=null?He:"Reactive")+"")&&C(i,n),ke&1&&c!==(c=((je=(Oe=Ae[0].reactive)==null?void 0:Oe.instant_in)!=null?je:"Instant in")+"")&&C(a,c),ke&2&&v!==(v=Ae[1][0]+"")&&C(d,v),ke&2&&g!==(g=Ae[1][1]+"")&&C(M,g),ke&1&&q!==(q=((We=(Ye=Ae[0].reactive)==null?void 0:Ye.instant_out)!=null?We:"Instant out")+"")&&C(L,q),ke&4&&E!==(E=Ae[2][0]+"")&&C(B,E),ke&4&&W!==(W=Ae[2][1]+"")&&C(F,W),ke&1&&H!==(H=((xe=($e=Ae[0].reactive)==null?void 0:$e.total_in)!=null?xe:"Total in")+"")&&C(Y,H),ke&8&&$!==($=Ae[3][0]+"")&&C(ce,$),ke&8&&oe!==(oe=Ae[3][1]+"")&&C(ae,oe),ke&1&&me!==(me=((Te=(tt=Ae[0].reactive)==null?void 0:tt.total_out)!=null?Te:"Total out")+"")&&C(pe,me),ke&16&&ge!==(ge=Ae[4][0]+"")&&C(ve,ge),ke&16&&w!==(w=Ae[4][1]+"")&&C(N,w)},i:ze,o:ze,d(Ae){Ae&&T(t)}}}function Kb(e,t,l){let{importInstant:n}=t,{exportInstant:i}=t,{importTotal:o}=t,{exportTotal:f}=t,r={};Ml.subscribe(v=>{l(0,r=v)});let c,a,_,p;return e.$$set=v=>{"importInstant"in v&&l(5,n=v.importInstant),"exportInstant"in v&&l(6,i=v.exportInstant),"importTotal"in v&&l(7,o=v.importTotal),"exportTotal"in v&&l(8,f=v.exportTotal)},e.$$.update=()=>{e.$$.dirty&480&&(l(1,c=gl(n,"VAr")),l(2,a=gl(i,"VAr")),l(3,_=gl(o*1e3,"VArh")),l(4,p=gl(f*1e3,"VArh")))},[r,c,a,_,p,n,i,o,f]}class Yb extends mt{constructor(t){super(),_t(this,t,Kb,Vb,ct,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8})}}function Mp(e){let t;function l(o,f){return o[3]?Xb:Qb}let n=l(e),i=n(e);return{c(){i.c(),t=Ut()},m(o,f){i.m(o,f),P(o,t,f)},p(o,f){n===(n=l(o))&&i?i.p(o,f):(i.d(1),i=n(o),i&&(i.c(),i.m(t.parentNode,t)))},d(o){i.d(o),o&&T(t)}}}function Qb(e){var j,te,le,fe,de,qe,Pe,we,Fe,Ae;let t,l=((te=(j=e[5].realtime)==null?void 0:j.consumption)!=null?te:"Consumption")+"",n,i,o,f,r=Vt((fe=(le=e[5].common)==null?void 0:le.hour)!=null?fe:"Hour")+"",c,a,_,p=e[6][0]+"",v,d,h=e[6][1]+"",g,M,A,I=Vt((qe=(de=e[5].common)==null?void 0:de.day)!=null?qe:"Day")+"",q,L,O,U=e[7][0]+"",E,B,z=e[7][1]+"",W,F,R,K=Vt((we=(Pe=e[5].common)==null?void 0:Pe.month)!=null?we:"Month")+"",y,H,Y,X=e[8][0]+"",J,$,ce=e[8][1]+"",ie,oe,ae,se=((Ae=(Fe=e[5].realtime)==null?void 0:Fe.last_month)!=null?Ae:"Last month")+"",x,me,pe,V=e[9][0]+"",Z,ge,ve=e[9][1]+"",S,w,N,D=e[4]&&Sp(e);return{c(){t=m("strong"),n=k(l),i=b(),o=m("div"),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),g=k(h),M=b(),A=m("div"),q=k(I),L=b(),O=m("div"),E=k(U),B=b(),W=k(z),F=b(),R=m("div"),y=k(K),H=b(),Y=m("div"),J=k(X),$=b(),ie=k(ce),oe=b(),ae=m("div"),x=k(se),me=b(),pe=m("div"),Z=k(V),ge=b(),S=k(ve),w=b(),D&&D.c(),N=Ut(),u(_,"class","text-right"),u(O,"class","text-right"),u(Y,"class","text-right"),u(pe,"class","text-right"),u(o,"class","grid grid-cols-2 mb-3")},m(ke,De){P(ke,t,De),s(t,n),P(ke,i,De),P(ke,o,De),s(o,f),s(f,c),s(o,a),s(o,_),s(_,v),s(_,d),s(_,g),s(o,M),s(o,A),s(A,q),s(o,L),s(o,O),s(O,E),s(O,B),s(O,W),s(o,F),s(o,R),s(R,y),s(o,H),s(o,Y),s(Y,J),s(Y,$),s(Y,ie),s(o,oe),s(o,ae),s(ae,x),s(o,me),s(o,pe),s(pe,Z),s(pe,ge),s(pe,S),P(ke,w,De),D&&D.m(ke,De),P(ke,N,De)},p(ke,De){var He,Oe,je,Ye,We,$e,xe,tt,Te,ue;De&32&&l!==(l=((Oe=(He=ke[5].realtime)==null?void 0:He.consumption)!=null?Oe:"Consumption")+"")&&C(n,l),De&32&&r!==(r=Vt((Ye=(je=ke[5].common)==null?void 0:je.hour)!=null?Ye:"Hour")+"")&&C(c,r),De&64&&p!==(p=ke[6][0]+"")&&C(v,p),De&64&&h!==(h=ke[6][1]+"")&&C(g,h),De&32&&I!==(I=Vt(($e=(We=ke[5].common)==null?void 0:We.day)!=null?$e:"Day")+"")&&C(q,I),De&128&&U!==(U=ke[7][0]+"")&&C(E,U),De&128&&z!==(z=ke[7][1]+"")&&C(W,z),De&32&&K!==(K=Vt((tt=(xe=ke[5].common)==null?void 0:xe.month)!=null?tt:"Month")+"")&&C(y,K),De&256&&X!==(X=ke[8][0]+"")&&C(J,X),De&256&&ce!==(ce=ke[8][1]+"")&&C(ie,ce),De&32&&se!==(se=((ue=(Te=ke[5].realtime)==null?void 0:Te.last_month)!=null?ue:"Last month")+"")&&C(x,se),De&512&&V!==(V=ke[9][0]+"")&&C(Z,V),De&512&&ve!==(ve=ke[9][1]+"")&&C(S,ve),ke[4]?D?D.p(ke,De):(D=Sp(ke),D.c(),D.m(N.parentNode,N)):D&&(D.d(1),D=null)},d(ke){ke&&T(t),ke&&T(i),ke&&T(o),ke&&T(w),D&&D.d(ke),ke&&T(N)}}}function Xb(e){var Yt,ll,fl,ul,Sl,rl,Cl,nl,_l,dl,Nl,Tl,Qt,Ee,qt,Pn,Jl,dn,En,Re;let t,l=((ll=(Yt=e[5].common)==null?void 0:Yt.import)!=null?ll:"Import")+"",n,i,o,f,r=Vt((ul=(fl=e[5].common)==null?void 0:fl.hour)!=null?ul:"Hour")+"",c,a,_,p=e[6][0]+"",v,d,h=e[6][1]+"",g,M,A,I,q=Vt((rl=(Sl=e[5].common)==null?void 0:Sl.day)!=null?rl:"Day")+"",L,O,U,E=e[7][0]+"",B,z,W=e[7][1]+"",F,R,K,y,H=Vt((nl=(Cl=e[5].common)==null?void 0:Cl.month)!=null?nl:"Month")+"",Y,X,J,$=e[8][0]+"",ce,ie,oe=e[8][1]+"",ae,se,x,me,pe=((dl=(_l=e[5].realtime)==null?void 0:_l.last_mo)!=null?dl:"Last mo.")+"",V,Z,ge,ve=e[9][0]+"",S,w,N=e[9][1]+"",D,j,te,le,fe,de=((Tl=(Nl=e[5].common)==null?void 0:Nl.export)!=null?Tl:"Export")+"",qe,Pe,we,Fe,Ae=Vt((Ee=(Qt=e[5].common)==null?void 0:Qt.hour)!=null?Ee:"Hour")+"",ke,De,He,Oe=e[10][0]+"",je,Ye,We=e[10][1]+"",$e,xe,tt,Te,ue=Vt((Pn=(qt=e[5].common)==null?void 0:qt.day)!=null?Pn:"Day")+"",Ie,kt,lt,wt=e[11][0]+"",st,ot,et=e[11][1]+"",Nt,gt,At,Pt,Be=Vt((dn=(Jl=e[5].common)==null?void 0:Jl.month)!=null?dn:"Month")+"",ye,It,vt,nt=e[12][0]+"",Tt,it,at=e[12][1]+"",rt,jt,Lt,Ht,yt=((Re=(En=e[5].realtime)==null?void 0:En.last_mo)!=null?Re:"Last mo.")+"",Me,Ve,Rt,Gt=e[13][0]+"",zt,Dt,Kt=e[13][1]+"",Zt,tl,Jt,ft=e[4]&&Cp(e),Mt=e[4]&&Np(e),Ke=e[4]&&Tp(e),ne=e[4]&&Pp(e),Ue=e[4]&&Ep(e),Le=e[4]&&Ap(e),St=e[4]&&Dp(e),ut=e[4]&&qp(e);return{c(){t=m("strong"),n=k(l),i=b(),o=m("div"),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),g=k(h),M=b(),ft&&ft.c(),A=b(),I=m("div"),L=k(q),O=b(),U=m("div"),B=k(E),z=b(),F=k(W),R=b(),Mt&&Mt.c(),K=b(),y=m("div"),Y=k(H),X=b(),J=m("div"),ce=k($),ie=b(),ae=k(oe),se=b(),Ke&&Ke.c(),x=b(),me=m("div"),V=k(pe),Z=b(),ge=m("div"),S=k(ve),w=b(),D=k(N),j=b(),ne&&ne.c(),le=b(),fe=m("strong"),qe=k(de),Pe=b(),we=m("div"),Fe=m("div"),ke=k(Ae),De=b(),He=m("div"),je=k(Oe),Ye=b(),$e=k(We),xe=b(),Ue&&Ue.c(),tt=b(),Te=m("div"),Ie=k(ue),kt=b(),lt=m("div"),st=k(wt),ot=b(),Nt=k(et),gt=b(),Le&&Le.c(),At=b(),Pt=m("div"),ye=k(Be),It=b(),vt=m("div"),Tt=k(nt),it=b(),rt=k(at),jt=b(),St&&St.c(),Lt=b(),Ht=m("div"),Me=k(yt),Ve=b(),Rt=m("div"),zt=k(Gt),Dt=b(),Zt=k(Kt),tl=b(),ut&&ut.c(),u(_,"class","text-right"),u(U,"class","text-right"),u(J,"class","text-right"),u(ge,"class","text-right"),u(o,"class",te="grid grid-cols-"+e[14]+" mb-3"),u(He,"class","text-right"),u(lt,"class","text-right"),u(vt,"class","text-right"),u(Rt,"class","text-right"),u(we,"class",Jt="grid grid-cols-"+e[14])},m(he,Qe){P(he,t,Qe),s(t,n),P(he,i,Qe),P(he,o,Qe),s(o,f),s(f,c),s(o,a),s(o,_),s(_,v),s(_,d),s(_,g),s(o,M),ft&&ft.m(o,null),s(o,A),s(o,I),s(I,L),s(o,O),s(o,U),s(U,B),s(U,z),s(U,F),s(o,R),Mt&&Mt.m(o,null),s(o,K),s(o,y),s(y,Y),s(o,X),s(o,J),s(J,ce),s(J,ie),s(J,ae),s(o,se),Ke&&Ke.m(o,null),s(o,x),s(o,me),s(me,V),s(o,Z),s(o,ge),s(ge,S),s(ge,w),s(ge,D),s(o,j),ne&&ne.m(o,null),P(he,le,Qe),P(he,fe,Qe),s(fe,qe),P(he,Pe,Qe),P(he,we,Qe),s(we,Fe),s(Fe,ke),s(we,De),s(we,He),s(He,je),s(He,Ye),s(He,$e),s(we,xe),Ue&&Ue.m(we,null),s(we,tt),s(we,Te),s(Te,Ie),s(we,kt),s(we,lt),s(lt,st),s(lt,ot),s(lt,Nt),s(we,gt),Le&&Le.m(we,null),s(we,At),s(we,Pt),s(Pt,ye),s(we,It),s(we,vt),s(vt,Tt),s(vt,it),s(vt,rt),s(we,jt),St&&St.m(we,null),s(we,Lt),s(we,Ht),s(Ht,Me),s(we,Ve),s(we,Rt),s(Rt,zt),s(Rt,Dt),s(Rt,Zt),s(we,tl),ut&&ut.m(we,null)},p(he,Qe){var vn,An,Hn,yn,ml,$l,xl,zn,en,Gl,hn,Dn,Wn,Gn,tn,cl,Vn,bn,Kn,Vl;Qe&32&&l!==(l=((An=(vn=he[5].common)==null?void 0:vn.import)!=null?An:"Import")+"")&&C(n,l),Qe&32&&r!==(r=Vt((yn=(Hn=he[5].common)==null?void 0:Hn.hour)!=null?yn:"Hour")+"")&&C(c,r),Qe&64&&p!==(p=he[6][0]+"")&&C(v,p),Qe&64&&h!==(h=he[6][1]+"")&&C(g,h),he[4]?ft?ft.p(he,Qe):(ft=Cp(he),ft.c(),ft.m(o,A)):ft&&(ft.d(1),ft=null),Qe&32&&q!==(q=Vt(($l=(ml=he[5].common)==null?void 0:ml.day)!=null?$l:"Day")+"")&&C(L,q),Qe&128&&E!==(E=he[7][0]+"")&&C(B,E),Qe&128&&W!==(W=he[7][1]+"")&&C(F,W),he[4]?Mt?Mt.p(he,Qe):(Mt=Np(he),Mt.c(),Mt.m(o,K)):Mt&&(Mt.d(1),Mt=null),Qe&32&&H!==(H=Vt((zn=(xl=he[5].common)==null?void 0:xl.month)!=null?zn:"Month")+"")&&C(Y,H),Qe&256&&$!==($=he[8][0]+"")&&C(ce,$),Qe&256&&oe!==(oe=he[8][1]+"")&&C(ae,oe),he[4]?Ke?Ke.p(he,Qe):(Ke=Tp(he),Ke.c(),Ke.m(o,x)):Ke&&(Ke.d(1),Ke=null),Qe&32&&pe!==(pe=((Gl=(en=he[5].realtime)==null?void 0:en.last_mo)!=null?Gl:"Last mo.")+"")&&C(V,pe),Qe&512&&ve!==(ve=he[9][0]+"")&&C(S,ve),Qe&512&&N!==(N=he[9][1]+"")&&C(D,N),he[4]?ne?ne.p(he,Qe):(ne=Pp(he),ne.c(),ne.m(o,null)):ne&&(ne.d(1),ne=null),Qe&16384&&te!==(te="grid grid-cols-"+he[14]+" mb-3")&&u(o,"class",te),Qe&32&&de!==(de=((Dn=(hn=he[5].common)==null?void 0:hn.export)!=null?Dn:"Export")+"")&&C(qe,de),Qe&32&&Ae!==(Ae=Vt((Gn=(Wn=he[5].common)==null?void 0:Wn.hour)!=null?Gn:"Hour")+"")&&C(ke,Ae),Qe&1024&&Oe!==(Oe=he[10][0]+"")&&C(je,Oe),Qe&1024&&We!==(We=he[10][1]+"")&&C($e,We),he[4]?Ue?Ue.p(he,Qe):(Ue=Ep(he),Ue.c(),Ue.m(we,tt)):Ue&&(Ue.d(1),Ue=null),Qe&32&&ue!==(ue=Vt((cl=(tn=he[5].common)==null?void 0:tn.day)!=null?cl:"Day")+"")&&C(Ie,ue),Qe&2048&&wt!==(wt=he[11][0]+"")&&C(st,wt),Qe&2048&&et!==(et=he[11][1]+"")&&C(Nt,et),he[4]?Le?Le.p(he,Qe):(Le=Ap(he),Le.c(),Le.m(we,At)):Le&&(Le.d(1),Le=null),Qe&32&&Be!==(Be=Vt((bn=(Vn=he[5].common)==null?void 0:Vn.month)!=null?bn:"Month")+"")&&C(ye,Be),Qe&4096&&nt!==(nt=he[12][0]+"")&&C(Tt,nt),Qe&4096&&at!==(at=he[12][1]+"")&&C(rt,at),he[4]?St?St.p(he,Qe):(St=Dp(he),St.c(),St.m(we,Lt)):St&&(St.d(1),St=null),Qe&32&&yt!==(yt=((Vl=(Kn=he[5].realtime)==null?void 0:Kn.last_mo)!=null?Vl:"Last mo.")+"")&&C(Me,yt),Qe&8192&&Gt!==(Gt=he[13][0]+"")&&C(zt,Gt),Qe&8192&&Kt!==(Kt=he[13][1]+"")&&C(Zt,Kt),he[4]?ut?ut.p(he,Qe):(ut=qp(he),ut.c(),ut.m(we,null)):ut&&(ut.d(1),ut=null),Qe&16384&&Jt!==(Jt="grid grid-cols-"+he[14])&&u(we,"class",Jt)},d(he){he&&T(t),he&&T(i),he&&T(o),ft&&ft.d(),Mt&&Mt.d(),Ke&&Ke.d(),ne&&ne.d(),he&&T(le),he&&T(fe),he&&T(Pe),he&&T(we),Ue&&Ue.d(),Le&&Le.d(),St&&St.d(),ut&&ut.d()}}}function Sp(e){var Z,ge,ve,S,w,N,D,j,te,le;let t,l=((ge=(Z=e[5].realtime)==null?void 0:Z.cost)!=null?ge:"Cost")+"",n,i,o,f,r=Vt((S=(ve=e[5].common)==null?void 0:ve.hour)!=null?S:"Hour")+"",c,a,_,p=Bt(e[1].h.c,2)+"",v,d,h,g,M,A=Vt((N=(w=e[5].common)==null?void 0:w.day)!=null?N:"Day")+"",I,q,L,O=Bt(e[1].d.c,1)+"",U,E,B,z,W,F=Vt((j=(D=e[5].common)==null?void 0:D.month)!=null?j:"Month")+"",R,K,y,H=Bt(e[1].m.c)+"",Y,X,J,$,ce,ie=((le=(te=e[5].realtime)==null?void 0:te.last_month)!=null?le:"Last month")+"",oe,ae,se,x=Bt(e[0].last_month.c)+"",me,pe,V;return{c(){t=m("strong"),n=k(l),i=b(),o=m("div"),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),h=k(e[2]),g=b(),M=m("div"),I=k(A),q=b(),L=m("div"),U=k(O),E=b(),B=k(e[2]),z=b(),W=m("div"),R=k(F),K=b(),y=m("div"),Y=k(H),X=b(),J=k(e[2]),$=b(),ce=m("div"),oe=k(ie),ae=b(),se=m("div"),me=k(x),pe=b(),V=k(e[2]),u(_,"class","text-right"),u(L,"class","text-right"),u(y,"class","text-right"),u(se,"class","text-right"),u(o,"class","grid grid-cols-2")},m(fe,de){P(fe,t,de),s(t,n),P(fe,i,de),P(fe,o,de),s(o,f),s(f,c),s(o,a),s(o,_),s(_,v),s(_,d),s(_,h),s(o,g),s(o,M),s(M,I),s(o,q),s(o,L),s(L,U),s(L,E),s(L,B),s(o,z),s(o,W),s(W,R),s(o,K),s(o,y),s(y,Y),s(y,X),s(y,J),s(o,$),s(o,ce),s(ce,oe),s(o,ae),s(o,se),s(se,me),s(se,pe),s(se,V)},p(fe,de){var qe,Pe,we,Fe,Ae,ke,De,He,Oe,je;de&32&&l!==(l=((Pe=(qe=fe[5].realtime)==null?void 0:qe.cost)!=null?Pe:"Cost")+"")&&C(n,l),de&32&&r!==(r=Vt((Fe=(we=fe[5].common)==null?void 0:we.hour)!=null?Fe:"Hour")+"")&&C(c,r),de&2&&p!==(p=Bt(fe[1].h.c,2)+"")&&C(v,p),de&4&&C(h,fe[2]),de&32&&A!==(A=Vt((ke=(Ae=fe[5].common)==null?void 0:Ae.day)!=null?ke:"Day")+"")&&C(I,A),de&2&&O!==(O=Bt(fe[1].d.c,1)+"")&&C(U,O),de&4&&C(B,fe[2]),de&32&&F!==(F=Vt((He=(De=fe[5].common)==null?void 0:De.month)!=null?He:"Month")+"")&&C(R,F),de&2&&H!==(H=Bt(fe[1].m.c)+"")&&C(Y,H),de&4&&C(J,fe[2]),de&32&&ie!==(ie=((je=(Oe=fe[5].realtime)==null?void 0:Oe.last_month)!=null?je:"Last month")+"")&&C(oe,ie),de&1&&x!==(x=Bt(fe[0].last_month.c)+"")&&C(me,x),de&4&&C(V,fe[2])},d(fe){fe&&T(t),fe&&T(i),fe&&T(o)}}}function Cp(e){let t,l=Bt(e[1].h.c,2)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].h.c,2)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Np(e){let t,l=Bt(e[1].d.c,1)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].d.c,1)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Tp(e){let t,l=Bt(e[1].m.c)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].m.c)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Pp(e){let t,l=Bt(e[0].last_month.c)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&1&&l!==(l=Bt(f[0].last_month.c)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Ep(e){let t,l=Bt(e[1].h.i,2)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].h.i,2)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Ap(e){let t,l=Bt(e[1].d.i,1)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].d.i,1)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Dp(e){let t,l=Bt(e[1].m.i)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].m.i)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function qp(e){let t,l=Bt(e[0].last_month.i)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&1&&l!==(l=Bt(f[0].last_month.i)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Zb(e){var _,p;let t,l,n=((p=(_=e[5].realtime)==null?void 0:_.title)!=null?p:"Real time calculations")+"",i,o,f,r,c,a=e[1]&&Mp(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("br"),r=m("br"),c=b(),a&&a.c(),u(t,"class","mx-2 text-sm")},m(v,d){P(v,t,d),s(t,l),s(l,i),s(t,o),s(t,f),s(t,r),s(t,c),a&&a.m(t,null)},p(v,[d]){var h,g;d&32&&n!==(n=((g=(h=v[5].realtime)==null?void 0:h.title)!=null?g:"Real time calculations")+"")&&C(i,n),v[1]?a?a.p(v,d):(a=Mp(v),a.c(),a.m(t,null)):a&&(a.d(1),a=null)},i:ze,o:ze,d(v){v&&T(t),a&&a.d()}}}function Jb(e,t,l){let{sysinfo:n}=t,{data:i}=t,{currency:o}=t,{hasExport:f}=t,r={};Ml.subscribe(I=>{l(5,r=I)});let c,a,_,p,v,d,h,g,M=!1,A=3;return e.$$set=I=>{"sysinfo"in I&&l(0,n=I.sysinfo),"data"in I&&l(1,i=I.data),"currency"in I&&l(2,o=I.currency),"hasExport"in I&&l(3,f=I.hasExport)},e.$$.update=()=>{var I,q,L,O,U,E,B,z;e.$$.dirty&19&&(l(4,M=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,A=M?3:2),l(6,c=gl(((I=i==null?void 0:i.h)==null?void 0:I.u)*1e3,"Wh")),l(7,a=gl(((q=i==null?void 0:i.d)==null?void 0:q.u)*1e3,"Wh")),l(8,_=gl(((L=i==null?void 0:i.m)==null?void 0:L.u)*1e3,"Wh")),l(9,p=gl(((O=n==null?void 0:n.last_month)==null?void 0:O.c)*1e3,"Wh")),l(10,v=gl(((U=i==null?void 0:i.h)==null?void 0:U.p)*1e3,"Wh")),l(11,d=gl(((E=i==null?void 0:i.d)==null?void 0:E.p)*1e3,"Wh")),l(12,h=gl(((B=i==null?void 0:i.m)==null?void 0:B.p)*1e3,"Wh")),l(13,g=gl(((z=n==null?void 0:n.last_month)==null?void 0:z.p)*1e3,"Wh")))},[n,i,o,f,M,r,c,a,_,p,v,d,h,g,A]}class $b extends mt{constructor(t){super(),_t(this,t,Jb,Zb,ct,{sysinfo:0,data:1,currency:2,hasExport:3})}}function xb(e){let t,l,n=Gm(e[0].source)+"",i,o,f,r,c;return r=new gi({props:{config:e[1]}}),{c(){t=m("a"),l=k("Provided by: "),i=k(n),f=b(),Ne(r.$$.fragment),u(t,"href",o=Vm(e[0].source)),u(t,"target","_blank"),u(t,"class","text-xs float-right z-40")},m(a,_){P(a,t,_),s(t,l),s(t,i),P(a,f,_),Se(r,a,_),c=!0},p(a,[_]){(!c||_&1)&&n!==(n=Gm(a[0].source)+"")&&C(i,n),(!c||_&1&&o!==(o=Vm(a[0].source)))&&u(t,"href",o);const p={};_&2&&(p.config=a[1]),r.$set(p)},i(a){c||(Q(r.$$.fragment,a),c=!0)},o(a){ee(r.$$.fragment,a),c=!1},d(a){a&&T(t),a&&T(f),Ce(r,a)}}}function e4(e,t,l){let{title:n}=t,{json:i}=t,{sysinfo:o}=t,f={},r,c,a=document.documentElement.classList.contains("dark");return e.$$set=_=>{"title"in _&&l(2,n=_.title),"json"in _&&l(0,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&61){let _=i.currency,p=new Date().getUTCHours(),v=0,d=0,h=0,g=[],M=[],A=[];l(5,c=l(4,r=0));let I=new Date;for(Nn(I,o.clock_offset-(24+I.getHours()-I.getUTCHours())%24),v=p;v<24&&(d=i[ht(h++)],d!=null);v++)M.push({label:ht(I.getHours())}),A.push(d*100),l(5,c=Math.min(c,d*100)),l(4,r=Math.max(r,d*100)),Nn(I,1);for(v=0;v<24&&(d=i[ht(h++)],d!=null);v++)M.push({label:ht(I.getHours())}),A.push(d*100),l(5,c=Math.min(c,d*100)),l(4,r=Math.max(r,d*100)),Nn(I,1);if(c>-100&&r<100){switch(_){case"NOK":case"DKK":_="\xF8re";break;case"SEK":_="\xF6re";break;case"EUR":_="cent";break;case"CHF":_="rp.";break;default:_=_+"/100"}for(l(5,c*=100),l(4,r*=100),v=0;v=0?E.toFixed(B):"",title:E>=0?E.toFixed(2)+" "+_:"",value:d>=0?Math.abs(d):0,label2:E<0?E.toFixed(B):"",title2:E<0?E.toFixed(2)+" "+_:"",value2:d<0?Math.abs(d):0,color:a?"#5c2da5":"#7c3aed"})}let L=Math.max(r,Math.abs(c));if(c<0){l(5,c=Math.min(L/4*-1,c));let E=Math.ceil(Math.abs(c)/L*4),B=c/E;for(v=1;v{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&62){let _=0,p=[],v=[],d=[];l(5,c=l(4,r=0));let h=Nn(new Date,-24),g=new Date().getUTCHours();for(Nn(h,o.clock_offset-(24+h.getHours()-h.getUTCHours())%24),_=g;_<24;_++){let q=i["i"+ht(_)],L=i["e"+ht(_)];q===void 0&&(q=0),L===void 0&&(L=0),v.push({label:ht(h.getHours())}),d.push({label:q.toFixed(1),title:q.toFixed(2)+" kWh",value:q*10,label2:L.toFixed(1),title2:L.toFixed(2)+" kWh",value2:L*10,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(5,c=Math.max(c,L*10)),l(4,r=Math.max(r,q*10)),Nn(h,1)}for(_=0;_{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&62){let _=0,p=[],v=[],d=[];l(5,c=l(4,r=0));let h=new Date,g=new Date;for(Nn(h,o.clock_offset-(24+h.getHours()-h.getUTCHours())%24),Nn(g,o.clock_offset-(24+g.getHours()-g.getUTCHours())%24),g.setDate(0),_=h.getDate();_<=g.getDate();_++){let q=i["i"+ht(_)],L=i["e"+ht(_)];q===void 0&&(q=0),L===void 0&&(L=0),v.push({label:ht(_)}),d.push({label:q.toFixed(q<10?1:0),title:q.toFixed(2)+" kWh",value:q,label2:L.toFixed(L<10?1:0),title2:L.toFixed(2)+" kWh",value2:L,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(5,c=Math.max(c,L)),l(4,r=Math.max(r,q))}for(_=1;_{"title"in a&&l(1,n=a.title),"json"in a&&l(2,i=a.json)},e.$$.update=()=>{if(e.$$.dirty&30){let a=0,_=0,p=[],v=[],d=[];i.s&&i.s.forEach((M,A)=>{var I=M.n?M.n:M.a;_=M.v,_==-127&&(_=0),v.push({label:I.slice(-4)}),d.push({label:_.toFixed(1),value:_,color:o?"#5c2da5":"#7c3aed"}),l(4,c=Math.min(c,_)),l(3,r=Math.max(r,_))}),l(3,r=Math.ceil(r)),l(4,c=Math.floor(c));let h=r;c<0&&(h+=Math.abs(c));let g=h/4;for(a=0;a<5;a++)_=c+g*a,p.push({value:_,label:_.toFixed(1)});l(0,f={title:n+" (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:c,max:r,ticks:p},x:{ticks:v},points:d})}},[f,n,i,r,c]}class r4 extends mt{constructor(t){super(),_t(this,t,u4,f4,ct,{title:1,json:2})}}function c4(e){let t,l;return t=new gi({props:{config:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}let _4=0;function m4(e,t,l){let n={};Ml.subscribe(a=>{l(2,n=a)});let{title:i}=t,o=document.documentElement.classList.contains("dark"),f={},r=0,c;return Sv.subscribe(a=>{l(4,c=a)}),Mv(),e.$$set=a=>{"title"in a&&l(1,i=a.title)},e.$$.update=()=>{var a;if(e.$$.dirty&30){let _=0,p=[],v=[],d=[];if(p.push({value:0,label:0}),c&&c.p)for(_=0;_0?ht(h.d)+"."+((a=n.months)==null?void 0:a[new Date().getMonth()]):"-"}),l(3,r=Math.max(r,h.v))}if(c&&c.t){for(_=0;_=r)break;p.push({value:h,label:h})}p.push({label:c.m.toFixed(1),align:"right",color:"green",value:c.m})}c&&c.c&&(p.push({label:c.c.toFixed(0),color:"orange",value:c.c}),l(3,r=Math.max(r,c.c))),l(3,r=Math.ceil(r)),l(0,f={title:i,padding:{top:20,right:35,bottom:20,left:35},y:{min:_4,max:r,ticks:p},x:{ticks:v},points:d})}},[f,i,n,r,c]}class p4 extends mt{constructor(t){super(),_t(this,t,m4,c4,ct,{title:1})}}function Op(e,t,l){const n=e.slice();return n[23]=t[l],n[25]=l,n}function Ip(e,t,l){const n=e.slice();return n[26]=t[l],n}function Lp(e){let t,l,n,i,o,f=e[8],r=[];for(let _=0;_e[16].call(t))},m(_,p){P(_,t,p),s(t,l),s(l,n),s(l,i),s(l,o),s(l,f),s(t,r),a&&a.m(t,null),c=pf(t,e[16].bind(t))},p(_,[p]){p&1&&C(n,_[0]),p&2048&&C(o,_[11]),_[8]?a?a.p(_,p):(a=Lp(_),a.c(),a.m(t,null)):a&&(a.d(1),a=null)},i:ze,o:ze,d(_){_&&T(t),a&&a.d(),c()}}}function v4(e,t,l){let{title:n}=t,i=document.documentElement.classList.contains("dark"),o=0,f=0,r=0,c=!1,a=null,_;Cv.subscribe(W=>{l(13,a=W),r=o,_&&clearTimeout(_),_=setTimeout(Uo,6e5)});function p(){if(r>o||r-o>300)Uo();else for(;o>r;)a.data.unshift(f),l(13,a.data=a.data.slice(0,a.size),a),r+=10}dv.subscribe(W=>{var F;if(f=W.i-W.e,o=W.u,!c){Uo(),c=!0;return}!((F=a==null?void 0:a.data)!=null&&F.length)||p()});let v,d,h,g,M,A,I,q,L,O,U,E,B;function z(){h=this.clientWidth,g=this.clientHeight,l(1,h),l(2,g)}return e.$$set=W=>{"title"in W&&l(0,n=W.title)},e.$$.update=()=>{if(e.$$.dirty&58366&&(l(3,M=parseInt(g)-50),l(4,A=h-35),l(10,E=A/a.size),l(15,d=0),l(14,v=0),a.data)){for(let F in a.data){let R=a.data[F];isNaN(R)&&(R=0),l(14,v=Math.max(Math.ceil(R/1e3)*1e3,v)),l(15,d=Math.min(Math.ceil(R/1e3)*1e3,d))}l(11,B=v>2500?"kW":"W"),l(8,O=[]);for(let F=d;F2500?(F/1e3).toFixed(1):F});l(9,U=[]);for(let F=0;F900?O/1e3:O)+(O>900?"k":"")+i,title:O.toFixed(2)+" "+i,value:isNaN(O)?0:O,color:A(O?O/g*100:0,document.documentElement.classList.contains("dark")),label2:Bt(U>900?U/1e3:U)+(U>900?"k":"")+i,title2:U.toFixed(2)+" "+i,value2:isNaN(U)?0:U,color2:I(U?U/M*100:0)}}return e.$$set=O=>{"title"in O&&l(1,n=O.title),"unit"in O&&l(2,i=O.unit),"l1"in O&&l(3,o=O.l1),"l2"in O&&l(4,f=O.l2),"l2x"in O&&l(5,r=O.l2x),"l3"in O&&l(6,c=O.l3),"l1i"in O&&l(7,a=O.l1i),"l2i"in O&&l(8,_=O.l2i),"l3i"in O&&l(9,p=O.l3i),"l1e"in O&&l(10,v=O.l1e),"l2e"in O&&l(11,d=O.l2e),"l3e"in O&&l(12,h=O.l3e),"maxImport"in O&&l(13,g=O.maxImport),"maxExport"in O&&l(14,M=O.maxExport),"importColorFn"in O&&l(15,A=O.importColorFn),"exportColorFn"in O&&l(16,I=O.exportColorFn)},e.$$.update=()=>{if(e.$$.dirty&32762){let O=[],U=[];o&&(O.push({label:"L1"}),U.push(L(a,v))),f&&(r?(O.push({label:"L2"}),U.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(O.push({label:"L2"}),U.push(L(_,d)))),c&&(O.push({label:"L3"}),U.push(L(p,h)));let E=[];M&&(E.push({value:-M,label:"-100%"}),E.push({value:-M/4*3,label:"-75%"}),E.push({value:-M/2,label:"-50%"}),E.push({value:-M/4,label:"-25%"})),E.push({value:0,label:"0%"}),g&&(E.push({value:g/4,label:"25%"}),E.push({value:g/2,label:"50%"}),E.push({value:g/4*3,label:"75%"}),E.push({value:g,label:"100%"})),l(0,q={title:n,padding:{top:20,right:15,bottom:20,left:35},y:{min:-M,max:g,ticks:E},x:{ticks:O},points:U})}},[q,n,i,o,f,r,c,a,_,p,v,d,h,g,M,A,I]}class Nf extends mt{constructor(t){super(),_t(this,t,g4,b4,ct,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function jp(e){var A,I;let t,l,n,i,o,f,r=(e[0].mt?Go(e[0].mt):"-")+"",c,a,_,p=e[7][0]+"",v,d,h=e[7][1]+"",g,M;return i=new Av({props:{val:e[0].i?e[0].i:0,max:e[0].im?e[0].im:15e3,unit:"W",label:(I=(A=e[6].common)==null?void 0:A.import)!=null?I:"Import",sub:e[0].p,subunit:e[0].pc,colorFn:gf}}),{c(){t=m("div"),l=m("div"),n=m("div"),Ne(i.$$.fragment),o=b(),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),g=k(h),u(n,"class","col-span-2"),u(_,"class","text-right"),u(l,"class","grid grid-cols-2"),u(t,"class","cnt")},m(q,L){P(q,t,L),s(t,l),s(l,n),Se(i,n,null),s(l,o),s(l,f),s(f,c),s(l,a),s(l,_),s(_,v),s(_,d),s(_,g),M=!0},p(q,L){var U,E;const O={};L&1&&(O.val=q[0].i?q[0].i:0),L&1&&(O.max=q[0].im?q[0].im:15e3),L&64&&(O.label=(E=(U=q[6].common)==null?void 0:U.import)!=null?E:"Import"),L&1&&(O.sub=q[0].p),L&1&&(O.subunit=q[0].pc),i.$set(O),(!M||L&1)&&r!==(r=(q[0].mt?Go(q[0].mt):"-")+"")&&C(c,r),(!M||L&128)&&p!==(p=q[7][0]+"")&&C(v,p),(!M||L&128)&&h!==(h=q[7][1]+"")&&C(g,h)},i(q){M||(Q(i.$$.fragment,q),M=!0)},o(q){ee(i.$$.fragment,q),M=!1},d(q){q&&T(t),Ce(i)}}}function Hp(e){var g,M;let t,l,n,i,o,f,r,c,a=e[8][0]+"",_,p,v=e[8][1]+"",d,h;return i=new Av({props:{val:e[0].e?e[0].e:0,max:e[0].om?e[0].om*1e3:1e4,unit:"W",label:(M=(g=e[6].common)==null?void 0:g.export)!=null?M:"Export",colorFn:Is}}),{c(){t=m("div"),l=m("div"),n=m("div"),Ne(i.$$.fragment),o=b(),f=m("div"),r=b(),c=m("div"),_=k(a),p=b(),d=k(v),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(t,"class","cnt")},m(A,I){P(A,t,I),s(t,l),s(l,n),Se(i,n,null),s(l,o),s(l,f),s(l,r),s(l,c),s(c,_),s(c,p),s(c,d),h=!0},p(A,I){var L,O;const q={};I&1&&(q.val=A[0].e?A[0].e:0),I&1&&(q.max=A[0].om?A[0].om*1e3:1e4),I&64&&(q.label=(O=(L=A[6].common)==null?void 0:L.export)!=null?O:"Export"),i.$set(q),(!h||I&256)&&a!==(a=A[8][0]+"")&&C(_,a),(!h||I&256)&&v!==(v=A[8][1]+"")&&C(d,v)},i(A){h||(Q(i.$$.fragment,A),h=!0)},o(A){ee(i.$$.fragment,A),h=!1},d(A){A&&T(t),Ce(i)}}}function yp(e){let t,l,n=e[0].l1&&zp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Q(n,1)):(n=zp(i),n.c(),Q(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Q(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function zp(e){var n,i;let t,l;return t=new Gb({props:{title:(i=(n=e[6].common)==null?void 0:n.voltage)!=null?i:"Volt",u1:e[0].l1.u,u2:e[0].l2.u,u3:e[0].l3.u,ds:e[0].ds}}),{c(){Ne(t.$$.fragment)},m(o,f){Se(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].common)==null?void 0:c.voltage)!=null?a:"Volt"),f&1&&(r.u1=o[0].l1.u),f&1&&(r.u2=o[0].l2.u),f&1&&(r.u3=o[0].l3.u),f&1&&(r.ds=o[0].ds),t.$set(r)},i(o){l||(Q(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ce(t,o)}}}function Wp(e){let t,l,n=e[0].l1&&Gp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Q(n,1)):(n=Gp(i),n.c(),Q(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Q(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function Gp(e){var n,i;let t,l;return t=new Nf({props:{title:(i=(n=e[6].common)==null?void 0:n.amperage)!=null?i:"Amp",unit:"A",importColorFn:gf,exportColorFn:Is,maxImport:e[0].mf,maxExport:e[0].om?e[9]?e[0].om/.4/Math.sqrt(3):e[0].om/.23:0,l1:e[0].l1&&e[0].l1.u>100,l2:e[0].l2&&e[0].l2.u>100,l3:e[0].l3&&e[0].l3.u>100,l2x:e[0].i2e,l1i:Math.max(e[0].l1.i,0),l2i:Math.max(e[0].l2.i,0),l3i:Math.max(e[0].l3.i,0),l1e:Math.max(e[0].l1.e,0),l2e:Math.max(e[0].l2.e,0),l3e:Math.max(e[0].l3.e,0)}}),{c(){Ne(t.$$.fragment)},m(o,f){Se(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].common)==null?void 0:c.amperage)!=null?a:"Amp"),f&1&&(r.maxImport=o[0].mf),f&513&&(r.maxExport=o[0].om?o[9]?o[0].om/.4/Math.sqrt(3):o[0].om/.23:0),f&1&&(r.l1=o[0].l1&&o[0].l1.u>100),f&1&&(r.l2=o[0].l2&&o[0].l2.u>100),f&1&&(r.l3=o[0].l3&&o[0].l3.u>100),f&1&&(r.l2x=o[0].i2e),f&1&&(r.l1i=Math.max(o[0].l1.i,0)),f&1&&(r.l2i=Math.max(o[0].l2.i,0)),f&1&&(r.l3i=Math.max(o[0].l3.i,0)),f&1&&(r.l1e=Math.max(o[0].l1.e,0)),f&1&&(r.l2e=Math.max(o[0].l2.e,0)),f&1&&(r.l3e=Math.max(o[0].l3.e,0)),t.$set(r)},i(o){l||(Q(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ce(t,o)}}}function Vp(e){let t,l,n=e[0].l1&&Kp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Q(n,1)):(n=Kp(i),n.c(),Q(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Q(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function Kp(e){var n,i;let t,l;return t=new Nf({props:{title:(i=(n=e[6].dashboard)==null?void 0:n.phase)!=null?i:"Phase",unit:"W",importColorFn:gf,exportColorFn:Is,maxImport:(e[0].mf?e[0].mf:32)*230,maxExport:e[0].om?e[9]?e[0].om*1e3/Math.sqrt(3):e[0].om*1e3:0,l1:e[0].l1&&e[0].l1.u>100,l2:e[0].l2&&e[0].l2.u>100,l3:e[0].l3&&e[0].l3.u>100,l1i:e[0].l1.p,l2i:e[0].l2.p,l3i:e[0].l3.p,l1e:e[0].l1.q,l2e:e[0].l2.q,l3e:e[0].l3.q}}),{c(){Ne(t.$$.fragment)},m(o,f){Se(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].dashboard)==null?void 0:c.phase)!=null?a:"Phase"),f&1&&(r.maxImport=(o[0].mf?o[0].mf:32)*230),f&513&&(r.maxExport=o[0].om?o[9]?o[0].om*1e3/Math.sqrt(3):o[0].om*1e3:0),f&1&&(r.l1=o[0].l1&&o[0].l1.u>100),f&1&&(r.l2=o[0].l2&&o[0].l2.u>100),f&1&&(r.l3=o[0].l3&&o[0].l3.u>100),f&1&&(r.l1i=o[0].l1.p),f&1&&(r.l2i=o[0].l2.p),f&1&&(r.l3i=o[0].l3.p),f&1&&(r.l1e=o[0].l1.q),f&1&&(r.l2e=o[0].l2.q),f&1&&(r.l3e=o[0].l3.q),t.$set(r)},i(o){l||(Q(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ce(t,o)}}}function Yp(e){let t,l,n=e[0].l1&&Qp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Q(n,1)):(n=Qp(i),n.c(),Q(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Q(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function Qp(e){var n,i;let t,l;return t=new Nf({props:{title:(i=(n=e[6].dashboard)==null?void 0:n.pf)!=null?i:"Pf",importColorFn:Is,exportColorFn:Is,maxImport:1,l1:e[0].l1&&e[0].l1.u>100,l2:e[0].l2&&e[0].l2.u>100,l3:e[0].l3&&e[0].l3.u>100,l1i:e[0].l1.f,l2i:e[0].l2.f,l3i:e[0].l3.f}}),{c(){Ne(t.$$.fragment)},m(o,f){Se(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].dashboard)==null?void 0:c.pf)!=null?a:"Pf"),f&1&&(r.l1=o[0].l1&&o[0].l1.u>100),f&1&&(r.l2=o[0].l2&&o[0].l2.u>100),f&1&&(r.l3=o[0].l3&&o[0].l3.u>100),f&1&&(r.l1i=o[0].l1.f),f&1&&(r.l2i=o[0].l2.f),f&1&&(r.l3i=o[0].l3.f),t.$set(r)},i(o){l||(Q(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ce(t,o)}}}function Xp(e){let t,l,n;return l=new Yb({props:{importInstant:e[0].ri,exportInstant:e[0].re,importTotal:e[0].ric,exportTotal:e[0].rec}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt")},m(i,o){P(i,t,o),Se(l,t,null),n=!0},p(i,o){const f={};o&1&&(f.importInstant=i[0].ri),o&1&&(f.exportInstant=i[0].re),o&1&&(f.importTotal=i[0].ric),o&1&&(f.exportTotal=i[0].rec),l.$set(f)},i(i){n||(Q(l.$$.fragment,i),n=!0)},o(i){ee(l.$$.fragment,i),n=!1},d(i){i&&T(t),Ce(l)}}}function Zp(e){let t,l,n;return l=new $b({props:{sysinfo:e[1],data:e[0].ea,currency:e[0].pc,hasExport:e[0].om>0||e[0].e>0}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt")},m(i,o){P(i,t,o),Se(l,t,null),n=!0},p(i,o){const f={};o&2&&(f.sysinfo=i[1]),o&1&&(f.data=i[0].ea),o&1&&(f.currency=i[0].pc),o&1&&(f.hasExport=i[0].om>0||i[0].e>0),l.$set(f)},i(i){n||(Q(l.$$.fragment,i),n=!0)},o(i){ee(l.$$.fragment,i),n=!1},d(i){i&&T(t),Ce(l)}}}function Jp(e){var i,o;let t,l,n;return l=new p4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.tariffpeak)!=null?o:"Tariff peaks"}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt h-64")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.tariffpeak)!=null?_:"Tariff peaks"),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function $p(e){var i,o;let t,l,n;return l=new h4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.realtime)!=null?o:"Real time"}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.realtime)!=null?_:"Real time"),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function xp(e){var i,o;let t,l,n;return l=new t4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.price)!=null?o:"Price",json:e[2],sysinfo:e[1]}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.price)!=null?_:"Price"),r&4&&(c.json=f[2]),r&2&&(c.sysinfo=f[1]),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function e2(e){var i,o;let t,l,n;return l=new i4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.day)!=null?o:"24 hours",json:e[3],sysinfo:e[1]}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.day)!=null?_:"24 hours"),r&8&&(c.json=f[3]),r&2&&(c.sysinfo=f[1]),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function t2(e){var i,o;let t,l,n;return l=new a4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.month)!=null?o:"{0} days",json:e[4],sysinfo:e[1]}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.month)!=null?_:"{0} days"),r&16&&(c.json=f[4]),r&2&&(c.sysinfo=f[1]),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function l2(e){var i,o;let t,l,n;return l=new r4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.temperature)!=null?o:"Temperature",json:e[5]}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.temperature)!=null?_:"Temperature"),r&32&&(c.json=f[5]),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function k4(e){let t,l=Ot(e[1].ui.i,e[0].i),n,i=Ot(e[1].ui.e,e[0].om||e[0].e>0),o,f=Ot(e[1].ui.v,e[0].l1&&(e[0].l1.u>100||e[0].l2.u>100||e[0].l3.u>100)),r,c=Ot(e[1].ui.a,e[0].l1&&(e[0].l1.i>.01||e[0].l2.i>.01||e[0].l3.i>.01)),a,_=Ot(e[1].ui.h,e[0].l1&&(e[0].l1.p>.01||e[0].l2.p>.01||e[0].l3.p>.01||e[0].l1.q>.01||e[0].l2.q>.01||e[0].l3.q>.01)),p,v=Ot(e[1].ui.f,e[0].l1&&(e[0].l1.f>.01||e[0].l2.f>.01||e[0].l3.f>.01)),d,h=Ot(e[1].ui.r,e[0].ri>0||e[0].re>0||e[0].ric>0||e[0].rec>0),g,M=Ot(e[1].ui.c,e[0].ea),A,I=Ot(e[1].ui.t,e[0].pr&&(e[0].pr.startsWith("NO")||e[0].pr.startsWith("10YNO")||e[0].pr.startsWith("10Y1001A1001A4"))),q,L=Ot(e[1].ui.l),O,U=Ot(e[1].ui.p,e[0].pe&&!Number.isNaN(e[0].p)),E,B=Ot(e[1].ui.d,e[3]),z,W=Ot(e[1].ui.m,e[4]),F,R=Ot(e[1].ui.s,e[0].t&&e[0].t!=-127&&e[5].c>1),K,y=l&&jp(e),H=i&&Hp(e),Y=f&&yp(e),X=c&&Wp(e),J=_&&Vp(e),$=v&&Yp(e),ce=h&&Xp(e),ie=M&&Zp(e),oe=I&&Jp(e),ae=L&&$p(e),se=U&&xp(e),x=B&&e2(e),me=W&&t2(e),pe=R&&l2(e);return{c(){t=m("div"),y&&y.c(),n=b(),H&&H.c(),o=b(),Y&&Y.c(),r=b(),X&&X.c(),a=b(),J&&J.c(),p=b(),$&&$.c(),d=b(),ce&&ce.c(),g=b(),ie&&ie.c(),A=b(),oe&&oe.c(),q=b(),ae&&ae.c(),O=b(),se&&se.c(),E=b(),x&&x.c(),z=b(),me&&me.c(),F=b(),pe&&pe.c(),u(t,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(V,Z){P(V,t,Z),y&&y.m(t,null),s(t,n),H&&H.m(t,null),s(t,o),Y&&Y.m(t,null),s(t,r),X&&X.m(t,null),s(t,a),J&&J.m(t,null),s(t,p),$&&$.m(t,null),s(t,d),ce&&ce.m(t,null),s(t,g),ie&&ie.m(t,null),s(t,A),oe&&oe.m(t,null),s(t,q),ae&&ae.m(t,null),s(t,O),se&&se.m(t,null),s(t,E),x&&x.m(t,null),s(t,z),me&&me.m(t,null),s(t,F),pe&&pe.m(t,null),K=!0},p(V,[Z]){Z&3&&(l=Ot(V[1].ui.i,V[0].i)),l?y?(y.p(V,Z),Z&3&&Q(y,1)):(y=jp(V),y.c(),Q(y,1),y.m(t,n)):y&&(pt(),ee(y,1,1,()=>{y=null}),dt()),Z&3&&(i=Ot(V[1].ui.e,V[0].om||V[0].e>0)),i?H?(H.p(V,Z),Z&3&&Q(H,1)):(H=Hp(V),H.c(),Q(H,1),H.m(t,o)):H&&(pt(),ee(H,1,1,()=>{H=null}),dt()),Z&3&&(f=Ot(V[1].ui.v,V[0].l1&&(V[0].l1.u>100||V[0].l2.u>100||V[0].l3.u>100))),f?Y?(Y.p(V,Z),Z&3&&Q(Y,1)):(Y=yp(V),Y.c(),Q(Y,1),Y.m(t,r)):Y&&(pt(),ee(Y,1,1,()=>{Y=null}),dt()),Z&3&&(c=Ot(V[1].ui.a,V[0].l1&&(V[0].l1.i>.01||V[0].l2.i>.01||V[0].l3.i>.01))),c?X?(X.p(V,Z),Z&3&&Q(X,1)):(X=Wp(V),X.c(),Q(X,1),X.m(t,a)):X&&(pt(),ee(X,1,1,()=>{X=null}),dt()),Z&3&&(_=Ot(V[1].ui.h,V[0].l1&&(V[0].l1.p>.01||V[0].l2.p>.01||V[0].l3.p>.01||V[0].l1.q>.01||V[0].l2.q>.01||V[0].l3.q>.01))),_?J?(J.p(V,Z),Z&3&&Q(J,1)):(J=Vp(V),J.c(),Q(J,1),J.m(t,p)):J&&(pt(),ee(J,1,1,()=>{J=null}),dt()),Z&3&&(v=Ot(V[1].ui.f,V[0].l1&&(V[0].l1.f>.01||V[0].l2.f>.01||V[0].l3.f>.01))),v?$?($.p(V,Z),Z&3&&Q($,1)):($=Yp(V),$.c(),Q($,1),$.m(t,d)):$&&(pt(),ee($,1,1,()=>{$=null}),dt()),Z&3&&(h=Ot(V[1].ui.r,V[0].ri>0||V[0].re>0||V[0].ric>0||V[0].rec>0)),h?ce?(ce.p(V,Z),Z&3&&Q(ce,1)):(ce=Xp(V),ce.c(),Q(ce,1),ce.m(t,g)):ce&&(pt(),ee(ce,1,1,()=>{ce=null}),dt()),Z&3&&(M=Ot(V[1].ui.c,V[0].ea)),M?ie?(ie.p(V,Z),Z&3&&Q(ie,1)):(ie=Zp(V),ie.c(),Q(ie,1),ie.m(t,A)):ie&&(pt(),ee(ie,1,1,()=>{ie=null}),dt()),Z&3&&(I=Ot(V[1].ui.t,V[0].pr&&(V[0].pr.startsWith("NO")||V[0].pr.startsWith("10YNO")||V[0].pr.startsWith("10Y1001A1001A4")))),I?oe?(oe.p(V,Z),Z&3&&Q(oe,1)):(oe=Jp(V),oe.c(),Q(oe,1),oe.m(t,q)):oe&&(pt(),ee(oe,1,1,()=>{oe=null}),dt()),Z&2&&(L=Ot(V[1].ui.l)),L?ae?(ae.p(V,Z),Z&2&&Q(ae,1)):(ae=$p(V),ae.c(),Q(ae,1),ae.m(t,O)):ae&&(pt(),ee(ae,1,1,()=>{ae=null}),dt()),Z&3&&(U=Ot(V[1].ui.p,V[0].pe&&!Number.isNaN(V[0].p))),U?se?(se.p(V,Z),Z&3&&Q(se,1)):(se=xp(V),se.c(),Q(se,1),se.m(t,E)):se&&(pt(),ee(se,1,1,()=>{se=null}),dt()),Z&10&&(B=Ot(V[1].ui.d,V[3])),B?x?(x.p(V,Z),Z&10&&Q(x,1)):(x=e2(V),x.c(),Q(x,1),x.m(t,z)):x&&(pt(),ee(x,1,1,()=>{x=null}),dt()),Z&18&&(W=Ot(V[1].ui.m,V[4])),W?me?(me.p(V,Z),Z&18&&Q(me,1)):(me=t2(V),me.c(),Q(me,1),me.m(t,F)):me&&(pt(),ee(me,1,1,()=>{me=null}),dt()),Z&35&&(R=Ot(V[1].ui.s,V[0].t&&V[0].t!=-127&&V[5].c>1)),R?pe?(pe.p(V,Z),Z&35&&Q(pe,1)):(pe=l2(V),pe.c(),Q(pe,1),pe.m(t,null)):pe&&(pt(),ee(pe,1,1,()=>{pe=null}),dt())},i(V){K||(Q(y),Q(H),Q(Y),Q(X),Q(J),Q($),Q(ce),Q(ie),Q(oe),Q(ae),Q(se),Q(x),Q(me),Q(pe),K=!0)},o(V){ee(y),ee(H),ee(Y),ee(X),ee(J),ee($),ee(ce),ee(ie),ee(oe),ee(ae),ee(se),ee(x),ee(me),ee(pe),K=!1},d(V){V&&T(t),y&&y.d(),H&&H.d(),Y&&Y.d(),X&&X.d(),J&&J.d(),$&&$.d(),ce&&ce.d(),ie&&ie.d(),oe&&oe.d(),ae&&ae.d(),se&&se.d(),x&&x.d(),me&&me.d(),pe&&pe.d()}}}function w4(e,t,l){let{data:n={}}=t,{sysinfo:i={}}=t,o={},f={},r={},c={};wf.subscribe(d=>{l(2,o=d)}),bv.subscribe(d=>{l(3,f=d)}),gv.subscribe(d=>{l(4,r=d)}),wv.subscribe(d=>{l(5,c=d)});let a={};Ml.subscribe(d=>{l(6,a=d)});let _,p,v;return e.$$set=d=>{"data"in d&&l(0,n=d.data),"sysinfo"in d&&l(1,i=d.sysinfo)},e.$$.update=()=>{var d,h,g;e.$$.dirty&1&&(l(7,_=gl((n==null?void 0:n.ic)*1e3,"Wh")),l(8,p=gl((n==null?void 0:n.ec)*1e3,"Wh")),l(9,v=((d=n==null?void 0:n.l1)==null?void 0:d.u)>100&&((h=n==null?void 0:n.l2)==null?void 0:h.u)>100&&((g=n==null?void 0:n.l3)==null?void 0:g.u)>100))},[n,i,o,f,r,c,a,_,p,v]}class M4 extends mt{constructor(t){super(),_t(this,t,w4,k4,ct,{data:0,sysinfo:1})}}let sf={};const Es=xt(sf);async function S4(){sf=await(await fetch("configuration.json")).json(),Es.set(sf)}let of={};const Dv=xt(of);async function C4(){of=await(await fetch("priceconfig.json")).json(),Dv.set(of)}function n2(e,t,l){const n=e.slice();return n[2]=t[l],n[4]=l,n}function N4(e){let t;return{c(){t=m("option"),t.textContent="UART0",t.__value=3,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function T4(e){let t;return{c(){t=m("option"),t.textContent="UART0",t.__value=20,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function i2(e){let t;return{c(){t=m("option"),t.textContent="UART2",t.__value=113,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function s2(e){let t,l,n;return{c(){t=m("option"),t.textContent="UART1",l=b(),n=m("option"),n.textContent="UART2",t.__value=9,t.value=t.__value,n.__value=16,n.value=n.__value},m(i,o){P(i,t,o),P(i,l,o),P(i,n,o)},d(i){i&&T(t),i&&T(l),i&&T(n)}}}function o2(e){let t;return{c(){t=m("option"),t.textContent="UART1",t.__value=18,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function a2(e){let t,l,n;return{c(){t=m("option"),l=k("GPIO"),n=k(e[4]),t.__value=e[4],t.value=t.__value},m(i,o){P(i,t,o),s(t,l),s(t,n)},d(i){i&&T(t)}}}function f2(e){let t,l=e[4]>1&&!(e[0]=="esp32"&&(e[4]==9||e[4]==16))&&!((e[0]=="esp32s2"||e[0]=="esp32s3")&&e[4]==18)&&!(e[0]=="esp8266"&&(e[4]==3||e[4]==113))&&a2(e);return{c(){l&&l.c(),t=Ut()},m(n,i){l&&l.m(n,i),P(n,t,i)},p(n,i){n[4]>1&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!((n[0]=="esp32s2"||n[0]=="esp32s3")&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=a2(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&T(t)}}}function P4(e){let t,l,n,i,o;function f(h,g){return h[0]=="esp32c3"?T4:N4}let r=f(e),c=r(e),a=e[0]=="esp8266"&&i2(),_=(e[0]=="esp32"||e[0]=="esp32solo")&&s2(),p=(e[0]=="esp32s2"||e[0]=="esp32s3")&&o2(),v={length:e[1]+1},d=[];for(let h=0;h{"chip"in o&&l(0,n=o.chip)},e.$$.update=()=>{if(e.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=19);break}},[n,i]}class af extends mt{constructor(t){super(),_t(this,t,E4,P4,ct,{chip:0})}}function u2(e){let t,l,n=e[1]&&r2(e);return{c(){t=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),u(t,"class","z-50"),u(t,"aria-modal","true")},m(i,o){P(i,t,o),s(t,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=r2(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&T(t),n&&n.d()}}}function r2(e){let t,l;return{c(){t=m("div"),l=k(e[1]),u(t,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){P(n,t,i),s(t,l)},p(n,i){i&2&&C(l,n[1])},d(n){n&&T(t)}}}function A4(e){let t,l=e[0]&&u2(e);return{c(){l&&l.c(),t=Ut()},m(n,i){l&&l.m(n,i),P(n,t,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=u2(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},i:ze,o:ze,d(n){l&&l.d(n),n&&T(t)}}}function D4(e,t,l){let{active:n}=t,{message:i}=t;return e.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class kl extends mt{constructor(t){super(),_t(this,t,D4,A4,ct,{active:0,message:1})}}function c2(e,t,l){const n=e.slice();return n[1]=t[l],n}function _2(e){let t,l,n=e[1]+"",i;return{c(){t=m("option"),l=k("Europe/"),i=k(n),t.__value="Europe/"+e[1],t.value=t.__value},m(o,f){P(o,t,f),s(t,l),s(t,i)},p:ze,d(o){o&&T(t)}}}function q4(e){let t,l,n,i=e[0],o=[];for(let f=0;f>1&1,D=0;D0;w--)D[w]=D[w]?D[w-1]^O.EXPONENT[B._modN(O.LOG[D[w]]+S)]:D[w-1];D[0]=O.EXPONENT[B._modN(O.LOG[D[0]]+S)]}for(S=0;S<=N;S++)D[S]=O.LOG[D[S]]},_checkBadness:function(){var S,w,N,D,j,te=0,le=this._badness,fe=this.buffer,de=this.width;for(j=0;jde*de;)we-=de*de,Pe++;for(te+=Pe*B.N4,D=0;D=le-2&&(S=le-2,j>9&&S--);var fe=S;if(j>9){for(te[fe+2]=0,te[fe+3]=0;fe--;)w=te[fe],te[fe+3]|=255&w<<4,te[fe+2]=w>>4;te[2]|=255&S<<4,te[1]=S>>4,te[0]=64|S>>12}else{for(te[fe+1]=0,te[fe+2]=0;fe--;)w=te[fe],te[fe+2]|=255&w<<4,te[fe+1]=w>>4;te[1]|=255&S<<4,te[0]=64|S>>4}for(fe=S+3-(j<10);fe=5&&(N+=B.N1+D[w]-5);for(w=3;wS||D[w-3]*3>=D[w]*4||D[w+3]*3>=D[w]*4)&&(N+=B.N3);return N},_finish:function(){this._stringBuffer=this.buffer.slice();var S,w,N=0,D=3e4;for(w=0;w<8&&(this._applyMask(w),S=this._checkBadness(),S>=1)D&1&&(j[te-1-w+te*8]=1,w<6?j[8+te*w]=1:j[8+te*(w+1)]=1);for(w=0;w<7;w++,D>>=1)D&1&&(j[8+te*(te-7+w)]=1,w?j[6-w+te*8]=1:j[7+te*8]=1)},_interleaveBlocks:function(){var S,w,N=this._dataBlock,D=this._ecc,j=this._eccBlock,te=0,le=this._calculateMaxLength(),fe=this._neccBlock1,de=this._neccBlock2,qe=this._stringBuffer;for(S=0;S1)for(S=A.BLOCK[D],N=j-7;;){for(w=j-7;w>S-3&&(this._addAlignment(w,N),!(w6)for(S=E.BLOCK[te-7],w=17,N=0;N<6;N++)for(D=0;D<3;D++,w--)1&(w>11?te>>w-12:S>>w)?(j[5-N+le*(2-D+le-11)]=1,j[2-D+le-11+le*(5-N)]=1):(this._setMask(5-N,2-D+le-11),this._setMask(2-D+le-11,5-N))},_isMasked:function(S,w){var N=B._getMaskBit(S,w);return this._mask[N]===1},_pack:function(){var S,w,N,D=1,j=1,te=this.width,le=te-1,fe=te-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(w=0;ww&&(N=S,S=w,w=N),N=w,N+=w*w,N>>=1,N+=S,N},_modN:function(S){for(;S>=255;)S-=255,S=(S>>8)+(S&255);return S},N1:3,N2:3,N3:40,N4:10}),z=B,W=d.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var S=this.element;S.width=S.height=this.qrious.size}}),F=W,R=p.extend(function(S,w,N,D){this.name=S,this.modifiable=Boolean(w),this.defaultValue=N,this._valueTransformer=D},{transform:function(S){var w=this._valueTransformer;return typeof w=="function"?w(S,this):S}}),K=R,y=p.extend(null,{abs:function(S){return S!=null?Math.abs(S):null},hasOwn:function(S,w){return Object.prototype.hasOwnProperty.call(S,w)},noop:function(){},toUpperCase:function(S){return S!=null?S.toUpperCase():null}}),H=y,Y=p.extend(function(S){this.options={},S.forEach(function(w){this.options[w.name]=w},this)},{exists:function(S){return this.options[S]!=null},get:function(S,w){return Y._get(this.options[S],w)},getAll:function(S){var w,N=this.options,D={};for(w in N)H.hasOwn(N,w)&&(D[w]=Y._get(N[w],S));return D},init:function(S,w,N){typeof N!="function"&&(N=H.noop);var D,j;for(D in this.options)H.hasOwn(this.options,D)&&(j=this.options[D],Y._set(j,j.defaultValue,w),Y._createAccessor(j,w,N));this._setAll(S,w,!0)},set:function(S,w,N){return this._set(S,w,N)},setAll:function(S,w){return this._setAll(S,w)},_set:function(S,w,N,D){var j=this.options[S];if(!j)throw new Error("Invalid option: "+S);if(!j.modifiable&&!D)throw new Error("Option cannot be modified: "+S);return Y._set(j,w,N)},_setAll:function(S,w,N){if(!S)return!1;var D,j=!1;for(D in S)H.hasOwn(S,D)&&this._set(D,S[D],w,N)&&(j=!0);return j}},{_createAccessor:function(S,w,N){var D={get:function(){return Y._get(S,w)}};S.modifiable&&(D.set=function(j){Y._set(S,j,w)&&N(j,S)}),Object.defineProperty(w,S.name,D)},_get:function(S,w){return w["_"+S.name]},_set:function(S,w,N){var D="_"+S.name,j=N[D],te=S.transform(w!=null?w:S.defaultValue);return N[D]=te,te!==j}}),X=Y,J=p.extend(function(){this._services={}},{getService:function(S){var w=this._services[S];if(!w)throw new Error("Service is not being managed with name: "+S);return w},setService:function(S,w){if(this._services[S])throw new Error("Service is already managed with name: "+S);w&&(this._services[S]=w)}}),$=J,ce=new X([new K("background",!0,"white"),new K("backgroundAlpha",!0,1,H.abs),new K("element"),new K("foreground",!0,"black"),new K("foregroundAlpha",!0,1,H.abs),new K("level",!0,"L",H.toUpperCase),new K("mime",!0,"image/png"),new K("padding",!0,null,H.abs),new K("size",!0,100,H.abs),new K("value",!0,"")]),ie=new $,oe=p.extend(function(S){ce.init(S,this,this.update.bind(this));var w=ce.get("element",this),N=ie.getService("element"),D=w&&N.isCanvas(w)?w:N.createCanvas(),j=w&&N.isImage(w)?w:N.createImage();this._canvasRenderer=new g(this,D,!0),this._imageRenderer=new F(this,j,j===w),this.update()},{get:function(){return ce.getAll(this)},set:function(S){ce.setAll(S,this)&&this.update()},toDataURL:function(S){return this.canvas.toDataURL(S||this.mime)},update:function(){var S=new z({level:this.level,value:this.value});this._canvasRenderer.render(S),this._imageRenderer.render(S)}},{use:function(S){ie.setService(S.getName(),S)}});Object.defineProperties(oe.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var ae=oe,se=ae,x=p.extend({getName:function(){}}),me=x,pe=me.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(S){},isImage:function(S){}}),V=pe,Z=V.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(S){return S instanceof HTMLCanvasElement},isImage:function(S){return S instanceof HTMLImageElement}}),ge=Z;se.use(new ge);var ve=se;return ve})})(Ov);const F4=Ov.exports;function B4(e){let t,l;return{c(){t=m("img"),jo(t.src,l=e[2])||u(t,"src",l),u(t,"alt",e[0]),u(t,"class",e[1])},m(n,i){P(n,t,i)},p(n,[i]){i&4&&!jo(t.src,l=n[2])&&u(t,"src",l),i&1&&u(t,"alt",n[0]),i&2&&u(t,"class",n[1])},i:ze,o:ze,d(n){n&&T(t)}}}function U4(e,t,l){const n=new F4;let{errorCorrection:i="L"}=t,{background:o="#fff"}=t,{color:f="#000"}=t,{size:r="200"}=t,{value:c=""}=t,{padding:a=0}=t,{className:_="qrcode"}=t,p="";function v(){n.set({background:o,foreground:f,level:i,padding:a,size:r,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return Ud(()=>{v()}),e.$$set=d=>{"errorCorrection"in d&&l(3,i=d.errorCorrection),"background"in d&&l(4,o=d.background),"color"in d&&l(5,f=d.color),"size"in d&&l(6,r=d.size),"value"in d&&l(0,c=d.value),"padding"in d&&l(7,a=d.padding),"className"in d&&l(1,_=d.className)},e.$$.update=()=>{e.$$.dirty&1&&c&&v()},[c,_,p,i,o,f,r,a]}class j4 extends mt{constructor(t){super(),_t(this,t,U4,B4,ct,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function m2(e,t,l){const n=e.slice();return n[107]=t[l],n}function p2(e,t,l){const n=e.slice();return n[110]=t[l],n[111]=t,n[112]=l,n}function d2(e,t,l){const n=e.slice();return n[113]=t[l],n[114]=t,n[115]=l,n}function H4(e,t,l){const n=e.slice();return n[116]=t[l],n}function y4(e,t,l){const n=e.slice();return n[119]=t[l],n}function v2(e){let t,l,n,i,o;return{c(){t=m("option"),t.textContent="NO1 with support",l=m("option"),l.textContent="NO2 with support",n=m("option"),n.textContent="NO3 with support",i=m("option"),i.textContent="NO4 with support",o=m("option"),o.textContent="NO5 with support",t.__value="NO1S",t.value=t.__value,l.__value="NO2S",l.value=l.__value,n.__value="NO3S",n.value=n.__value,i.__value="NO4S",i.value=i.__value,o.__value="NO5S",o.value=o.__value},m(f,r){P(f,t,r),P(f,l,r),P(f,n,r),P(f,i,r),P(f,o,r)},d(f){f&&T(t),f&&T(l),f&&T(n),f&&T(i),f&&T(o)}}}function z4(e){let t,l;return{c(){t=m("option"),l=k(e[119]),t.__value=e[119],t.value=t.__value},m(n,i){P(n,t,i),s(t,l)},p:ze,d(n){n&&T(t)}}}function W4(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.price)==null?void 0:i.conf)!=null?o:"Configure")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.price)==null?void 0:a.conf)!=null?_:"Configure")+"")&&C(l,t)},d(f){f&&T(l)}}}function h2(e){let t,l,n,i,o;return{c(){var f,r,c;t=m("br"),l=m("input"),u(l,"name","pt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder",n=(c=(r=(f=e[1].conf)==null?void 0:f.price)==null?void 0:r.api_key_placeholder)!=null?c:"")},m(f,r){P(f,t,r),P(f,l,r),be(l,e[4].p.t),i||(o=re(l,"input",e[24]),i=!0)},p(f,r){var c,a,_;r[0]&2&&n!==(n=(_=(a=(c=f[1].conf)==null?void 0:c.price)==null?void 0:a.api_key_placeholder)!=null?_:"")&&u(l,"placeholder",n),r[0]&16&&l.value!==f[4].p.t&&be(l,f[4].p.t)},d(f){f&&T(t),f&&T(l),i=!1,o()}}}function b2(e){var M,A,I,q,L,O,U,E;let t,l=((q=(I=(A=(M=e[1].conf)==null?void 0:M.general)==null?void 0:A.security)==null?void 0:I.username)!=null?q:"Username")+"",n,i,o,f,r,c,a=((E=(U=(O=(L=e[1].conf)==null?void 0:L.general)==null?void 0:O.security)==null?void 0:U.password)!=null?E:"Password")+"",_,p,v,d,h,g;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),r=b(),c=m("div"),_=k(a),p=m("br"),v=b(),d=m("input"),u(f,"name","gu"),u(f,"type","text"),u(f,"class","in-s"),u(f,"maxlength","36"),u(t,"class","my-1"),u(d,"name","gp"),u(d,"type","password"),u(d,"class","in-s"),u(d,"maxlength","36"),u(c,"class","my-1")},m(B,z){P(B,t,z),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].g.u),P(B,r,z),P(B,c,z),s(c,_),s(c,p),s(c,v),s(c,d),be(d,e[4].g.p),h||(g=[re(f,"input",e[26]),re(d,"input",e[27])],h=!0)},p(B,z){var W,F,R,K,y,H,Y,X;z[0]&2&&l!==(l=((K=(R=(F=(W=B[1].conf)==null?void 0:W.general)==null?void 0:F.security)==null?void 0:R.username)!=null?K:"Username")+"")&&C(n,l),z[0]&16&&f.value!==B[4].g.u&&be(f,B[4].g.u),z[0]&2&&a!==(a=((X=(Y=(H=(y=B[1].conf)==null?void 0:y.general)==null?void 0:H.security)==null?void 0:Y.password)!=null?X:"Password")+"")&&C(_,a),z[0]&16&&d.value!==B[4].g.p&&be(d,B[4].g.p)},d(B){B&&T(t),B&&T(r),B&&T(c),h=!1,Et(g)}}}function G4(e){var ae,se,x,me,pe,V,Z,ge,ve;let t,l,n=((x=(se=(ae=e[1].conf)==null?void 0:ae.meter)==null?void 0:se.buffer)!=null?x:"Buffer size")+"",i,o,f,r=((V=(pe=(me=e[1].conf)==null?void 0:me.meter)==null?void 0:pe.serial)!=null?V:"Serial conf.")+"",c,a,_,p,v,d=((ve=(ge=(Z=e[1].conf)==null?void 0:Z.meter)==null?void 0:ge.inverted)!=null?ve:"inverted")+"",h,g,M,A,I,q,L,O,U,E,B,z,W,F,R,K,y,H,Y,X,J,$,ce,ie=[3,12,24,48,96,192,384,576,1152],oe=[];for(let S=0;S<9;S+=1)oe[S]=K4(H4(e,ie,S));return{c(){t=m("div"),l=m("span"),i=k(n),o=b(),f=m("span"),c=k(r),a=b(),_=m("label"),p=m("input"),v=b(),h=k(d),g=b(),M=m("div"),A=m("select"),I=m("option"),q=k("Autodetect");for(let S=0;S<9;S+=1)oe[S].c();O=b(),U=m("select"),E=m("option"),B=k("-"),W=m("option"),W.textContent="7N1",F=m("option"),F.textContent="8N1",R=m("option"),R.textContent="8N2",K=m("option"),K.textContent="7E1",y=m("option"),y.textContent="8E1",Y=b(),X=m("input"),u(l,"class","float-right"),u(p,"name","mi"),p.__value="true",p.value=p.__value,u(p,"type","checkbox"),u(p,"class","rounded mb-1"),u(_,"class","mt-2 ml-3 whitespace-nowrap"),I.__value=0,I.value=I.__value,I.disabled=L=e[4].m.b!=0,u(A,"name","mb"),u(A,"class","in-f tr w-1/2"),e[4].m.b===void 0&&Ct(()=>e[32].call(A)),E.__value=0,E.value=E.__value,E.disabled=z=e[4].m.b!=0,W.__value=2,W.value=W.__value,F.__value=3,F.value=F.__value,R.__value=7,R.value=R.__value,K.__value=10,K.value=K.__value,y.__value=11,y.value=y.__value,u(U,"name","mp"),u(U,"class","in-m"),U.disabled=H=e[4].m.b==0,e[4].m.p===void 0&&Ct(()=>e[33].call(U)),u(X,"name","ms"),u(X,"type","number"),u(X,"min",64),u(X,"max",J=e[0].chip=="esp8266"?e[4].i.h.p==3||e[4].i.h.p==113?512:128:4096),u(X,"step",64),u(X,"class","in-l tr w-1/2"),u(M,"class","flex w-full"),u(t,"class","my-1")},m(S,w){P(S,t,w),s(t,l),s(l,i),s(t,o),s(t,f),s(f,c),s(t,a),s(t,_),s(_,p),p.checked=e[4].m.i,s(_,v),s(_,h),s(t,g),s(t,M),s(M,A),s(A,I),s(I,q);for(let N=0;N<9;N+=1)oe[N]&&oe[N].m(A,null);Je(A,e[4].m.b,!0),s(M,O),s(M,U),s(U,E),s(E,B),s(U,W),s(U,F),s(U,R),s(U,K),s(U,y),Je(U,e[4].m.p,!0),s(M,Y),s(M,X),be(X,e[4].m.s),$||(ce=[re(p,"change",e[31]),re(A,"change",e[32]),re(U,"change",e[33]),re(X,"input",e[34])],$=!0)},p(S,w){var N,D,j,te,le,fe,de,qe,Pe;w[0]&2&&n!==(n=((j=(D=(N=S[1].conf)==null?void 0:N.meter)==null?void 0:D.buffer)!=null?j:"Buffer size")+"")&&C(i,n),w[0]&2&&r!==(r=((fe=(le=(te=S[1].conf)==null?void 0:te.meter)==null?void 0:le.serial)!=null?fe:"Serial conf.")+"")&&C(c,r),w[0]&16&&(p.checked=S[4].m.i),w[0]&2&&d!==(d=((Pe=(qe=(de=S[1].conf)==null?void 0:de.meter)==null?void 0:qe.inverted)!=null?Pe:"inverted")+"")&&C(h,d),w[0]&16&&L!==(L=S[4].m.b!=0)&&(I.disabled=L),w[0]&16&&Je(A,S[4].m.b),w[0]&16&&z!==(z=S[4].m.b!=0)&&(E.disabled=z),w[0]&16&&H!==(H=S[4].m.b==0)&&(U.disabled=H),w[0]&16&&Je(U,S[4].m.p),w[0]&17&&J!==(J=S[0].chip=="esp8266"?S[4].i.h.p==3||S[4].i.h.p==113?512:128:4096)&&u(X,"max",J),w[0]&16&&Ze(X.value)!==S[4].m.s&&be(X,S[4].m.s)},d(S){S&&T(t),Xt(oe,S),$=!1,Et(ce)}}}function V4(e){var a,_,p;let t,l,n=((p=(_=(a=e[1].conf)==null?void 0:a.meter)==null?void 0:_.pulses)!=null?p:"Pulses per kWh")+"",i,o,f,r,c;return{c(){t=m("div"),l=m("span"),i=k(n),o=b(),f=m("input"),u(f,"name","mb"),u(f,"class","in-s tr"),u(f,"type","number"),u(f,"min",1),u(f,"max",3600),u(t,"class","my-1")},m(v,d){P(v,t,d),s(t,l),s(l,i),s(t,o),s(t,f),be(f,e[4].m.b),r||(c=re(f,"input",e[30]),r=!0)},p(v,d){var h,g,M;d[0]&2&&n!==(n=((M=(g=(h=v[1].conf)==null?void 0:h.meter)==null?void 0:g.pulses)!=null?M:"Pulses per kWh")+"")&&C(i,n),d[0]&16&&Ze(f.value)!==v[4].m.b&&be(f,v[4].m.b)},d(v){v&&T(t),r=!1,c()}}}function K4(e){let t,l=e[116]*100+"",n;return{c(){t=m("option"),n=k(l),t.__value=e[116]*100,t.value=t.__value},m(i,o){P(i,t,o),s(t,n)},p:ze,d(i){i&&T(t)}}}function g2(e){let t,l,n,i;return{c(){t=m("br"),l=m("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s")},m(o,f){P(o,t,f),P(o,l,f),be(l,e[4].m.e.k),n||(i=re(l,"input",e[39]),n=!0)},p(o,f){f[0]&16&&l.value!==o[4].m.e.k&&be(l,o[4].m.e.k)},d(o){o&&T(t),o&&T(l),n=!1,i()}}}function k2(e){var a,_,p;let t,l=((p=(_=(a=e[1].conf)==null?void 0:a.meter)==null?void 0:_.authkey)!=null?p:"Authentication key")+"",n,i,o,f,r,c;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),u(f,"name","mea"),u(f,"type","text"),u(f,"class","in-s"),u(t,"class","my-1")},m(v,d){P(v,t,d),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].m.e.a),r||(c=re(f,"input",e[40]),r=!0)},p(v,d){var h,g,M;d[0]&2&&l!==(l=((M=(g=(h=v[1].conf)==null?void 0:h.meter)==null?void 0:g.authkey)!=null?M:"Authentication key")+"")&&C(n,l),d[0]&16&&f.value!==v[4].m.e.a&&be(f,v[4].m.e.a)},d(v){v&&T(t),r=!1,c()}}}function w2(e){var H,Y,X,J,$,ce,ie,oe,ae,se,x,me,pe,V,Z,ge;let t,l,n=((J=(X=(Y=(H=e[1].conf)==null?void 0:H.meter)==null?void 0:Y.multipliers)==null?void 0:X.watt)!=null?J:"Watt")+"",i,o,f,r,c,a,_=((oe=(ie=(ce=($=e[1].conf)==null?void 0:$.meter)==null?void 0:ce.multipliers)==null?void 0:ie.volt)!=null?oe:"Volt")+"",p,v,d,h,g,M,A=((me=(x=(se=(ae=e[1].conf)==null?void 0:ae.meter)==null?void 0:se.multipliers)==null?void 0:x.amp)!=null?me:"Amp")+"",I,q,L,O,U,E,B=((ge=(Z=(V=(pe=e[1].conf)==null?void 0:pe.meter)==null?void 0:V.multipliers)==null?void 0:Z.kwh)!=null?ge:"kWh")+"",z,W,F,R,K,y;return{c(){t=m("div"),l=m("div"),i=k(n),o=m("br"),f=b(),r=m("input"),c=b(),a=m("div"),p=k(_),v=m("br"),d=b(),h=m("input"),g=b(),M=m("div"),I=k(A),q=m("br"),L=b(),O=m("input"),U=b(),E=m("div"),z=k(B),W=m("br"),F=b(),R=m("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(h,"name","mmv"),u(h,"type","number"),u(h,"min","0.00"),u(h,"max","1000"),u(h,"step","0.001"),u(h,"class","in-m tr w-full"),u(a,"class","w-1/4"),u(O,"name","mma"),u(O,"type","number"),u(O,"min","0.00"),u(O,"max","1000"),u(O,"step","0.001"),u(O,"class","in-m tr w-full"),u(M,"class","w-1/4"),u(R,"name","mmc"),u(R,"type","number"),u(R,"min","0.00"),u(R,"max","1000"),u(R,"step","0.001"),u(R,"class","in-l tr w-full"),u(E,"class","w-1/4"),u(t,"class","flex my-1")},m(ve,S){P(ve,t,S),s(t,l),s(l,i),s(l,o),s(l,f),s(l,r),be(r,e[4].m.m.w),s(t,c),s(t,a),s(a,p),s(a,v),s(a,d),s(a,h),be(h,e[4].m.m.v),s(t,g),s(t,M),s(M,I),s(M,q),s(M,L),s(M,O),be(O,e[4].m.m.a),s(t,U),s(t,E),s(E,z),s(E,W),s(E,F),s(E,R),be(R,e[4].m.m.c),K||(y=[re(r,"input",e[42]),re(h,"input",e[43]),re(O,"input",e[44]),re(R,"input",e[45])],K=!0)},p(ve,S){var w,N,D,j,te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He;S[0]&2&&n!==(n=((j=(D=(N=(w=ve[1].conf)==null?void 0:w.meter)==null?void 0:N.multipliers)==null?void 0:D.watt)!=null?j:"Watt")+"")&&C(i,n),S[0]&16&&Ze(r.value)!==ve[4].m.m.w&&be(r,ve[4].m.m.w),S[0]&2&&_!==(_=((de=(fe=(le=(te=ve[1].conf)==null?void 0:te.meter)==null?void 0:le.multipliers)==null?void 0:fe.volt)!=null?de:"Volt")+"")&&C(p,_),S[0]&16&&Ze(h.value)!==ve[4].m.m.v&&be(h,ve[4].m.m.v),S[0]&2&&A!==(A=((Fe=(we=(Pe=(qe=ve[1].conf)==null?void 0:qe.meter)==null?void 0:Pe.multipliers)==null?void 0:we.amp)!=null?Fe:"Amp")+"")&&C(I,A),S[0]&16&&Ze(O.value)!==ve[4].m.m.a&&be(O,ve[4].m.m.a),S[0]&2&&B!==(B=((He=(De=(ke=(Ae=ve[1].conf)==null?void 0:Ae.meter)==null?void 0:ke.multipliers)==null?void 0:De.kwh)!=null?He:"kWh")+"")&&C(z,B),S[0]&16&&Ze(R.value)!==ve[4].m.m.c&&be(R,ve[4].m.m.c)},d(ve){ve&&T(t),K=!1,Et(y)}}}function M2(e){var i,o,f;let t,l=((f=(o=(i=e[1].conf)==null?void 0:i.connection)==null?void 0:o.eth)!=null?f:"Ethernet")+"",n;return{c(){t=m("option"),n=k(l),t.__value=3,t.value=t.__value},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c[0]&2&&l!==(l=((p=(_=(a=r[1].conf)==null?void 0:a.connection)==null?void 0:_.eth)!=null?p:"Ethernet")+"")&&C(n,l)},d(r){r&&T(t)}}}function S2(e){var te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt,Te,ue,Ie,kt,lt,wt,st,ot,et,Nt,gt,At,Pt;let t,l=((fe=(le=(te=e[1].conf)==null?void 0:te.connection)==null?void 0:le.ssid)!=null?fe:"SSID")+"",n,i,o,f,r,c,a=((Pe=(qe=(de=e[1].conf)==null?void 0:de.connection)==null?void 0:qe.psk)!=null?Pe:"Password")+"",_,p,v,d,h,g,M,A=((ke=(Ae=(Fe=(we=e[1].conf)==null?void 0:we.connection)==null?void 0:Fe.ps)==null?void 0:Ae.title)!=null?ke:"Power saving")+"",I,q,L,O,U,E=((je=(Oe=(He=(De=e[1].conf)==null?void 0:De.connection)==null?void 0:He.ps)==null?void 0:Oe.default)!=null?je:"Default")+"",B,z,W=((xe=($e=(We=(Ye=e[1].conf)==null?void 0:Ye.connection)==null?void 0:We.ps)==null?void 0:$e.off)!=null?xe:"Off")+"",F,R,K=((Ie=(ue=(Te=(tt=e[1].conf)==null?void 0:tt.connection)==null?void 0:Te.ps)==null?void 0:ue.min)!=null?Ie:"Min")+"",y,H,Y=((st=(wt=(lt=(kt=e[1].conf)==null?void 0:kt.connection)==null?void 0:lt.ps)==null?void 0:wt.max)!=null?st:"Max")+"",X,J,$,ce=((Nt=(et=(ot=e[1].conf)==null?void 0:ot.connection)==null?void 0:et.pwr)!=null?Nt:"Power")+"",ie,oe,ae,se,x,me,pe,V,Z,ge,ve,S,w=((Pt=(At=(gt=e[1].conf)==null?void 0:gt.connection)==null?void 0:At.tick_11b)!=null?Pt:"802.11b")+"",N,D,j;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),r=b(),c=m("div"),_=k(a),p=m("br"),v=b(),d=m("input"),h=b(),g=m("div"),M=m("div"),I=k(A),q=m("br"),L=b(),O=m("select"),U=m("option"),B=k(E),z=m("option"),F=k(W),R=m("option"),y=k(K),H=m("option"),X=k(Y),J=b(),$=m("div"),ie=k(ce),oe=m("br"),ae=b(),se=m("div"),x=m("input"),me=b(),pe=m("span"),pe.textContent="dBm",V=b(),Z=m("div"),ge=m("label"),ve=m("input"),S=b(),N=k(w),u(f,"name","ws"),u(f,"type","text"),u(f,"class","in-s"),u(t,"class","my-1"),u(d,"name","wp"),u(d,"type","password"),u(d,"class","in-s"),u(c,"class","my-1"),U.__value=255,U.value=U.__value,z.__value=0,z.value=z.__value,R.__value=1,R.value=R.__value,H.__value=2,H.value=H.__value,u(O,"name","wz"),u(O,"class","in-s"),e[4].w.z===void 0&&Ct(()=>e[49].call(O)),u(M,"class","w-1/2"),u(x,"name","ww"),u(x,"type","number"),u(x,"min","0"),u(x,"max","20.5"),u(x,"step","0.5"),u(x,"class","in-f tr w-full"),u(pe,"class","in-post"),u(se,"class","flex"),u($,"class","ml-2 w-1/2"),u(g,"class","my-1 flex"),u(ve,"type","checkbox"),u(ve,"name","wb"),ve.__value="true",ve.value=ve.__value,u(ve,"class","rounded mb-1"),u(Z,"class","my-3")},m(Be,ye){P(Be,t,ye),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].w.s),P(Be,r,ye),P(Be,c,ye),s(c,_),s(c,p),s(c,v),s(c,d),be(d,e[4].w.p),P(Be,h,ye),P(Be,g,ye),s(g,M),s(M,I),s(M,q),s(M,L),s(M,O),s(O,U),s(U,B),s(O,z),s(z,F),s(O,R),s(R,y),s(O,H),s(H,X),Je(O,e[4].w.z,!0),s(g,J),s(g,$),s($,ie),s($,oe),s($,ae),s($,se),s(se,x),be(x,e[4].w.w),s(se,me),s(se,pe),P(Be,V,ye),P(Be,Z,ye),s(Z,ge),s(ge,ve),ve.checked=e[4].w.b,s(ge,S),s(ge,N),D||(j=[re(f,"input",e[47]),re(d,"input",e[48]),re(O,"change",e[49]),re(x,"input",e[50]),re(ve,"change",e[51])],D=!0)},p(Be,ye){var It,vt,nt,Tt,it,at,rt,jt,Lt,Ht,yt,Me,Ve,Rt,Gt,zt,Dt,Kt,Zt,tl,Jt,ft,Mt,Ke,ne,Ue,Le,St,ut,Yt,ll,fl;ye[0]&2&&l!==(l=((nt=(vt=(It=Be[1].conf)==null?void 0:It.connection)==null?void 0:vt.ssid)!=null?nt:"SSID")+"")&&C(n,l),ye[0]&16&&f.value!==Be[4].w.s&&be(f,Be[4].w.s),ye[0]&2&&a!==(a=((at=(it=(Tt=Be[1].conf)==null?void 0:Tt.connection)==null?void 0:it.psk)!=null?at:"Password")+"")&&C(_,a),ye[0]&16&&d.value!==Be[4].w.p&&be(d,Be[4].w.p),ye[0]&2&&A!==(A=((Ht=(Lt=(jt=(rt=Be[1].conf)==null?void 0:rt.connection)==null?void 0:jt.ps)==null?void 0:Lt.title)!=null?Ht:"Power saving")+"")&&C(I,A),ye[0]&2&&E!==(E=((Rt=(Ve=(Me=(yt=Be[1].conf)==null?void 0:yt.connection)==null?void 0:Me.ps)==null?void 0:Ve.default)!=null?Rt:"Default")+"")&&C(B,E),ye[0]&2&&W!==(W=((Kt=(Dt=(zt=(Gt=Be[1].conf)==null?void 0:Gt.connection)==null?void 0:zt.ps)==null?void 0:Dt.off)!=null?Kt:"Off")+"")&&C(F,W),ye[0]&2&&K!==(K=((ft=(Jt=(tl=(Zt=Be[1].conf)==null?void 0:Zt.connection)==null?void 0:tl.ps)==null?void 0:Jt.min)!=null?ft:"Min")+"")&&C(y,K),ye[0]&2&&Y!==(Y=((Ue=(ne=(Ke=(Mt=Be[1].conf)==null?void 0:Mt.connection)==null?void 0:Ke.ps)==null?void 0:ne.max)!=null?Ue:"Max")+"")&&C(X,Y),ye[0]&16&&Je(O,Be[4].w.z),ye[0]&2&&ce!==(ce=((ut=(St=(Le=Be[1].conf)==null?void 0:Le.connection)==null?void 0:St.pwr)!=null?ut:"Power")+"")&&C(ie,ce),ye[0]&16&&Ze(x.value)!==Be[4].w.w&&be(x,Be[4].w.w),ye[0]&16&&(ve.checked=Be[4].w.b),ye[0]&2&&w!==(w=((fl=(ll=(Yt=Be[1].conf)==null?void 0:Yt.connection)==null?void 0:ll.tick_11b)!=null?fl:"802.11b")+"")&&C(N,w)},d(Be){Be&&T(t),Be&&T(r),Be&&T(c),Be&&T(h),Be&&T(g),Be&&T(V),Be&&T(Z),D=!1,Et(j)}}}function C2(e){var q,L,O,U,E,B;let t,l=((O=(L=(q=e[1].conf)==null?void 0:q.network)==null?void 0:L.gw)!=null?O:"Gateway")+"",n,i,o,f,r,c,a=((B=(E=(U=e[1].conf)==null?void 0:U.network)==null?void 0:E.dns)!=null?B:"DNS")+"",_,p,v,d,h,g,M,A,I;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),r=b(),c=m("div"),_=k(a),p=m("br"),v=b(),d=m("div"),h=m("input"),g=b(),M=m("input"),u(f,"name","ng"),u(f,"type","text"),u(f,"class","in-s"),u(t,"class","my-1"),u(h,"name","nd1"),u(h,"type","text"),u(h,"class","in-f w-full"),u(M,"name","nd2"),u(M,"type","text"),u(M,"class","in-l w-full"),u(d,"class","flex"),u(c,"class","my-1")},m(z,W){P(z,t,W),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].n.g),P(z,r,W),P(z,c,W),s(c,_),s(c,p),s(c,v),s(c,d),s(d,h),be(h,e[4].n.d1),s(d,g),s(d,M),be(M,e[4].n.d2),A||(I=[re(f,"input",e[55]),re(h,"input",e[56]),re(M,"input",e[57])],A=!0)},p(z,W){var F,R,K,y,H,Y;W[0]&2&&l!==(l=((K=(R=(F=z[1].conf)==null?void 0:F.network)==null?void 0:R.gw)!=null?K:"Gateway")+"")&&C(n,l),W[0]&16&&f.value!==z[4].n.g&&be(f,z[4].n.g),W[0]&2&&a!==(a=((Y=(H=(y=z[1].conf)==null?void 0:y.network)==null?void 0:H.dns)!=null?Y:"DNS")+"")&&C(_,a),W[0]&16&&h.value!==z[4].n.d1&&be(h,z[4].n.d1),W[0]&16&&M.value!==z[4].n.d2&&be(M,z[4].n.d2)},d(z){z&&T(t),z&&T(r),z&&T(c),A=!1,Et(I)}}}function N2(e){let t,l,n,i,o;return{c(){t=m("label"),l=m("input"),n=k(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",l.value=l.__value,u(l,"class","rounded mb-1"),u(t,"class","float-right mr-3")},m(f,r){P(f,t,r),s(t,l),l.checked=e[4].q.s.e,s(t,n),i||(o=[re(l,"change",e[62]),re(l,"change",e[16])],i=!0)},p(f,r){r[0]&16&&(l.checked=f[4].q.s.e)},d(f){f&&T(t),i=!1,Et(o)}}}function T2(e){let t,l,n,i,o,f,r,c,a,_,p,v,d;const h=[Q4,Y4],g=[];function M(E,B){return E[4].q.s.c?0:1}n=M(e),i=g[n]=h[n](e);const A=[$4,J4],I=[];function q(E,B){return E[4].q.s.r?0:1}r=q(e),c=I[r]=A[r](e);const L=[lg,tg],O=[];function U(E,B){return E[4].q.s.k?0:1}return p=U(e),v=O[p]=L[p](e),{c(){t=m("div"),l=m("span"),i.c(),o=b(),f=m("span"),c.c(),a=b(),_=m("span"),v.c(),u(l,"class","flex pr-2"),u(f,"class","flex pr-2"),u(_,"class","flex pr-2"),u(t,"class","my-1 flex")},m(E,B){P(E,t,B),s(t,l),g[n].m(l,null),s(t,o),s(t,f),I[r].m(f,null),s(t,a),s(t,_),O[p].m(_,null),d=!0},p(E,B){let z=n;n=M(E),n===z?g[n].p(E,B):(pt(),ee(g[z],1,1,()=>{g[z]=null}),dt(),i=g[n],i?i.p(E,B):(i=g[n]=h[n](E),i.c()),Q(i,1),i.m(l,null));let W=r;r=q(E),r===W?I[r].p(E,B):(pt(),ee(I[W],1,1,()=>{I[W]=null}),dt(),c=I[r],c?c.p(E,B):(c=I[r]=A[r](E),c.c()),Q(c,1),c.m(f,null));let F=p;p=U(E),p===F?O[p].p(E,B):(pt(),ee(O[F],1,1,()=>{O[F]=null}),dt(),v=O[p],v?v.p(E,B):(v=O[p]=L[p](E),v.c()),Q(v,1),v.m(_,null))},i(E){d||(Q(i),Q(c),Q(v),d=!0)},o(E){ee(i),ee(c),ee(v),d=!1},d(E){E&&T(t),g[n].d(),I[r].d(),O[p].d()}}}function Y4(e){let t,l;return t=new nn({props:{to:"/mqtt-ca",$$slots:{default:[X4]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i[0]&2|i[3]&536870912&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Q4(e){let t,l,n,i,o,f,r;return l=new nn({props:{to:"/mqtt-ca",$$slots:{default:[Z4]},$$scope:{ctx:e}}}),{c(){t=m("span"),Ne(l.$$.fragment),n=b(),i=m("span"),i.textContent="\u{1F5D1}",u(t,"class","bd-on"),u(i,"class","bd-off")},m(c,a){P(c,t,a),Se(l,t,null),P(c,n,a),P(c,i,a),o=!0,f||(r=[re(i,"click",e[13]),re(i,"keypress",e[13])],f=!0)},p(c,a){const _={};a[0]&2|a[3]&536870912&&(_.$$scope={dirty:a,ctx:c}),l.$set(_)},i(c){o||(Q(l.$$.fragment,c),o=!0)},o(c){ee(l.$$.fragment,c),o=!1},d(c){c&&T(t),Ce(l),c&&T(n),c&&T(i),f=!1,Et(r)}}}function X4(e){var n,i,o,f,r,c;let t,l;return t=new di({props:{color:"blue",text:(o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)!=null?o:"Upload CA",title:(c=(r=(f=e[1].conf)==null?void 0:f.mqtt)==null?void 0:r.title_ca)!=null?c:""}}),{c(){Ne(t.$$.fragment)},m(a,_){Se(t,a,_),l=!0},p(a,_){var v,d,h,g,M,A;const p={};_[0]&2&&(p.text=(h=(d=(v=a[1].conf)==null?void 0:v.mqtt)==null?void 0:d.btn_ca_upload)!=null?h:"Upload CA"),_[0]&2&&(p.title=(A=(M=(g=a[1].conf)==null?void 0:g.mqtt)==null?void 0:M.title_ca)!=null?A:""),t.$set(p)},i(a){l||(Q(t.$$.fragment,a),l=!0)},o(a){ee(t.$$.fragment,a),l=!1},d(a){Ce(t,a)}}}function Z4(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)!=null?o:"CA OK")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.mqtt)==null?void 0:a.ca_ok)!=null?_:"CA OK")+"")&&C(l,t)},d(f){f&&T(l)}}}function J4(e){let t,l;return t=new nn({props:{to:"/mqtt-cert",$$slots:{default:[x4]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i[0]&2|i[3]&536870912&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function $4(e){let t,l,n,i,o,f,r;return l=new nn({props:{to:"/mqtt-cert",$$slots:{default:[eg]},$$scope:{ctx:e}}}),{c(){t=m("span"),Ne(l.$$.fragment),n=b(),i=m("span"),i.textContent="\u{1F5D1}",u(t,"class","bd-on"),u(i,"class","bd-off")},m(c,a){P(c,t,a),Se(l,t,null),P(c,n,a),P(c,i,a),o=!0,f||(r=[re(i,"click",e[14]),re(i,"keypress",e[14])],f=!0)},p(c,a){const _={};a[0]&2|a[3]&536870912&&(_.$$scope={dirty:a,ctx:c}),l.$set(_)},i(c){o||(Q(l.$$.fragment,c),o=!0)},o(c){ee(l.$$.fragment,c),o=!1},d(c){c&&T(t),Ce(l),c&&T(n),c&&T(i),f=!1,Et(r)}}}function x4(e){var n,i,o,f,r,c;let t,l;return t=new di({props:{color:"blue",text:(o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)!=null?o:"Upload cert",title:(c=(r=(f=e[1].conf)==null?void 0:f.mqtt)==null?void 0:r.title_crt)!=null?c:""}}),{c(){Ne(t.$$.fragment)},m(a,_){Se(t,a,_),l=!0},p(a,_){var v,d,h,g,M,A;const p={};_[0]&2&&(p.text=(h=(d=(v=a[1].conf)==null?void 0:v.mqtt)==null?void 0:d.btn_crt_upload)!=null?h:"Upload cert"),_[0]&2&&(p.title=(A=(M=(g=a[1].conf)==null?void 0:g.mqtt)==null?void 0:M.title_crt)!=null?A:""),t.$set(p)},i(a){l||(Q(t.$$.fragment,a),l=!0)},o(a){ee(t.$$.fragment,a),l=!1},d(a){Ce(t,a)}}}function eg(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)!=null?o:"Cert OK")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.mqtt)==null?void 0:a.crt_ok)!=null?_:"Cert OK")+"")&&C(l,t)},d(f){f&&T(l)}}}function tg(e){let t,l;return t=new nn({props:{to:"/mqtt-key",$$slots:{default:[ng]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i[0]&2|i[3]&536870912&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function lg(e){let t,l,n,i,o,f,r;return l=new nn({props:{to:"/mqtt-key",$$slots:{default:[ig]},$$scope:{ctx:e}}}),{c(){t=m("span"),Ne(l.$$.fragment),n=b(),i=m("span"),i.textContent="\u{1F5D1}",u(t,"class","bd-on"),u(i,"class","bd-off")},m(c,a){P(c,t,a),Se(l,t,null),P(c,n,a),P(c,i,a),o=!0,f||(r=[re(i,"click",e[15]),re(i,"keypress",e[15])],f=!0)},p(c,a){const _={};a[0]&2|a[3]&536870912&&(_.$$scope={dirty:a,ctx:c}),l.$set(_)},i(c){o||(Q(l.$$.fragment,c),o=!0)},o(c){ee(l.$$.fragment,c),o=!1},d(c){c&&T(t),Ce(l),c&&T(n),c&&T(i),f=!1,Et(r)}}}function ng(e){var n,i,o,f,r,c;let t,l;return t=new di({props:{color:"blue",text:(o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)!=null?o:"Upload key",title:(c=(r=(f=e[1].conf)==null?void 0:f.mqtt)==null?void 0:r.title_key)!=null?c:""}}),{c(){Ne(t.$$.fragment)},m(a,_){Se(t,a,_),l=!0},p(a,_){var v,d,h,g,M,A;const p={};_[0]&2&&(p.text=(h=(d=(v=a[1].conf)==null?void 0:v.mqtt)==null?void 0:d.btn_key_upload)!=null?h:"Upload key"),_[0]&2&&(p.title=(A=(M=(g=a[1].conf)==null?void 0:g.mqtt)==null?void 0:M.title_key)!=null?A:""),t.$set(p)},i(a){l||(Q(t.$$.fragment,a),l=!0)},o(a){ee(t.$$.fragment,a),l=!1},d(a){Ce(t,a)}}}function ig(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)!=null?o:"Key OK")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.mqtt)==null?void 0:a.key_ok)!=null?_:"Key OK")+"")&&C(l,t)},d(f){f&&T(l)}}}function P2(e){var oe,ae,se,x,me,pe,V,Z,ge,ve,S,w,N,D,j,te;let t,l,n=((x=(se=(ae=(oe=e[1].conf)==null?void 0:oe.mqtt)==null?void 0:ae.domoticz)==null?void 0:se.title)!=null?x:"Domoticz")+"",i,o,f,r,c,a,_,p,v,d=((Z=(V=(pe=(me=e[1].conf)==null?void 0:me.mqtt)==null?void 0:pe.domoticz)==null?void 0:V.eidx)!=null?Z:"Electricity IDX")+"",h,g,M,A,I,q,L=((w=(S=(ve=(ge=e[1].conf)==null?void 0:ge.mqtt)==null?void 0:ve.domoticz)==null?void 0:S.cidx)!=null?w:"Current IDX")+"",O,U,E,B,z,W,F=((te=(j=(D=(N=e[1].conf)==null?void 0:N.mqtt)==null?void 0:D.domoticz)==null?void 0:j.vidx)!=null?te:"Voltage IDX")+"",R,K,y,H,Y,X,J,$,ce,ie;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),a=m("input"),_=b(),p=m("div"),v=m("div"),h=k(d),g=m("br"),M=b(),A=m("input"),I=b(),q=m("div"),O=k(L),U=m("br"),E=b(),B=m("input"),z=b(),W=m("div"),R=k(F),K=k(`: L1, L2 & L3 + `),y=m("div"),H=m("input"),Y=b(),X=m("input"),J=b(),$=m("input"),u(l,"class","text-sm"),u(f,"href",Wl("MQTT-configuration#domoticz")),u(f,"target","_blank"),u(f,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(A,"name","oe"),u(A,"type","text"),u(A,"class","in-f tr w-full"),u(v,"class","w-1/2"),u(B,"name","oc"),u(B,"type","text"),u(B,"class","in-l tr w-full"),u(q,"class","w-1/2"),u(p,"class","my-1 flex"),u(H,"name","ou1"),u(H,"type","text"),u(H,"class","in-f tr w-1/3"),u(X,"name","ou2"),u(X,"type","text"),u(X,"class","in-m tr w-1/3"),u($,"name","ou3"),u($,"type","text"),u($,"class","in-l tr w-1/3"),u(y,"class","flex"),u(W,"class","my-1"),u(t,"class","cnt")},m(le,fe){P(le,t,fe),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),s(t,a),s(t,_),s(t,p),s(p,v),s(v,h),s(v,g),s(v,M),s(v,A),be(A,e[4].o.e),s(p,I),s(p,q),s(q,O),s(q,U),s(q,E),s(q,B),be(B,e[4].o.c),s(t,z),s(t,W),s(W,R),s(W,K),s(W,y),s(y,H),be(H,e[4].o.u1),s(y,Y),s(y,X),be(X,e[4].o.u2),s(y,J),s(y,$),be($,e[4].o.u3),ce||(ie=[re(A,"input",e[70]),re(B,"input",e[71]),re(H,"input",e[72]),re(X,"input",e[73]),re($,"input",e[74])],ce=!0)},p(le,fe){var de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt;fe[0]&2&&n!==(n=((we=(Pe=(qe=(de=le[1].conf)==null?void 0:de.mqtt)==null?void 0:qe.domoticz)==null?void 0:Pe.title)!=null?we:"Domoticz")+"")&&C(i,n),fe[0]&2&&d!==(d=((De=(ke=(Ae=(Fe=le[1].conf)==null?void 0:Fe.mqtt)==null?void 0:Ae.domoticz)==null?void 0:ke.eidx)!=null?De:"Electricity IDX")+"")&&C(h,d),fe[0]&16&&A.value!==le[4].o.e&&be(A,le[4].o.e),fe[0]&2&&L!==(L=((Ye=(je=(Oe=(He=le[1].conf)==null?void 0:He.mqtt)==null?void 0:Oe.domoticz)==null?void 0:je.cidx)!=null?Ye:"Current IDX")+"")&&C(O,L),fe[0]&16&&B.value!==le[4].o.c&&be(B,le[4].o.c),fe[0]&2&&F!==(F=((tt=(xe=($e=(We=le[1].conf)==null?void 0:We.mqtt)==null?void 0:$e.domoticz)==null?void 0:xe.vidx)!=null?tt:"Voltage IDX")+"")&&C(R,F),fe[0]&16&&H.value!==le[4].o.u1&&be(H,le[4].o.u1),fe[0]&16&&X.value!==le[4].o.u2&&be(X,le[4].o.u2),fe[0]&16&&$.value!==le[4].o.u3&&be($,le[4].o.u3)},d(le){le&&T(t),ce=!1,Et(ie)}}}function E2(e){var J,$,ce,ie,oe,ae,se,x,me,pe,V,Z,ge,ve,S,w;let t,l,n=((ie=(ce=($=(J=e[1].conf)==null?void 0:J.mqtt)==null?void 0:$.ha)==null?void 0:ce.title)!=null?ie:"Home-Assistant")+"",i,o,f,r,c,a,_,p,v=((x=(se=(ae=(oe=e[1].conf)==null?void 0:oe.mqtt)==null?void 0:ae.ha)==null?void 0:se.discovery)!=null?x:"Discovery topic prefix")+"",d,h,g,M,A,I,q=((Z=(V=(pe=(me=e[1].conf)==null?void 0:me.mqtt)==null?void 0:pe.ha)==null?void 0:V.hostname)!=null?Z:"Hostname for URL")+"",L,O,U,E,B,z,W,F=((w=(S=(ve=(ge=e[1].conf)==null?void 0:ge.mqtt)==null?void 0:ve.ha)==null?void 0:S.tag)!=null?w:"Name tag")+"",R,K,y,H,Y,X;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),a=m("input"),_=b(),p=m("div"),d=k(v),h=m("br"),g=b(),M=m("input"),A=b(),I=m("div"),L=k(q),O=m("br"),U=b(),E=m("input"),z=b(),W=m("div"),R=k(F),K=m("br"),y=b(),H=m("input"),u(l,"class","text-sm"),u(f,"href",Wl("MQTT-configuration#home-assistant")),u(f,"target","_blank"),u(f,"class","float-right"),u(a,"type","hidden"),u(a,"name","h"),a.value="true",u(M,"name","ht"),u(M,"type","text"),u(M,"class","in-s"),u(M,"placeholder","homeassistant"),u(p,"class","my-1"),u(E,"name","hh"),u(E,"type","text"),u(E,"class","in-s"),u(E,"placeholder",B=e[4].g.h+".local"),u(I,"class","my-1"),u(H,"name","hn"),u(H,"type","text"),u(H,"class","in-s"),u(W,"class","my-1"),u(t,"class","cnt")},m(N,D){P(N,t,D),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),s(t,a),s(t,_),s(t,p),s(p,d),s(p,h),s(p,g),s(p,M),be(M,e[4].h.t),s(t,A),s(t,I),s(I,L),s(I,O),s(I,U),s(I,E),be(E,e[4].h.h),s(t,z),s(t,W),s(W,R),s(W,K),s(W,y),s(W,H),be(H,e[4].h.n),Y||(X=[re(M,"input",e[75]),re(E,"input",e[76]),re(H,"input",e[77])],Y=!0)},p(N,D){var j,te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye;D[0]&2&&n!==(n=((fe=(le=(te=(j=N[1].conf)==null?void 0:j.mqtt)==null?void 0:te.ha)==null?void 0:le.title)!=null?fe:"Home-Assistant")+"")&&C(i,n),D[0]&2&&v!==(v=((we=(Pe=(qe=(de=N[1].conf)==null?void 0:de.mqtt)==null?void 0:qe.ha)==null?void 0:Pe.discovery)!=null?we:"Discovery topic prefix")+"")&&C(d,v),D[0]&16&&M.value!==N[4].h.t&&be(M,N[4].h.t),D[0]&2&&q!==(q=((De=(ke=(Ae=(Fe=N[1].conf)==null?void 0:Fe.mqtt)==null?void 0:Ae.ha)==null?void 0:ke.hostname)!=null?De:"Hostname for URL")+"")&&C(L,q),D[0]&16&&B!==(B=N[4].g.h+".local")&&u(E,"placeholder",B),D[0]&16&&E.value!==N[4].h.h&&be(E,N[4].h.h),D[0]&2&&F!==(F=((Ye=(je=(Oe=(He=N[1].conf)==null?void 0:He.mqtt)==null?void 0:Oe.ha)==null?void 0:je.tag)!=null?Ye:"Name tag")+"")&&C(R,F),D[0]&16&&H.value!==N[4].h.n&&be(H,N[4].h.n)},d(N){N&&T(t),Y=!1,Et(X)}}}function A2(e){var K,y,H,Y,X,J,$,ce,ie;let t,l,n=((H=(y=(K=e[1].conf)==null?void 0:K.cloud)==null?void 0:y.title)!=null?H:"Cloud connections")+"",i,o,f,r,c,a,_,p,v,d,h,g=((J=(X=(Y=e[1].conf)==null?void 0:Y.cloud)==null?void 0:X.ams)!=null?J:"AMS reader cloud")+"",M,A,I,q,L,O,U=((ie=(ce=($=e[1].conf)==null?void 0:$.cloud)==null?void 0:ce.es)!=null?ie:"Energy Speedometer")+"",E,B,z,W,F,R=e[4].c.es&&D2(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),a=m("input"),_=b(),p=m("div"),v=m("label"),d=m("input"),h=b(),M=k(g),A=b(),I=m("div"),q=m("label"),L=m("input"),O=b(),E=k(U),B=b(),R&&R.c(),u(l,"class","text-sm"),u(f,"href",Wl("Cloud")),u(f,"target","_blank"),u(f,"class","float-right"),u(a,"type","hidden"),u(a,"name","c"),a.value="true",u(d,"type","checkbox"),u(d,"name","ce"),d.__value="true",d.value=d.__value,u(d,"class","rounded mb-1"),u(p,"class","my-1"),u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(L,"name","ces"),L.__value="true",L.value=L.__value,u(I,"class","my-1"),u(t,"class","cnt")},m(oe,ae){P(oe,t,ae),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),s(t,a),s(t,_),s(t,p),s(p,v),s(v,d),d.checked=e[4].c.e,s(v,h),s(v,M),s(t,A),s(t,I),s(I,q),s(q,L),L.checked=e[4].c.es,s(q,O),s(q,E),s(I,B),R&&R.m(I,null),z=!0,W||(F=[re(d,"change",e[78]),re(L,"change",e[79])],W=!0)},p(oe,ae){var se,x,me,pe,V,Z,ge,ve,S;(!z||ae[0]&2)&&n!==(n=((me=(x=(se=oe[1].conf)==null?void 0:se.cloud)==null?void 0:x.title)!=null?me:"Cloud connections")+"")&&C(i,n),ae[0]&16&&(d.checked=oe[4].c.e),(!z||ae[0]&2)&&g!==(g=((Z=(V=(pe=oe[1].conf)==null?void 0:pe.cloud)==null?void 0:V.ams)!=null?Z:"AMS reader cloud")+"")&&C(M,g),ae[0]&16&&(L.checked=oe[4].c.es),(!z||ae[0]&2)&&U!==(U=((S=(ve=(ge=oe[1].conf)==null?void 0:ge.cloud)==null?void 0:ve.es)!=null?S:"Energy Speedometer")+"")&&C(E,U),oe[4].c.es?R?(R.p(oe,ae),ae[0]&16&&Q(R,1)):(R=D2(oe),R.c(),Q(R,1),R.m(I,null)):R&&(pt(),ee(R,1,1,()=>{R=null}),dt())},i(oe){z||(Q(R),z=!0)},o(oe){ee(R),z=!1},d(oe){oe&&T(t),R&&R.d(),W=!1,Et(F)}}}function D2(e){let t,l,n=e[0].mac+"",i,o,f,r,c=(e[0].meter.id?e[0].meter.id:"missing, required")+"",a,_,p,v,d=e[0].mac&&e[0].meter.id&&q2(e);return{c(){t=m("div"),l=k("MAC: "),i=k(n),o=b(),f=m("div"),r=k("Meter ID: "),a=k(c),_=b(),d&&d.c(),p=Ut(),u(t,"class","pl-5"),u(f,"class","pl-5")},m(h,g){P(h,t,g),s(t,l),s(t,i),P(h,o,g),P(h,f,g),s(f,r),s(f,a),P(h,_,g),d&&d.m(h,g),P(h,p,g),v=!0},p(h,g){(!v||g[0]&1)&&n!==(n=h[0].mac+"")&&C(i,n),(!v||g[0]&1)&&c!==(c=(h[0].meter.id?h[0].meter.id:"missing, required")+"")&&C(a,c),h[0].mac&&h[0].meter.id?d?(d.p(h,g),g[0]&1&&Q(d,1)):(d=q2(h),d.c(),Q(d,1),d.m(p.parentNode,p)):d&&(pt(),ee(d,1,1,()=>{d=null}),dt())},i(h){v||(Q(d),v=!0)},o(h){ee(d),v=!1},d(h){h&&T(t),h&&T(o),h&&T(f),h&&T(_),d&&d.d(h),h&&T(p)}}}function q2(e){let t,l,n;return l=new j4({props:{value:'{"mac":"'+e[0].mac+'","meter":"'+e[0].meter.id+'"}'}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","pl-2")},m(i,o){P(i,t,o),Se(l,t,null),n=!0},p(i,o){const f={};o[0]&1&&(f.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(f)},i(i){n||(Q(l.$$.fragment,i),n=!0)},o(i){ee(l.$$.fragment,i),n=!1},d(i){i&&T(t),Ce(l)}}}function O2(e){var F,R,K,y,H,Y,X,J;let t,l,n=((K=(R=(F=e[1].conf)==null?void 0:F.thresholds)==null?void 0:R.title)!=null?K:"Thresholds")+"",i,o,f,r,c,a,_,p,v,d,h,g=((Y=(H=(y=e[1].conf)==null?void 0:y.thresholds)==null?void 0:H.avg)!=null?Y:"Average of")+"",M,A,I,q,L,O=((J=(X=e[1].common)==null?void 0:X.hours)!=null?J:"hours")+"",U,E,B,z={length:9},W=[];for(let $=0;$20&&B2(e),d=e[4].i.d.d>0&&H2(e),h=e[0].chip=="esp8266"&&y2(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),v&&v.c(),a=b(),d&&d.c(),_=b(),h&&h.c(),u(l,"class","text-sm"),u(f,"href",Wl("GPIO-configuration")),u(f,"target","_blank"),u(f,"class","float-right"),u(t,"class","cnt")},m(I,q){P(I,t,q),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),v&&v.m(t,null),s(t,a),d&&d.m(t,null),s(t,_),h&&h.m(t,null),p=!0},p(I,q){var L,O,U;(!p||q[0]&2)&&n!==(n=((U=(O=(L=I[1].conf)==null?void 0:L.hw)==null?void 0:O.title)!=null?U:"Hardware")+"")&&C(i,n),I[0].board>20?v?(v.p(I,q),q[0]&1&&Q(v,1)):(v=B2(I),v.c(),Q(v,1),v.m(t,a)):v&&(pt(),ee(v,1,1,()=>{v=null}),dt()),I[4].i.d.d>0?d?d.p(I,q):(d=H2(I),d.c(),d.m(t,_)):d&&(d.d(1),d=null),I[0].chip=="esp8266"?h?h.p(I,q):(h=y2(I),h.c(),h.m(t,null)):h&&(h.d(1),h=null)},i(I){p||(Q(v),p=!0)},o(I){ee(v),p=!1},d(I){I&&T(t),v&&v.d(),d&&d.d(),h&&h.d()}}}function B2(e){var jt,Lt,Ht,yt,Me,Ve,Rt,Gt,zt,Dt,Kt,Zt,tl,Jt,ft,Mt,Ke,ne,Ue,Le,St,ut,Yt,ll,fl,ul,Sl,rl,Cl,nl,_l,dl,Nl,Tl,Qt,Ee,qt,Pn,Jl,dn,En;let t,l,n,i,o=((yt=(Ht=(Lt=(jt=e[1].conf)==null?void 0:jt.hw)==null?void 0:Lt.han)==null?void 0:Ht.rx)!=null?yt:"HAN RX")+"",f,r,c,a,_,p,v,d=((Gt=(Rt=(Ve=(Me=e[1].conf)==null?void 0:Me.hw)==null?void 0:Ve.han)==null?void 0:Rt.tx)!=null?Gt:"HAN TX")+"",h,g,M,A,I,q,L,O,U,E,B=((Zt=(Kt=(Dt=(zt=e[1].conf)==null?void 0:zt.hw)==null?void 0:Dt.han)==null?void 0:Kt.pullup)!=null?Zt:"pullup")+"",z,W,F,R,K=((ft=(Jt=(tl=e[1].conf)==null?void 0:tl.hw)==null?void 0:Jt.ap_btn)!=null?ft:"AP button")+"",y,H,Y,X,J,$,ce=((Ue=(ne=(Ke=(Mt=e[1].conf)==null?void 0:Mt.hw)==null?void 0:Ke.led)==null?void 0:ne.title)!=null?Ue:"LED")+"",ie,oe,ae,se,x,me,pe,V,Z,ge,ve=((Yt=(ut=(St=(Le=e[1].conf)==null?void 0:Le.hw)==null?void 0:St.led)==null?void 0:ut.inverted)!=null?Yt:"inverted")+"",S,w,N,D=((Sl=(ul=(fl=(ll=e[1].conf)==null?void 0:ll.hw)==null?void 0:fl.led)==null?void 0:ul.rgb)!=null?Sl:"RGB")+"",j,te,le,fe,de=((_l=(nl=(Cl=(rl=e[1].conf)==null?void 0:rl.hw)==null?void 0:Cl.led)==null?void 0:nl.inverted)!=null?_l:"inverted")+"",qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e=((Qt=(Tl=(Nl=(dl=e[1].conf)==null?void 0:dl.hw)==null?void 0:Nl.led)==null?void 0:Tl.disable)!=null?Qt:"LED dis. GPIO")+"",xe,tt,Te,ue,Ie,kt=((Pn=(qt=(Ee=e[1].conf)==null?void 0:Ee.hw)==null?void 0:qt.temp)!=null?Pn:"Temperature")+"",lt,wt,st,ot,et,Nt,gt=((En=(dn=(Jl=e[1].conf)==null?void 0:Jl.hw)==null?void 0:dn.temp_analog)!=null?En:"Analog temp")+"",At,Pt,Be,ye,It,vt,nt,Tt,it;_=new af({props:{chip:e[0].chip}}),I=new af({props:{chip:e[0].chip}});let at=e[0].chip!="esp8266"&&U2(e),rt=e[4].i.v.p>0&&j2(e);return{c(){t=m("input"),l=b(),n=m("div"),i=m("div"),f=k(o),r=m("br"),c=b(),a=m("select"),Ne(_.$$.fragment),p=b(),v=m("div"),h=k(d),g=m("br"),M=b(),A=m("select"),Ne(I.$$.fragment),q=b(),L=m("div"),O=m("label"),U=m("input"),E=b(),z=k(B),W=b(),F=m("div"),R=m("div"),y=k(K),H=m("br"),Y=b(),X=m("input"),J=b(),$=m("div"),ie=k(ce),oe=m("br"),ae=b(),se=m("div"),x=m("input"),me=b(),pe=m("div"),V=m("label"),Z=m("input"),ge=b(),S=k(ve),w=b(),N=m("div"),j=k(D),te=m("label"),le=m("input"),fe=b(),qe=k(de),Pe=m("br"),we=b(),Fe=m("div"),Ae=m("input"),ke=b(),De=m("input"),He=b(),Oe=m("input"),je=b(),Ye=m("div"),We=m("div"),xe=k($e),tt=b(),Te=m("input"),ue=b(),Ie=m("div"),lt=k(kt),wt=m("br"),st=b(),ot=m("input"),et=b(),Nt=m("div"),At=k(gt),Pt=m("br"),Be=b(),ye=m("input"),It=b(),at&&at.c(),vt=b(),rt&&rt.c(),u(t,"type","hidden"),u(t,"name","i"),t.value="true",u(a,"name","ihp"),u(a,"class","in-f w-full"),e[4].i.h.p===void 0&&Ct(()=>e[84].call(a)),u(i,"class","w-1/3"),u(A,"name","iht"),u(A,"class","in-l w-full"),e[4].i.h.t===void 0&&Ct(()=>e[85].call(A)),u(v,"class","w-1/3"),u(U,"name","ihu"),U.__value="true",U.value=U.__value,u(U,"type","checkbox"),u(U,"class","rounded mb-1"),u(O,"class","ml-2"),u(L,"class","w-1/3"),u(n,"class","flex flex-wrap"),u(X,"name","ia"),u(X,"type","number"),u(X,"min","0"),u(X,"max",e[8]),u(X,"class","in-f tr w-full"),u(R,"class","w-1/3"),u(x,"name","ilp"),u(x,"type","number"),u(x,"min","0"),u(x,"max",e[8]),u(x,"class","in-l tr w-full"),u(se,"class","flex"),u($,"class","w-1/3"),u(Z,"name","ili"),Z.__value="true",Z.value=Z.__value,u(Z,"type","checkbox"),u(Z,"class","rounded mb-1"),u(V,"class","ml-4"),u(pe,"class","w-1/3"),u(le,"name","iri"),le.__value="true",le.value=le.__value,u(le,"type","checkbox"),u(le,"class","rounded mb-1"),u(te,"class","ml-4"),u(Ae,"name","irr"),u(Ae,"type","number"),u(Ae,"min","0"),u(Ae,"max",e[8]),u(Ae,"class","in-f tr w-1/3"),u(De,"name","irg"),u(De,"type","number"),u(De,"min","0"),u(De,"max",e[8]),u(De,"class","in-m tr w-1/3"),u(Oe,"name","irb"),u(Oe,"type","number"),u(Oe,"min","0"),u(Oe,"max",e[8]),u(Oe,"class","in-l tr w-1/3"),u(Fe,"class","flex"),u(N,"class","w-full"),u(Te,"name","idd"),u(Te,"type","number"),u(Te,"min","0"),u(Te,"max",e[8]),u(Te,"class","in-s tr"),u(We,"class","my-1 pr-1 w-1/3"),u(Ye,"class","w-full"),u(ot,"name","itd"),u(ot,"type","number"),u(ot,"min","0"),u(ot,"max",e[8]),u(ot,"class","in-f tr w-full"),u(Ie,"class","my-1 w-1/3"),u(ye,"name","ita"),u(ye,"type","number"),u(ye,"min","0"),u(ye,"max",e[8]),u(ye,"class","in-l tr w-full"),u(Nt,"class","my-1 pr-1 w-1/3"),u(F,"class","flex flex-wrap")},m(Re,he){P(Re,t,he),P(Re,l,he),P(Re,n,he),s(n,i),s(i,f),s(i,r),s(i,c),s(i,a),Se(_,a,null),Je(a,e[4].i.h.p,!0),s(n,p),s(n,v),s(v,h),s(v,g),s(v,M),s(v,A),Se(I,A,null),Je(A,e[4].i.h.t,!0),s(n,q),s(n,L),s(L,O),s(O,U),U.checked=e[4].i.h.u,s(O,E),s(O,z),P(Re,W,he),P(Re,F,he),s(F,R),s(R,y),s(R,H),s(R,Y),s(R,X),be(X,e[4].i.a),s(F,J),s(F,$),s($,ie),s($,oe),s($,ae),s($,se),s(se,x),be(x,e[4].i.l.p),s(F,me),s(F,pe),s(pe,V),s(V,Z),Z.checked=e[4].i.l.i,s(V,ge),s(V,S),s(F,w),s(F,N),s(N,j),s(N,te),s(te,le),le.checked=e[4].i.r.i,s(te,fe),s(te,qe),s(N,Pe),s(N,we),s(N,Fe),s(Fe,Ae),be(Ae,e[4].i.r.r),s(Fe,ke),s(Fe,De),be(De,e[4].i.r.g),s(Fe,He),s(Fe,Oe),be(Oe,e[4].i.r.b),s(F,je),s(F,Ye),s(Ye,We),s(We,xe),s(We,tt),s(We,Te),be(Te,e[4].i.d.d),s(F,ue),s(F,Ie),s(Ie,lt),s(Ie,wt),s(Ie,st),s(Ie,ot),be(ot,e[4].i.t.d),s(F,et),s(F,Nt),s(Nt,At),s(Nt,Pt),s(Nt,Be),s(Nt,ye),be(ye,e[4].i.t.a),s(F,It),at&&at.m(F,null),s(F,vt),rt&&rt.m(F,null),nt=!0,Tt||(it=[re(a,"change",e[84]),re(A,"change",e[85]),re(U,"change",e[86]),re(X,"input",e[87]),re(x,"input",e[88]),re(Z,"change",e[89]),re(le,"change",e[90]),re(Ae,"input",e[91]),re(De,"input",e[92]),re(Oe,"input",e[93]),re(Te,"input",e[94]),re(ot,"input",e[95]),re(ye,"input",e[96])],Tt=!0)},p(Re,he){var An,Hn,yn,ml,$l,xl,zn,en,Gl,hn,Dn,Wn,Gn,tn,cl,Vn,bn,Kn,Vl,ei,ki,fs,us,qn,Pl,rs,ti,cs,wi,_s,gn,Yn,El,ms,li,Mi,ps,ds,Si,Qn,Al;(!nt||he[0]&2)&&o!==(o=((ml=(yn=(Hn=(An=Re[1].conf)==null?void 0:An.hw)==null?void 0:Hn.han)==null?void 0:yn.rx)!=null?ml:"HAN RX")+"")&&C(f,o);const Qe={};he[0]&1&&(Qe.chip=Re[0].chip),_.$set(Qe),he[0]&16&&Je(a,Re[4].i.h.p),(!nt||he[0]&2)&&d!==(d=((en=(zn=(xl=($l=Re[1].conf)==null?void 0:$l.hw)==null?void 0:xl.han)==null?void 0:zn.tx)!=null?en:"HAN TX")+"")&&C(h,d);const vn={};he[0]&1&&(vn.chip=Re[0].chip),I.$set(vn),he[0]&16&&Je(A,Re[4].i.h.t),he[0]&16&&(U.checked=Re[4].i.h.u),(!nt||he[0]&2)&&B!==(B=((Wn=(Dn=(hn=(Gl=Re[1].conf)==null?void 0:Gl.hw)==null?void 0:hn.han)==null?void 0:Dn.pullup)!=null?Wn:"pullup")+"")&&C(z,B),(!nt||he[0]&2)&&K!==(K=((cl=(tn=(Gn=Re[1].conf)==null?void 0:Gn.hw)==null?void 0:tn.ap_btn)!=null?cl:"AP button")+"")&&C(y,K),(!nt||he[0]&256)&&u(X,"max",Re[8]),he[0]&16&&Ze(X.value)!==Re[4].i.a&&be(X,Re[4].i.a),(!nt||he[0]&2)&&ce!==(ce=((Vl=(Kn=(bn=(Vn=Re[1].conf)==null?void 0:Vn.hw)==null?void 0:bn.led)==null?void 0:Kn.title)!=null?Vl:"LED")+"")&&C(ie,ce),(!nt||he[0]&256)&&u(x,"max",Re[8]),he[0]&16&&Ze(x.value)!==Re[4].i.l.p&&be(x,Re[4].i.l.p),he[0]&16&&(Z.checked=Re[4].i.l.i),(!nt||he[0]&2)&&ve!==(ve=((us=(fs=(ki=(ei=Re[1].conf)==null?void 0:ei.hw)==null?void 0:ki.led)==null?void 0:fs.inverted)!=null?us:"inverted")+"")&&C(S,ve),(!nt||he[0]&2)&&D!==(D=((ti=(rs=(Pl=(qn=Re[1].conf)==null?void 0:qn.hw)==null?void 0:Pl.led)==null?void 0:rs.rgb)!=null?ti:"RGB")+"")&&C(j,D),he[0]&16&&(le.checked=Re[4].i.r.i),(!nt||he[0]&2)&&de!==(de=((gn=(_s=(wi=(cs=Re[1].conf)==null?void 0:cs.hw)==null?void 0:wi.led)==null?void 0:_s.inverted)!=null?gn:"inverted")+"")&&C(qe,de),(!nt||he[0]&256)&&u(Ae,"max",Re[8]),he[0]&16&&Ze(Ae.value)!==Re[4].i.r.r&&be(Ae,Re[4].i.r.r),(!nt||he[0]&256)&&u(De,"max",Re[8]),he[0]&16&&Ze(De.value)!==Re[4].i.r.g&&be(De,Re[4].i.r.g),(!nt||he[0]&256)&&u(Oe,"max",Re[8]),he[0]&16&&Ze(Oe.value)!==Re[4].i.r.b&&be(Oe,Re[4].i.r.b),(!nt||he[0]&2)&&$e!==($e=((li=(ms=(El=(Yn=Re[1].conf)==null?void 0:Yn.hw)==null?void 0:El.led)==null?void 0:ms.disable)!=null?li:"LED dis. GPIO")+"")&&C(xe,$e),(!nt||he[0]&256)&&u(Te,"max",Re[8]),he[0]&16&&Ze(Te.value)!==Re[4].i.d.d&&be(Te,Re[4].i.d.d),(!nt||he[0]&2)&&kt!==(kt=((ds=(ps=(Mi=Re[1].conf)==null?void 0:Mi.hw)==null?void 0:ps.temp)!=null?ds:"Temperature")+"")&&C(lt,kt),(!nt||he[0]&256)&&u(ot,"max",Re[8]),he[0]&16&&Ze(ot.value)!==Re[4].i.t.d&&be(ot,Re[4].i.t.d),(!nt||he[0]&2)&>!==(gt=((Al=(Qn=(Si=Re[1].conf)==null?void 0:Si.hw)==null?void 0:Qn.temp_analog)!=null?Al:"Analog temp")+"")&&C(At,gt),(!nt||he[0]&256)&&u(ye,"max",Re[8]),he[0]&16&&Ze(ye.value)!==Re[4].i.t.a&&be(ye,Re[4].i.t.a),Re[0].chip!="esp8266"?at?at.p(Re,he):(at=U2(Re),at.c(),at.m(F,vt)):at&&(at.d(1),at=null),Re[4].i.v.p>0?rt?rt.p(Re,he):(rt=j2(Re),rt.c(),rt.m(F,null)):rt&&(rt.d(1),rt=null)},i(Re){nt||(Q(_.$$.fragment,Re),Q(I.$$.fragment,Re),nt=!0)},o(Re){ee(_.$$.fragment,Re),ee(I.$$.fragment,Re),nt=!1},d(Re){Re&&T(t),Re&&T(l),Re&&T(n),Ce(_),Ce(I),Re&&T(W),Re&&T(F),at&&at.d(),rt&&rt.d(),Tt=!1,Et(it)}}}function U2(e){var a,_,p,v;let t,l=((v=(p=(_=(a=e[1].conf)==null?void 0:a.hw)==null?void 0:_.vcc)==null?void 0:p.title)!=null?v:"Vcc")+"",n,i,o,f,r,c;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),u(f,"name","ivp"),u(f,"type","number"),u(f,"min","0"),u(f,"max",e[8]),u(f,"class","in-s tr w-full"),u(t,"class","my-1 pl-1 w-1/3")},m(d,h){P(d,t,h),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].i.v.p),r||(c=re(f,"input",e[97]),r=!0)},p(d,h){var g,M,A,I;h[0]&2&&l!==(l=((I=(A=(M=(g=d[1].conf)==null?void 0:g.hw)==null?void 0:M.vcc)==null?void 0:A.title)!=null?I:"Vcc")+"")&&C(n,l),h[0]&256&&u(f,"max",d[8]),h[0]&16&&Ze(f.value)!==d[4].i.v.p&&be(f,d[4].i.v.p)},d(d){d&&T(t),r=!1,c()}}}function j2(e){var h,g,M,A;let t,l=((A=(M=(g=(h=e[1].conf)==null?void 0:h.hw)==null?void 0:g.vcc)==null?void 0:M.divider)!=null?A:"Voltage divider")+"",n,i,o,f,r,c,a,_,p,v,d;return{c(){var I,q,L,O,U,E,B,z;t=m("div"),n=k(l),i=m("br"),o=b(),f=m("div"),r=m("input"),a=b(),_=m("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder",c=(O=(L=(q=(I=e[1].conf)==null?void 0:I.hw)==null?void 0:q.vcc)==null?void 0:L.div_vcc)!=null?O:"VCC"),u(_,"name","ivdg"),u(_,"type","number"),u(_,"min","0"),u(_,"max","65535"),u(_,"class","in-l tr w-full"),u(_,"placeholder",p=(z=(B=(E=(U=e[1].conf)==null?void 0:U.hw)==null?void 0:E.vcc)==null?void 0:B.div_gnd)!=null?z:"GND"),u(f,"class","flex"),u(t,"class","my-1")},m(I,q){P(I,t,q),s(t,n),s(t,i),s(t,o),s(t,f),s(f,r),be(r,e[4].i.v.d.v),s(f,a),s(f,_),be(_,e[4].i.v.d.g),v||(d=[re(r,"input",e[98]),re(_,"input",e[99])],v=!0)},p(I,q){var L,O,U,E,B,z,W,F,R,K,y,H;q[0]&2&&l!==(l=((E=(U=(O=(L=I[1].conf)==null?void 0:L.hw)==null?void 0:O.vcc)==null?void 0:U.divider)!=null?E:"Voltage divider")+"")&&C(n,l),q[0]&2&&c!==(c=(F=(W=(z=(B=I[1].conf)==null?void 0:B.hw)==null?void 0:z.vcc)==null?void 0:W.div_vcc)!=null?F:"VCC")&&u(r,"placeholder",c),q[0]&16&&Ze(r.value)!==I[4].i.v.d.v&&be(r,I[4].i.v.d.v),q[0]&2&&p!==(p=(H=(y=(K=(R=I[1].conf)==null?void 0:R.hw)==null?void 0:K.vcc)==null?void 0:y.div_gnd)!=null?H:"GND")&&u(_,"placeholder",p),q[0]&16&&Ze(_.value)!==I[4].i.v.d.g&&be(_,I[4].i.v.d.g)},d(I){I&&T(t),v=!1,Et(d)}}}function H2(e){var h,g,M,A,I,q,L,O,U,E,B,z,W,F,R;let t,l=((I=(A=(M=(g=(h=e[1].conf)==null?void 0:h.hw)==null?void 0:g.led)==null?void 0:M.behaviour)==null?void 0:A.title)!=null?I:"LED behaviour")+"",n,i,o,f,r=((E=(U=(O=(L=(q=e[1].conf)==null?void 0:q.hw)==null?void 0:L.led)==null?void 0:O.behaviour)==null?void 0:U.enabled)!=null?E:"Enabled")+"",c,a,_=((R=(F=(W=(z=(B=e[1].conf)==null?void 0:B.hw)==null?void 0:z.led)==null?void 0:W.behaviour)==null?void 0:F.disabled)!=null?R:"Disabled")+"",p,v,d;return{c(){t=m("div"),n=k(l),i=b(),o=m("select"),f=m("option"),c=k(r),a=m("option"),p=k(_),f.__value=0,f.value=f.__value,a.__value=1,a.value=a.__value,u(o,"name","idb"),u(o,"class","in-s"),e[4].i.d.b===void 0&&Ct(()=>e[100].call(o)),u(t,"class","my-1 w-full")},m(K,y){P(K,t,y),s(t,n),s(t,i),s(t,o),s(o,f),s(f,c),s(o,a),s(a,p),Je(o,e[4].i.d.b,!0),v||(d=re(o,"change",e[100]),v=!0)},p(K,y){var H,Y,X,J,$,ce,ie,oe,ae,se,x,me,pe,V,Z;y[0]&2&&l!==(l=(($=(J=(X=(Y=(H=K[1].conf)==null?void 0:H.hw)==null?void 0:Y.led)==null?void 0:X.behaviour)==null?void 0:J.title)!=null?$:"LED behaviour")+"")&&C(n,l),y[0]&2&&r!==(r=((se=(ae=(oe=(ie=(ce=K[1].conf)==null?void 0:ce.hw)==null?void 0:ie.led)==null?void 0:oe.behaviour)==null?void 0:ae.enabled)!=null?se:"Enabled")+"")&&C(c,r),y[0]&2&&_!==(_=((Z=(V=(pe=(me=(x=K[1].conf)==null?void 0:x.hw)==null?void 0:me.led)==null?void 0:pe.behaviour)==null?void 0:V.disabled)!=null?Z:"Disabled")+"")&&C(p,_),y[0]&16&&Je(o,K[4].i.d.b)},d(K){K&&T(t),v=!1,d()}}}function y2(e){var O,U,E,B,z,W,F,R;let t,l,n,i,o=((B=(E=(U=(O=e[1].conf)==null?void 0:O.hw)==null?void 0:U.vcc)==null?void 0:E.offset)!=null?B:"Vcc offset")+"",f,r,c,a,_,p,v=((R=(F=(W=(z=e[1].conf)==null?void 0:z.hw)==null?void 0:W.vcc)==null?void 0:F.multiplier)!=null?R:"Multiplier")+"",d,h,g,M,A,I,q,L=(e[0].board==2||e[0].board==100)&&z2(e);return{c(){t=m("input"),l=b(),n=m("div"),i=m("div"),f=k(o),r=m("br"),c=b(),a=m("input"),_=b(),p=m("div"),d=k(v),h=m("br"),g=b(),M=m("input"),A=b(),L&&L.c(),u(t,"type","hidden"),u(t,"name","iv"),t.value="true",u(a,"name","ivo"),u(a,"type","number"),u(a,"min","0.0"),u(a,"max","3.5"),u(a,"step","0.01"),u(a,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(M,"name","ivm"),u(M,"type","number"),u(M,"min","0.1"),u(M,"max","10"),u(M,"step","0.01"),u(M,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(K,y){P(K,t,y),P(K,l,y),P(K,n,y),s(n,i),s(i,f),s(i,r),s(i,c),s(i,a),be(a,e[4].i.v.o),s(n,_),s(n,p),s(p,d),s(p,h),s(p,g),s(p,M),be(M,e[4].i.v.m),s(n,A),L&&L.m(n,null),I||(q=[re(a,"input",e[101]),re(M,"input",e[102])],I=!0)},p(K,y){var H,Y,X,J,$,ce,ie,oe;y[0]&2&&o!==(o=((J=(X=(Y=(H=K[1].conf)==null?void 0:H.hw)==null?void 0:Y.vcc)==null?void 0:X.offset)!=null?J:"Vcc offset")+"")&&C(f,o),y[0]&16&&Ze(a.value)!==K[4].i.v.o&&be(a,K[4].i.v.o),y[0]&2&&v!==(v=((oe=(ie=(ce=($=K[1].conf)==null?void 0:$.hw)==null?void 0:ce.vcc)==null?void 0:ie.multiplier)!=null?oe:"Multiplier")+"")&&C(d,v),y[0]&16&&Ze(M.value)!==K[4].i.v.m&&be(M,K[4].i.v.m),K[0].board==2||K[0].board==100?L?L.p(K,y):(L=z2(K),L.c(),L.m(n,null)):L&&(L.d(1),L=null)},d(K){K&&T(t),K&&T(l),K&&T(n),L&&L.d(),I=!1,Et(q)}}}function z2(e){var a,_,p,v;let t,l=((v=(p=(_=(a=e[1].conf)==null?void 0:a.hw)==null?void 0:_.vcc)==null?void 0:p.boot)!=null?v:"Boot limit")+"",n,i,o,f,r,c;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),u(f,"name","ivb"),u(f,"type","number"),u(f,"min","2.5"),u(f,"max","3.5"),u(f,"step","0.1"),u(f,"class","in-s tr w-full"),u(t,"class","w-1/3 pl-1")},m(d,h){P(d,t,h),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].i.v.b),r||(c=re(f,"input",e[103]),r=!0)},p(d,h){var g,M,A,I;h[0]&2&&l!==(l=((I=(A=(M=(g=d[1].conf)==null?void 0:g.hw)==null?void 0:M.vcc)==null?void 0:A.boot)!=null?I:"Boot limit")+"")&&C(n,l),h[0]&16&&Ze(f.value)!==d[4].i.v.b&&be(f,d[4].i.v.b)},d(d){d&&T(t),r=!1,c()}}}function W2(e){var U,E,B,z,W,F;let t,l=((B=(E=(U=e[1].conf)==null?void 0:U.debug)==null?void 0:E.danger)!=null?B:"Disable when done")+"",n,i,o,f,r,c,a=((F=(W=(z=e[1].conf)==null?void 0:z.debug)==null?void 0:W.telnet)!=null?F:"Enable telnet")+"",_,p,v,d,h,g,M,A,I,q,L,O=e[4].d.t&&G2(e);return{c(){t=m("div"),n=k(l),i=b(),o=m("div"),f=m("label"),r=m("input"),c=b(),_=k(a),p=b(),O&&O.c(),v=b(),d=m("div"),h=m("select"),g=m("option"),g.textContent="Verbose",M=m("option"),M.textContent="Debug",A=m("option"),A.textContent="Info",I=m("option"),I.textContent="Warning",u(t,"class","bd-red"),u(r,"type","checkbox"),u(r,"name","dt"),r.__value="true",r.value=r.__value,u(r,"class","rounded mb-1"),u(o,"class","my-1"),g.__value=1,g.value=g.__value,M.__value=2,M.value=M.__value,A.__value=3,A.value=A.__value,I.__value=4,I.value=I.__value,u(h,"name","dl"),u(h,"class","in-s"),e[4].d.l===void 0&&Ct(()=>e[106].call(h)),u(d,"class","my-1")},m(R,K){P(R,t,K),s(t,n),P(R,i,K),P(R,o,K),s(o,f),s(f,r),r.checked=e[4].d.t,s(f,c),s(f,_),P(R,p,K),O&&O.m(R,K),P(R,v,K),P(R,d,K),s(d,h),s(h,g),s(h,M),s(h,A),s(h,I),Je(h,e[4].d.l,!0),q||(L=[re(r,"change",e[105]),re(h,"change",e[106])],q=!0)},p(R,K){var y,H,Y,X,J,$;K[0]&2&&l!==(l=((Y=(H=(y=R[1].conf)==null?void 0:y.debug)==null?void 0:H.danger)!=null?Y:"Disable when done")+"")&&C(n,l),K[0]&16&&(r.checked=R[4].d.t),K[0]&2&&a!==(a=(($=(J=(X=R[1].conf)==null?void 0:X.debug)==null?void 0:J.telnet)!=null?$:"Enable telnet")+"")&&C(_,a),R[4].d.t?O?O.p(R,K):(O=G2(R),O.c(),O.m(v.parentNode,v)):O&&(O.d(1),O=null),K[0]&16&&Je(h,R[4].d.l)},d(R){R&&T(t),R&&T(i),R&&T(o),R&&T(p),O&&O.d(R),R&&T(v),R&&T(d),q=!1,Et(L)}}}function G2(e){var i,o,f;let t,l=((f=(o=(i=e[1].conf)==null?void 0:i.debug)==null?void 0:o.telnet_danger)!=null?f:"Disable when done")+"",n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c[0]&2&&l!==(l=((p=(_=(a=r[1].conf)==null?void 0:a.debug)==null?void 0:_.telnet_danger)!=null?p:"Disable when done")+"")&&C(n,l)},d(r){r&&T(t)}}}function sg(e){var Hu,yu,zu,Wu,Gu,Vu,Ku,Yu,Qu,Xu,Zu,Ju,$u,xu,er,tr,lr,nr,ir,sr,or,ar,fr,ur,rr,cr,_r,mr,pr,dr,vr,hr,br,gr,kr,wr,Mr,Sr,Cr,Nr,Tr,Pr,Er,Ar,Dr,qr,Or,Ir,Lr,Rr,Fr,Br,Ur,jr,Hr,yr,zr,Wr,Gr,Vr,Kr,Yr,Qr,Xr,Zr,Jr,$r,xr,e1,t1,l1,n1,i1,s1,o1,a1,f1,u1,r1,c1,_1,m1,p1,d1,v1,h1,b1,g1,k1,w1,M1,S1,C1,N1,T1,P1,E1,A1,D1,q1,O1,I1,L1,R1,F1,B1,U1,j1,H1,y1,z1,W1,G1,V1,K1,Y1,Q1,X1,Z1,J1,$1,x1,e0,t0,l0,n0,i0,s0,o0,a0,f0,u0,r0,c0,_0,m0,p0,d0,v0,h0,b0,g0,k0,w0,M0,S0,C0,N0,T0,P0,E0,A0,D0,q0,O0,I0;let t,l,n,i,o=((zu=(yu=(Hu=e[1].conf)==null?void 0:Hu.general)==null?void 0:yu.title)!=null?zu:"General")+"",f,r,c,a,_,p,v,d,h,g,M=((Vu=(Gu=(Wu=e[1].conf)==null?void 0:Wu.general)==null?void 0:Gu.hostname)!=null?Vu:"Hostname")+"",A,I,q,L,O,U,E=((Qu=(Yu=(Ku=e[1].conf)==null?void 0:Ku.general)==null?void 0:Yu.timezone)!=null?Qu:"Time zone")+"",B,z,W,F,R,K,y,H,Y,X,J,$=((Ju=(Zu=(Xu=e[1].conf)==null?void 0:Xu.price)==null?void 0:Zu.region)!=null?Ju:"Price region")+"",ce,ie,oe,ae,se,x,me,pe,V,Z,ge,ve,S,w,N,D,j,te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e=((er=(xu=($u=e[1].conf)==null?void 0:$u.price)==null?void 0:xu.currency)!=null?er:"Currency")+"",xe,tt,Te,ue,Ie,kt,lt,wt,st,ot,et,Nt,gt=((nr=(lr=(tr=e[1].conf)==null?void 0:tr.price)==null?void 0:lr.enabled)!=null?nr:"Enabled")+"",At,Pt,Be,ye,It=((ar=(or=(sr=(ir=e[1].conf)==null?void 0:ir.general)==null?void 0:sr.security)==null?void 0:or.title)!=null?ar:"Security")+"",vt,nt,Tt,it,at,rt=((cr=(rr=(ur=(fr=e[1].conf)==null?void 0:fr.general)==null?void 0:ur.security)==null?void 0:rr.none)!=null?cr:"None")+"",jt,Lt,Ht=((dr=(pr=(mr=(_r=e[1].conf)==null?void 0:_r.general)==null?void 0:mr.security)==null?void 0:pr.conf)!=null?dr:"Conf")+"",yt,Me,Ve=((gr=(br=(hr=(vr=e[1].conf)==null?void 0:vr.general)==null?void 0:hr.security)==null?void 0:br.all)!=null?gr:"All")+"",Rt,Gt,zt,Dt,Kt=((Mr=(wr=(kr=e[1].conf)==null?void 0:kr.general)==null?void 0:wr.context)!=null?Mr:"Context")+"",Zt,tl,Jt,ft,Mt,Ke,ne,Ue,Le=((Nr=(Cr=(Sr=e[1].conf)==null?void 0:Sr.meter)==null?void 0:Cr.title)!=null?Nr:"Meter")+"",St,ut,Yt,ll,fl,ul,Sl,rl,Cl,nl,_l=((Ar=(Er=(Pr=(Tr=e[1].conf)==null?void 0:Tr.meter)==null?void 0:Pr.comm)==null?void 0:Er.title)!=null?Ar:"Communication")+"",dl,Nl,Tl,Qt,Ee,qt=((Ir=(Or=(qr=(Dr=e[1].conf)==null?void 0:Dr.meter)==null?void 0:qr.comm)==null?void 0:Or.passive)!=null?Ir:"Passive")+"",Pn,Jl,dn=((Br=(Fr=(Rr=(Lr=e[1].conf)==null?void 0:Lr.meter)==null?void 0:Rr.comm)==null?void 0:Fr.pulse)!=null?Br:"Pulse")+"",En,Re,he,Qe,vn=((jr=(Ur=e[1].common)==null?void 0:Ur.voltage)!=null?jr:"Voltage")+"",An,Hn,yn,ml,$l,xl,zn,en,Gl,hn=((zr=(yr=(Hr=e[1].conf)==null?void 0:Hr.meter)==null?void 0:yr.fuse)!=null?zr:"Main fuse")+"",Dn,Wn,Gn,tn,cl,Vn,bn,Kn,Vl,ei=((Vr=(Gr=(Wr=e[1].conf)==null?void 0:Wr.meter)==null?void 0:Gr.prod)!=null?Vr:"Production")+"",ki,fs,us,qn,Pl,rs,ti,cs,wi,_s,gn,Yn,El,ms,li=((Qr=(Yr=(Kr=e[1].conf)==null?void 0:Kr.meter)==null?void 0:Yr.encrypted)!=null?Qr:"Encrypted")+"",Mi,ps,ds,Si,Qn,Al,Pf,js=(($r=(Jr=(Zr=(Xr=e[1].conf)==null?void 0:Xr.meter)==null?void 0:Zr.multipliers)==null?void 0:Jr.title)!=null?$r:"Multipliers")+"",Yo,Ef,Af,Kl,Hs,ys=((t1=(e1=(xr=e[1].conf)==null?void 0:xr.connection)==null?void 0:e1.title)!=null?t1:"Connection")+"",Qo,Df,Ci,qf,Of,vs,If,zs,ln,Ni,Ws=((i1=(n1=(l1=e[1].conf)==null?void 0:l1.connection)==null?void 0:n1.wifi)!=null?i1:"WiFi")+"",Xo,Ti,Gs=((a1=(o1=(s1=e[1].conf)==null?void 0:s1.connection)==null?void 0:o1.ap)!=null?a1:"AP")+"",Zo,Lf,Rf,il,Vs,Ks=((r1=(u1=(f1=e[1].conf)==null?void 0:f1.network)==null?void 0:u1.title)!=null?r1:"Network")+"",Jo,Ff,Pi,Bf,Uf,ni,Ys=((m1=(_1=(c1=e[1].conf)==null?void 0:c1.network)==null?void 0:_1.ip)!=null?m1:"IP")+"",$o,jf,Hf,Xn,kn,Ei,Qs=((v1=(d1=(p1=e[1].conf)==null?void 0:p1.network)==null?void 0:d1.dhcp)!=null?v1:"DHCP")+"",xo,Ai,Xs=((g1=(b1=(h1=e[1].conf)==null?void 0:h1.network)==null?void 0:b1.static)!=null?g1:"Static")+"",ea,yf,Yl,Zs,Js,zf,Ql,Di,$s,xs,Wf,ta,eo,to,sn,Gf,Vf,lo,hs,on,Kf,no=((M1=(w1=(k1=e[1].conf)==null?void 0:k1.network)==null?void 0:w1.tick_mdns)!=null?M1:"mDNS")+"",la,Yf,bs,Qf,On,io=((N1=(C1=(S1=e[1].conf)==null?void 0:S1.network)==null?void 0:C1.ntp)!=null?N1:"NTP")+"",na,Xf,qi,an,Zf,so=((E1=(P1=(T1=e[1].conf)==null?void 0:T1.network)==null?void 0:P1.tick_ntp_dhcp)!=null?E1:"from DHCP")+"",ia,Jf,$f,oo,In,xf,$t,ao,fo=((q1=(D1=(A1=e[1].conf)==null?void 0:A1.mqtt)==null?void 0:D1.title)!=null?q1:"MQTT")+"",sa,eu,Oi,tu,lu,gs,nu,fn,uo=((L1=(I1=(O1=e[1].conf)==null?void 0:O1.mqtt)==null?void 0:I1.server)!=null?L1:"Server")+"",oa,iu,aa,su,ou,Ii,Ln,au,un,fu,fa,ii,ro=((B1=(F1=(R1=e[1].conf)==null?void 0:R1.mqtt)==null?void 0:F1.user)!=null?B1:"Username")+"",ua,uu,ru,Rn,cu,si,co=((H1=(j1=(U1=e[1].conf)==null?void 0:U1.mqtt)==null?void 0:j1.pass)!=null?H1:"Password")+"",ra,_u,mu,Fn,pu,Li,Ri,_o=((W1=(z1=(y1=e[1].conf)==null?void 0:y1.mqtt)==null?void 0:z1.id)!=null?W1:"Client ID")+"",ca,du,vu,Bn,hu,Fi,mo=((K1=(V1=(G1=e[1].conf)==null?void 0:G1.mqtt)==null?void 0:V1.payload)!=null?K1:"Payload")+"",_a,bu,gu,pl,Bi,Ui,ji,po=((Z1=(X1=(Q1=(Y1=e[1].conf)==null?void 0:Y1.mqtt)==null?void 0:Q1.domoticz)==null?void 0:X1.title)!=null?Z1:"Domoticz")+"",ma,Hi,vo=((e0=(x1=($1=(J1=e[1].conf)==null?void 0:J1.mqtt)==null?void 0:$1.ha)==null?void 0:x1.title)!=null?e0:"Home-Assistant")+"",pa,yi,zi,Wi,Gi,ku,oi,ho=((n0=(l0=(t0=e[1].conf)==null?void 0:t0.mqtt)==null?void 0:l0.publish)!=null?n0:"Publish topic")+"",da,wu,Mu,Un,Su,va,ha,ba,ga=e[4].p.r.startsWith("NO")||e[4].p.r.startsWith("10YNO")||e[4].p.r.startsWith("10Y1001A1001A4"),ka,wn,bo,go=((o0=(s0=(i0=e[1].conf)==null?void 0:i0.ui)==null?void 0:s0.title)!=null?o0:"User interface")+"",wa,Cu,Vi,Nu,Tu,ks,Pu,ai,Ma,Ki,ko=((u0=(f0=(a0=e[1].conf)==null?void 0:a0.ui)==null?void 0:f0.lang)!=null?u0:"Language")+"",Sa,Eu,rn,Au,Ca,Xl,wo,Mo=((_0=(c0=(r0=e[1].conf)==null?void 0:r0.debug)==null?void 0:c0.title)!=null?_0:"Debugging")+"",Na,Du,Yi,qu,ws,Ou,So,Ms,cn,Iu,Co=((d0=(p0=(m0=e[1].conf)==null?void 0:m0.debug)==null?void 0:p0.enable)!=null?d0:"Enable debugging")+"",Ta,Lu,Ru,Zn,Pa,Qi,No=((h0=(v0=e[1].conf)==null?void 0:v0.btn_reset)!=null?h0:"Factory reset")+"",Ea,Fu,To,Xi,Po=((g0=(b0=e[1].btn)==null?void 0:b0.reboot)!=null?g0:"Reboot")+"",Aa,Bu,Eo,Ss,Ao=((w0=(k0=e[1].btn)==null?void 0:k0.save)!=null?w0:"Save")+"",Da,qa,fi,Oa,ui,Ia,ri,La,ci,Xe,Ra,Uu;R=new I4({});let Zl=!e[4].p.t&&v2(),Iv=["NOK","SEK","DKK","EUR","CHF"],Cs=[];for(let G=0;G<5;G+=1)Cs[G]=z4(y4(e,Iv,G));lt=new nn({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[W4]},$$scope:{ctx:e}}});let Dl=e[4].p.e&&e[0].chip!="esp8266"&&h2(e),ql=e[4].g.s>0&&b2(e);function ju(G,_e){return G[4].m.a===2?V4:G4}let Do=ju(e),Mn=Do(e),Ol=e[4].m.e.e&&g2(e),Il=e[4].m.e.e&&k2(e),Ll=e[4].m.m.e&&w2(e),Rl=e[0].if&&e[0].if.eth&&M2(e),Fl=(e[4].n.c==1||e[4].n.c==2)&&S2(e);Di=new qv({});let Bl=e[4].n.m=="static"&&C2(e),Ul=e[0].chip!="esp8266"&&N2(e),sl=e[4].q.s.e&&T2(e),jl=e[4].q.m==3&&P2(e),Hl=e[4].q.m==4&&E2(e),ol=e[4].c.es!=null&&A2(e),yl=ga&&O2(e),Zi=e[9],vl=[];for(let G=0;G20||e[0].chip=="esp8266"||e[4].i.d.d>0)&&F2(e),zl=e[4].d.s&&W2(e);return fi=new kl({props:{active:e[2],message:(C0=(S0=(M0=e[1].conf)==null?void 0:M0.mask)==null?void 0:S0.loading)!=null?C0:"Loading"}}),ui=new kl({props:{active:e[3],message:(P0=(T0=(N0=e[1].conf)==null?void 0:N0.mask)==null?void 0:T0.saving)!=null?P0:"Saving"}}),ri=new kl({props:{active:e[6],message:(D0=(A0=(E0=e[1].conf)==null?void 0:E0.mask)==null?void 0:A0.reset)!=null?D0:"Factory reset"}}),ci=new kl({props:{active:e[7],message:(I0=(O0=(q0=e[1].conf)==null?void 0:q0.mask)==null?void 0:O0.reset_done)!=null?I0:"Done"}}),{c(){var G,_e,el;t=m("form"),l=m("div"),n=m("div"),i=m("strong"),f=k(o),r=b(),c=m("a"),a=k("\u24D8"),_=b(),p=m("input"),v=b(),d=m("div"),h=m("div"),g=m("div"),A=k(M),I=m("br"),q=b(),L=m("input"),O=b(),U=m("div"),B=k(E),z=m("br"),W=b(),F=m("select"),Ne(R.$$.fragment),K=b(),y=m("input"),H=b(),Y=m("div"),X=m("div"),J=m("div"),ce=k($),ie=m("br"),oe=b(),ae=m("select"),se=m("optgroup"),Zl&&Zl.c(),x=m("option"),x.textContent="NO1",me=m("option"),me.textContent="NO2",pe=m("option"),pe.textContent="NO3",V=m("option"),V.textContent="NO4",Z=m("option"),Z.textContent="NO5",ge=m("optgroup"),ve=m("option"),ve.textContent="SE1",S=m("option"),S.textContent="SE2",w=m("option"),w.textContent="SE3",N=m("option"),N.textContent="SE4",D=m("optgroup"),j=m("option"),j.textContent="DK1",te=m("option"),te.textContent="DK2",le=m("option"),le.textContent="Austria",fe=m("option"),fe.textContent="Belgium",de=m("option"),de.textContent="Czech Republic",qe=m("option"),qe.textContent="Estonia",Pe=m("option"),Pe.textContent="Finland",we=m("option"),we.textContent="France",Fe=m("option"),Fe.textContent="Germany",Ae=m("option"),Ae.textContent="Great Britain",ke=m("option"),ke.textContent="Latvia",De=m("option"),De.textContent="Lithuania",He=m("option"),He.textContent="Netherland",Oe=m("option"),Oe.textContent="Poland",je=m("option"),je.textContent="Switzerland",Ye=b(),We=m("div"),xe=k($e),tt=m("br"),Te=b(),ue=m("select");for(let bl=0;bl<5;bl+=1)Cs[bl].c();Ie=b(),kt=m("div"),Ne(lt.$$.fragment),wt=b(),st=m("div"),ot=m("label"),et=m("input"),Nt=b(),At=k(gt),Pt=b(),Dl&&Dl.c(),Be=b(),ye=m("div"),vt=k(It),nt=m("br"),Tt=b(),it=m("select"),at=m("option"),jt=k(rt),Lt=m("option"),yt=k(Ht),Me=m("option"),Rt=k(Ve),Gt=b(),ql&&ql.c(),zt=b(),Dt=m("div"),Zt=k(Kt),tl=m("br"),Jt=b(),ft=m("input"),Ke=b(),ne=m("div"),Ue=m("strong"),St=k(Le),ut=b(),Yt=m("a"),ll=k("\u24D8"),fl=b(),ul=m("input"),Sl=b(),rl=m("input"),Cl=b(),nl=m("div"),dl=k(_l),Nl=m("br"),Tl=b(),Qt=m("select"),Ee=m("option"),Pn=k(qt),Jl=m("option"),En=k(dn),Re=b(),Mn.c(),he=b(),Qe=m("div"),An=k(vn),Hn=m("br"),yn=b(),ml=m("select"),$l=m("option"),$l.textContent="400V (TN)",xl=m("option"),xl.textContent="230V (IT/TT)",zn=b(),en=m("div"),Gl=m("div"),Dn=k(hn),Wn=m("br"),Gn=b(),tn=m("label"),cl=m("input"),Vn=b(),bn=m("span"),bn.textContent="A",Kn=b(),Vl=m("div"),ki=k(ei),fs=m("br"),us=b(),qn=m("label"),Pl=m("input"),rs=b(),ti=m("span"),ti.textContent="kWp",cs=b(),wi=m("div"),_s=b(),gn=m("div"),Yn=m("label"),El=m("input"),ms=b(),Mi=k(li),ps=b(),Ol&&Ol.c(),ds=b(),Il&&Il.c(),Si=b(),Qn=m("label"),Al=m("input"),Pf=b(),Yo=k(js),Ef=b(),Ll&&Ll.c(),Af=b(),Kl=m("div"),Hs=m("strong"),Qo=k(ys),Df=b(),Ci=m("a"),qf=k("\u24D8"),Of=b(),vs=m("input"),If=b(),zs=m("div"),ln=m("select"),Ni=m("option"),Xo=k(Ws),Ti=m("option"),Zo=k(Gs),Rl&&Rl.c(),Lf=b(),Fl&&Fl.c(),Rf=b(),il=m("div"),Vs=m("strong"),Jo=k(Ks),Ff=b(),Pi=m("a"),Bf=k("\u24D8"),Uf=b(),ni=m("div"),$o=k(Ys),jf=m("br"),Hf=b(),Xn=m("div"),kn=m("select"),Ei=m("option"),xo=k(Qs),Ai=m("option"),ea=k(Xs),yf=b(),Yl=m("input"),zf=b(),Ql=m("select"),Ne(Di.$$.fragment),Wf=b(),Bl&&Bl.c(),ta=b(),eo=m("div"),to=m("label"),sn=m("input"),Gf=k(" IPv6"),Vf=b(),lo=m("div"),hs=m("label"),on=m("input"),Kf=b(),la=k(no),Yf=b(),bs=m("input"),Qf=b(),On=m("div"),na=k(io),Xf=b(),qi=m("label"),an=m("input"),Zf=b(),ia=k(so),Jf=m("br"),$f=b(),oo=m("div"),In=m("input"),xf=b(),$t=m("div"),ao=m("strong"),sa=k(fo),eu=b(),Oi=m("a"),tu=k("\u24D8"),lu=b(),gs=m("input"),nu=b(),fn=m("div"),oa=k(uo),iu=b(),Ul&&Ul.c(),aa=b(),su=m("br"),ou=b(),Ii=m("div"),Ln=m("input"),au=b(),un=m("input"),fu=b(),sl&&sl.c(),fa=b(),ii=m("div"),ua=k(ro),uu=m("br"),ru=b(),Rn=m("input"),cu=b(),si=m("div"),ra=k(co),_u=m("br"),mu=b(),Fn=m("input"),pu=b(),Li=m("div"),Ri=m("div"),ca=k(_o),du=m("br"),vu=b(),Bn=m("input"),hu=b(),Fi=m("div"),_a=k(mo),bu=m("br"),gu=b(),pl=m("select"),Bi=m("option"),Bi.textContent="Raw (minimal)",Ui=m("option"),Ui.textContent="Raw (full)",ji=m("option"),ma=k(po),Hi=m("option"),pa=k(vo),yi=m("option"),yi.textContent="JSON (classic)",zi=m("option"),zi.textContent="JSON (multi topic)",Wi=m("option"),Wi.textContent="JSON (flat)",Gi=m("option"),Gi.textContent="HEX dump",ku=b(),oi=m("div"),da=k(ho),wu=m("br"),Mu=b(),Un=m("input"),Su=b(),jl&&jl.c(),va=b(),Hl&&Hl.c(),ha=b(),ol&&ol.c(),ba=b(),yl&&yl.c(),ka=b(),wn=m("div"),bo=m("strong"),wa=k(go),Cu=b(),Vi=m("a"),Nu=k("\u24D8"),Tu=b(),ks=m("input"),Pu=b(),ai=m("div");for(let bl=0;ble[20].call(F)),u(h,"class","flex"),u(d,"class","my-1"),u(y,"type","hidden"),u(y,"name","p"),y.value="true",x.__value="10YNO-1--------2",x.value=x.__value,me.__value="10YNO-2--------T",me.value=me.__value,pe.__value="10YNO-3--------J",pe.value=pe.__value,V.__value="10YNO-4--------9",V.value=V.__value,Z.__value="10Y1001A1001A48H",Z.value=Z.__value,u(se,"label","Norway"),ve.__value="10Y1001A1001A44P",ve.value=ve.__value,S.__value="10Y1001A1001A45N",S.value=S.__value,w.__value="10Y1001A1001A46L",w.value=w.__value,N.__value="10Y1001A1001A47J",N.value=N.__value,u(ge,"label","Sweden"),j.__value="10YDK-1--------W",j.value=j.__value,te.__value="10YDK-2--------M",te.value=te.__value,u(D,"label","Denmark"),le.__value="10YAT-APG------L",le.value=le.__value,fe.__value="10YBE----------2",fe.value=fe.__value,de.__value="10YCZ-CEPS-----N",de.value=de.__value,qe.__value="10Y1001A1001A39I",qe.value=qe.__value,Pe.__value="10YFI-1--------U",Pe.value=Pe.__value,we.__value="10YFR-RTE------C",we.value=we.__value,Fe.__value="10Y1001A1001A83F",Fe.value=Fe.__value,Ae.__value="10YGB----------A",Ae.value=Ae.__value,ke.__value="10YLV-1001A00074",ke.value=ke.__value,De.__value="10YLT-1001A0008Q",De.value=De.__value,He.__value="10YNL----------L",He.value=He.__value,Oe.__value="10YPL-AREA-----S",Oe.value=Oe.__value,je.__value="10YCH-SWISSGRIDZ",je.value=je.__value,u(ae,"name","pr"),u(ae,"class","in-f w-full"),e[4].p.r===void 0&&Ct(()=>e[21].call(ae)),u(J,"class","w-full"),u(ue,"name","pc"),u(ue,"class","in-l"),e[4].p.c===void 0&&Ct(()=>e[22].call(ue)),u(X,"class","flex"),u(Y,"class","my-1"),u(kt,"class","my-1"),u(et,"type","checkbox"),u(et,"name","pe"),et.__value="true",et.value=et.__value,u(et,"class","rounded mb-1"),u(st,"class","my-1"),at.__value=0,at.value=at.__value,Lt.__value=1,Lt.value=Lt.__value,Me.__value=2,Me.value=Me.__value,u(it,"name","gs"),u(it,"class","in-s"),e[4].g.s===void 0&&Ct(()=>e[25].call(it)),u(ye,"class","my-1"),u(ft,"name","gc"),u(ft,"type","text"),u(ft,"pattern","[A-Za-z0-9]+"),u(ft,"placeholder",Mt=(el=(_e=(G=e[1].conf)==null?void 0:G.general)==null?void 0:_e.context_placeholder)!=null?el:"/"),u(ft,"class","in-s"),u(ft,"maxlength","36"),u(Dt,"class","my-1"),u(n,"class","cnt"),u(Ue,"class","text-sm"),u(Yt,"href",Wl("Meter-configuration")),u(Yt,"target","_blank"),u(Yt,"class","float-right"),u(ul,"type","hidden"),u(ul,"name","m"),ul.value="true",u(rl,"type","hidden"),u(rl,"name","mo"),rl.value="1",Ee.__value=0,Ee.value=Ee.__value,Jl.__value=2,Jl.value=Jl.__value,u(Qt,"name","ma"),u(Qt,"class","in-s"),e[4].m.a===void 0&&Ct(()=>e[29].call(Qt)),u(nl,"class","my-1"),$l.__value=2,$l.value=$l.__value,xl.__value=1,xl.value=xl.__value,u(ml,"name","md"),u(ml,"class","in-s"),e[4].m.d===void 0&&Ct(()=>e[35].call(ml)),u(Qe,"class","my-1"),u(cl,"name","mf"),u(cl,"type","number"),u(cl,"min","5"),u(cl,"max","65535"),u(cl,"class","in-f tr w-full"),u(bn,"class","in-post"),u(tn,"class","flex"),u(Gl,"class","mx-1"),u(Pl,"name","mr"),u(Pl,"type","number"),u(Pl,"min","0"),u(Pl,"max","65535"),u(Pl,"class","in-f tr w-full"),u(ti,"class","in-post"),u(qn,"class","flex"),u(Vl,"class","mx-1"),u(en,"class","my-1 flex"),u(wi,"class","my-1"),u(El,"type","checkbox"),u(El,"name","me"),El.__value="true",El.value=El.__value,u(El,"class","rounded mb-1"),u(gn,"class","my-1"),u(Al,"type","checkbox"),u(Al,"name","mm"),Al.__value="true",Al.value=Al.__value,u(Al,"class","rounded mb-1"),u(ne,"class","cnt"),u(Hs,"class","text-sm"),u(Ci,"href",Wl("WiFi-configuration")),u(Ci,"target","_blank"),u(Ci,"class","float-right"),u(vs,"type","hidden"),u(vs,"name","w"),vs.value="true",Ni.__value=1,Ni.value=Ni.__value,Ti.__value=2,Ti.value=Ti.__value,u(ln,"name","nc"),u(ln,"class","in-s"),e[4].n.c===void 0&&Ct(()=>e[46].call(ln)),u(zs,"class","my-1"),u(Kl,"class","cnt"),u(Vs,"class","text-sm"),u(Pi,"href",Wl("Network-configuration")),u(Pi,"target","_blank"),u(Pi,"class","float-right"),Ei.__value="dhcp",Ei.value=Ei.__value,Ai.__value="static",Ai.value=Ai.__value,u(kn,"name","nm"),u(kn,"class","in-f"),e[4].n.m===void 0&&Ct(()=>e[52].call(kn)),u(Yl,"name","ni"),u(Yl,"type","text"),u(Yl,"class","in-m w-full"),Yl.disabled=Zs=e[4].n.m=="dhcp",Yl.required=Js=e[4].n.m=="static",u(Ql,"name","ns"),u(Ql,"class","in-l"),Ql.disabled=$s=e[4].n.m=="dhcp",Ql.required=xs=e[4].n.m=="static",e[4].n.s===void 0&&Ct(()=>e[54].call(Ql)),u(Xn,"class","flex"),u(ni,"class","my-1"),u(sn,"name","nx"),sn.__value="true",sn.value=sn.__value,u(sn,"type","checkbox"),u(sn,"class","rounded mb-1"),u(eo,"class","my-1"),u(on,"name","nd"),on.__value="true",on.value=on.__value,u(on,"type","checkbox"),u(on,"class","rounded mb-1"),u(lo,"class","my-1"),u(bs,"type","hidden"),u(bs,"name","ntp"),bs.value="true",u(an,"name","ntpd"),an.__value="true",an.value=an.__value,u(an,"type","checkbox"),u(an,"class","rounded mb-1"),u(qi,"class","ml-4"),u(In,"name","ntph"),u(In,"type","text"),u(In,"class","in-s"),u(oo,"class","flex"),u(On,"class","my-1"),u(il,"class","cnt"),u(ao,"class","text-sm"),u(Oi,"href",Wl("MQTT-configuration")),u(Oi,"target","_blank"),u(Oi,"class","float-right"),u(gs,"type","hidden"),u(gs,"name","q"),gs.value="true",u(Ln,"name","qh"),u(Ln,"type","text"),u(Ln,"class","in-f w-2/3"),u(un,"name","qp"),u(un,"type","number"),u(un,"min","1024"),u(un,"max","65535"),u(un,"class","in-l tr w-1/3"),u(Ii,"class","flex"),u(fn,"class","my-1"),u(Rn,"name","qu"),u(Rn,"type","text"),u(Rn,"class","in-s"),u(ii,"class","my-1"),u(Fn,"name","qa"),u(Fn,"type","password"),u(Fn,"class","in-s"),u(si,"class","my-1"),u(Bn,"name","qc"),u(Bn,"type","text"),u(Bn,"class","in-f w-full"),Bi.__value=1,Bi.value=Bi.__value,Ui.__value=2,Ui.value=Ui.__value,ji.__value=3,ji.value=ji.__value,Hi.__value=4,Hi.value=Hi.__value,yi.__value=0,yi.value=yi.__value,zi.__value=5,zi.value=zi.__value,Wi.__value=6,Wi.value=Wi.__value,Gi.__value=255,Gi.value=Gi.__value,u(pl,"name","qm"),u(pl,"class","in-l"),e[4].q.m===void 0&&Ct(()=>e[68].call(pl)),u(Li,"class","my-1 flex"),u(Un,"name","qb"),u(Un,"type","text"),u(Un,"class","in-s"),u(oi,"class","my-1"),u($t,"class","cnt"),u(bo,"class","text-sm"),u(Vi,"href",Wl("User-interface")),u(Vi,"target","_blank"),u(Vi,"class","float-right"),u(ks,"type","hidden"),u(ks,"name","u"),ks.value="true",u(rn,"name","ulang"),u(rn,"class","in-s"),e[4].u.lang===void 0&&Ct(()=>e[83].call(rn)),u(Ki,"class","w-1/2"),u(ai,"class","flex flex-wrap"),u(wn,"class","cnt"),u(wo,"class","text-sm"),u(Yi,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Yi,"target","_blank"),u(Yi,"class","float-right"),u(ws,"type","hidden"),u(ws,"name","d"),ws.value="true",u(cn,"type","checkbox"),u(cn,"name","ds"),cn.__value="true",cn.value=cn.__value,u(cn,"class","rounded mb-1"),u(So,"class","mt-3"),u(Xl,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Qi,"type","button"),u(Qi,"class","btn-red"),u(Xi,"type","button"),u(Xi,"class","btn-yellow"),u(To,"class","text-center"),u(Ss,"type","submit"),u(Ss,"class","btn-pri"),u(Eo,"class","text-right"),u(Zn,"class","grid grid-cols-3 mt-3"),u(t,"autocomplete","off")},m(G,_e){P(G,t,_e),s(t,l),s(l,n),s(n,i),s(i,f),s(n,r),s(n,c),s(c,a),s(n,_),s(n,p),s(n,v),s(n,d),s(d,h),s(h,g),s(g,A),s(g,I),s(g,q),s(g,L),be(L,e[4].g.h),s(h,O),s(h,U),s(U,B),s(U,z),s(U,W),s(U,F),Se(R,F,null),Je(F,e[4].g.t,!0),s(n,K),s(n,y),s(n,H),s(n,Y),s(Y,X),s(X,J),s(J,ce),s(J,ie),s(J,oe),s(J,ae),s(ae,se),Zl&&Zl.m(se,null),s(se,x),s(se,me),s(se,pe),s(se,V),s(se,Z),s(ae,ge),s(ge,ve),s(ge,S),s(ge,w),s(ge,N),s(ae,D),s(D,j),s(D,te),s(ae,le),s(ae,fe),s(ae,de),s(ae,qe),s(ae,Pe),s(ae,we),s(ae,Fe),s(ae,Ae),s(ae,ke),s(ae,De),s(ae,He),s(ae,Oe),s(ae,je),Je(ae,e[4].p.r,!0),s(X,Ye),s(X,We),s(We,xe),s(We,tt),s(We,Te),s(We,ue);for(let el=0;el<5;el+=1)Cs[el]&&Cs[el].m(ue,null);Je(ue,e[4].p.c,!0),s(n,Ie),s(n,kt),Se(lt,kt,null),s(n,wt),s(n,st),s(st,ot),s(ot,et),et.checked=e[4].p.e,s(ot,Nt),s(ot,At),s(st,Pt),Dl&&Dl.m(st,null),s(n,Be),s(n,ye),s(ye,vt),s(ye,nt),s(ye,Tt),s(ye,it),s(it,at),s(at,jt),s(it,Lt),s(Lt,yt),s(it,Me),s(Me,Rt),Je(it,e[4].g.s,!0),s(n,Gt),ql&&ql.m(n,null),s(n,zt),s(n,Dt),s(Dt,Zt),s(Dt,tl),s(Dt,Jt),s(Dt,ft),be(ft,e[4].g.c),s(l,Ke),s(l,ne),s(ne,Ue),s(Ue,St),s(ne,ut),s(ne,Yt),s(Yt,ll),s(ne,fl),s(ne,ul),s(ne,Sl),s(ne,rl),s(ne,Cl),s(ne,nl),s(nl,dl),s(nl,Nl),s(nl,Tl),s(nl,Qt),s(Qt,Ee),s(Ee,Pn),s(Qt,Jl),s(Jl,En),Je(Qt,e[4].m.a,!0),s(ne,Re),Mn.m(ne,null),s(ne,he),s(ne,Qe),s(Qe,An),s(Qe,Hn),s(Qe,yn),s(Qe,ml),s(ml,$l),s(ml,xl),Je(ml,e[4].m.d,!0),s(ne,zn),s(ne,en),s(en,Gl),s(Gl,Dn),s(Gl,Wn),s(Gl,Gn),s(Gl,tn),s(tn,cl),be(cl,e[4].m.f),s(tn,Vn),s(tn,bn),s(en,Kn),s(en,Vl),s(Vl,ki),s(Vl,fs),s(Vl,us),s(Vl,qn),s(qn,Pl),be(Pl,e[4].m.r),s(qn,rs),s(qn,ti),s(ne,cs),s(ne,wi),s(ne,_s),s(ne,gn),s(gn,Yn),s(Yn,El),El.checked=e[4].m.e.e,s(Yn,ms),s(Yn,Mi),s(gn,ps),Ol&&Ol.m(gn,null),s(ne,ds),Il&&Il.m(ne,null),s(ne,Si),s(ne,Qn),s(Qn,Al),Al.checked=e[4].m.m.e,s(Qn,Pf),s(Qn,Yo),s(ne,Ef),Ll&&Ll.m(ne,null),s(l,Af),s(l,Kl),s(Kl,Hs),s(Hs,Qo),s(Kl,Df),s(Kl,Ci),s(Ci,qf),s(Kl,Of),s(Kl,vs),s(Kl,If),s(Kl,zs),s(zs,ln),s(ln,Ni),s(Ni,Xo),s(ln,Ti),s(Ti,Zo),Rl&&Rl.m(ln,null),Je(ln,e[4].n.c,!0),s(Kl,Lf),Fl&&Fl.m(Kl,null),s(l,Rf),s(l,il),s(il,Vs),s(Vs,Jo),s(il,Ff),s(il,Pi),s(Pi,Bf),s(il,Uf),s(il,ni),s(ni,$o),s(ni,jf),s(ni,Hf),s(ni,Xn),s(Xn,kn),s(kn,Ei),s(Ei,xo),s(kn,Ai),s(Ai,ea),Je(kn,e[4].n.m,!0),s(Xn,yf),s(Xn,Yl),be(Yl,e[4].n.i),s(Xn,zf),s(Xn,Ql),Se(Di,Ql,null),Je(Ql,e[4].n.s,!0),s(il,Wf),Bl&&Bl.m(il,null),s(il,ta),s(il,eo),s(eo,to),s(to,sn),sn.checked=e[4].n.x,s(to,Gf),s(il,Vf),s(il,lo),s(lo,hs),s(hs,on),on.checked=e[4].n.d,s(hs,Kf),s(hs,la),s(il,Yf),s(il,bs),s(il,Qf),s(il,On),s(On,na),s(On,Xf),s(On,qi),s(qi,an),an.checked=e[4].n.h,s(qi,Zf),s(qi,ia),s(On,Jf),s(On,$f),s(On,oo),s(oo,In),be(In,e[4].n.n1),s(l,xf),s(l,$t),s($t,ao),s(ao,sa),s($t,eu),s($t,Oi),s(Oi,tu),s($t,lu),s($t,gs),s($t,nu),s($t,fn),s(fn,oa),s(fn,iu),Ul&&Ul.m(fn,null),s(fn,aa),s(fn,su),s(fn,ou),s(fn,Ii),s(Ii,Ln),be(Ln,e[4].q.h),s(Ii,au),s(Ii,un),be(un,e[4].q.p),s($t,fu),sl&&sl.m($t,null),s($t,fa),s($t,ii),s(ii,ua),s(ii,uu),s(ii,ru),s(ii,Rn),be(Rn,e[4].q.u),s($t,cu),s($t,si),s(si,ra),s(si,_u),s(si,mu),s(si,Fn),be(Fn,e[4].q.a),s($t,pu),s($t,Li),s(Li,Ri),s(Ri,ca),s(Ri,du),s(Ri,vu),s(Ri,Bn),be(Bn,e[4].q.c),s(Li,hu),s(Li,Fi),s(Fi,_a),s(Fi,bu),s(Fi,gu),s(Fi,pl),s(pl,Bi),s(pl,Ui),s(pl,ji),s(ji,ma),s(pl,Hi),s(Hi,pa),s(pl,yi),s(pl,zi),s(pl,Wi),s(pl,Gi),Je(pl,e[4].q.m,!0),s($t,ku),s($t,oi),s(oi,da),s(oi,wu),s(oi,Mu),s(oi,Un),be(Un,e[4].q.b),s(l,Su),jl&&jl.m(l,null),s(l,va),Hl&&Hl.m(l,null),s(l,ha),ol&&ol.m(l,null),s(l,ba),yl&&yl.m(l,null),s(l,ka),s(l,wn),s(wn,bo),s(bo,wa),s(wn,Cu),s(wn,Vi),s(Vi,Nu),s(wn,Tu),s(wn,ks),s(wn,Pu),s(wn,ai);for(let el=0;el0?ql?ql.p(G,_e):(ql=b2(G),ql.c(),ql.m(n,zt)):ql&&(ql.d(1),ql=null),(!Xe||_e[0]&2)&&Kt!==(Kt=((vc=(dc=(pc=G[1].conf)==null?void 0:pc.general)==null?void 0:dc.context)!=null?vc:"Context")+"")&&C(Zt,Kt),(!Xe||_e[0]&2&&Mt!==(Mt=(gc=(bc=(hc=G[1].conf)==null?void 0:hc.general)==null?void 0:bc.context_placeholder)!=null?gc:"/"))&&u(ft,"placeholder",Mt),_e[0]&16&&ft.value!==G[4].g.c&&be(ft,G[4].g.c),(!Xe||_e[0]&2)&&Le!==(Le=((Mc=(wc=(kc=G[1].conf)==null?void 0:kc.meter)==null?void 0:wc.title)!=null?Mc:"Meter")+"")&&C(St,Le),(!Xe||_e[0]&2)&&_l!==(_l=((Tc=(Nc=(Cc=(Sc=G[1].conf)==null?void 0:Sc.meter)==null?void 0:Cc.comm)==null?void 0:Nc.title)!=null?Tc:"Communication")+"")&&C(dl,_l),(!Xe||_e[0]&2)&&qt!==(qt=((Dc=(Ac=(Ec=(Pc=G[1].conf)==null?void 0:Pc.meter)==null?void 0:Ec.comm)==null?void 0:Ac.passive)!=null?Dc:"Passive")+"")&&C(Pn,qt),(!Xe||_e[0]&2)&&dn!==(dn=((Lc=(Ic=(Oc=(qc=G[1].conf)==null?void 0:qc.meter)==null?void 0:Oc.comm)==null?void 0:Ic.pulse)!=null?Lc:"Pulse")+"")&&C(En,dn),_e[0]&16&&Je(Qt,G[4].m.a),Do===(Do=ju(G))&&Mn?Mn.p(G,_e):(Mn.d(1),Mn=Do(G),Mn&&(Mn.c(),Mn.m(ne,he))),(!Xe||_e[0]&2)&&vn!==(vn=((Fc=(Rc=G[1].common)==null?void 0:Rc.voltage)!=null?Fc:"Voltage")+"")&&C(An,vn),_e[0]&16&&Je(ml,G[4].m.d),(!Xe||_e[0]&2)&&hn!==(hn=((jc=(Uc=(Bc=G[1].conf)==null?void 0:Bc.meter)==null?void 0:Uc.fuse)!=null?jc:"Main fuse")+"")&&C(Dn,hn),_e[0]&16&&Ze(cl.value)!==G[4].m.f&&be(cl,G[4].m.f),(!Xe||_e[0]&2)&&ei!==(ei=((zc=(yc=(Hc=G[1].conf)==null?void 0:Hc.meter)==null?void 0:yc.prod)!=null?zc:"Production")+"")&&C(ki,ei),_e[0]&16&&Ze(Pl.value)!==G[4].m.r&&be(Pl,G[4].m.r),_e[0]&16&&(El.checked=G[4].m.e.e),(!Xe||_e[0]&2)&&li!==(li=((Vc=(Gc=(Wc=G[1].conf)==null?void 0:Wc.meter)==null?void 0:Gc.encrypted)!=null?Vc:"Encrypted")+"")&&C(Mi,li),G[4].m.e.e?Ol?Ol.p(G,_e):(Ol=g2(G),Ol.c(),Ol.m(gn,null)):Ol&&(Ol.d(1),Ol=null),G[4].m.e.e?Il?Il.p(G,_e):(Il=k2(G),Il.c(),Il.m(ne,Si)):Il&&(Il.d(1),Il=null),_e[0]&16&&(Al.checked=G[4].m.m.e),(!Xe||_e[0]&2)&&js!==(js=((Xc=(Qc=(Yc=(Kc=G[1].conf)==null?void 0:Kc.meter)==null?void 0:Yc.multipliers)==null?void 0:Qc.title)!=null?Xc:"Multipliers")+"")&&C(Yo,js),G[4].m.m.e?Ll?Ll.p(G,_e):(Ll=w2(G),Ll.c(),Ll.m(ne,null)):Ll&&(Ll.d(1),Ll=null),(!Xe||_e[0]&2)&&ys!==(ys=(($c=(Jc=(Zc=G[1].conf)==null?void 0:Zc.connection)==null?void 0:Jc.title)!=null?$c:"Connection")+"")&&C(Qo,ys),(!Xe||_e[0]&2)&&Ws!==(Ws=((t_=(e_=(xc=G[1].conf)==null?void 0:xc.connection)==null?void 0:e_.wifi)!=null?t_:"WiFi")+"")&&C(Xo,Ws),(!Xe||_e[0]&2)&&Gs!==(Gs=((i_=(n_=(l_=G[1].conf)==null?void 0:l_.connection)==null?void 0:n_.ap)!=null?i_:"AP")+"")&&C(Zo,Gs),G[0].if&&G[0].if.eth?Rl?Rl.p(G,_e):(Rl=M2(G),Rl.c(),Rl.m(ln,null)):Rl&&(Rl.d(1),Rl=null),_e[0]&16&&Je(ln,G[4].n.c),G[4].n.c==1||G[4].n.c==2?Fl?Fl.p(G,_e):(Fl=S2(G),Fl.c(),Fl.m(Kl,null)):Fl&&(Fl.d(1),Fl=null),(!Xe||_e[0]&2)&&Ks!==(Ks=((a_=(o_=(s_=G[1].conf)==null?void 0:s_.network)==null?void 0:o_.title)!=null?a_:"Network")+"")&&C(Jo,Ks),(!Xe||_e[0]&2)&&Ys!==(Ys=((r_=(u_=(f_=G[1].conf)==null?void 0:f_.network)==null?void 0:u_.ip)!=null?r_:"IP")+"")&&C($o,Ys),(!Xe||_e[0]&2)&&Qs!==(Qs=((m_=(__=(c_=G[1].conf)==null?void 0:c_.network)==null?void 0:__.dhcp)!=null?m_:"DHCP")+"")&&C(xo,Qs),(!Xe||_e[0]&2)&&Xs!==(Xs=((v_=(d_=(p_=G[1].conf)==null?void 0:p_.network)==null?void 0:d_.static)!=null?v_:"Static")+"")&&C(ea,Xs),_e[0]&16&&Je(kn,G[4].n.m),(!Xe||_e[0]&16&&Zs!==(Zs=G[4].n.m=="dhcp"))&&(Yl.disabled=Zs),(!Xe||_e[0]&16&&Js!==(Js=G[4].n.m=="static"))&&(Yl.required=Js),_e[0]&16&&Yl.value!==G[4].n.i&&be(Yl,G[4].n.i),(!Xe||_e[0]&16&&$s!==($s=G[4].n.m=="dhcp"))&&(Ql.disabled=$s),(!Xe||_e[0]&16&&xs!==(xs=G[4].n.m=="static"))&&(Ql.required=xs),_e[0]&16&&Je(Ql,G[4].n.s),G[4].n.m=="static"?Bl?Bl.p(G,_e):(Bl=C2(G),Bl.c(),Bl.m(il,ta)):Bl&&(Bl.d(1),Bl=null),_e[0]&16&&(sn.checked=G[4].n.x),_e[0]&16&&(on.checked=G[4].n.d),(!Xe||_e[0]&2)&&no!==(no=((g_=(b_=(h_=G[1].conf)==null?void 0:h_.network)==null?void 0:b_.tick_mdns)!=null?g_:"mDNS")+"")&&C(la,no),(!Xe||_e[0]&2)&&io!==(io=((M_=(w_=(k_=G[1].conf)==null?void 0:k_.network)==null?void 0:w_.ntp)!=null?M_:"NTP")+"")&&C(na,io),_e[0]&16&&(an.checked=G[4].n.h),(!Xe||_e[0]&2)&&so!==(so=((N_=(C_=(S_=G[1].conf)==null?void 0:S_.network)==null?void 0:C_.tick_ntp_dhcp)!=null?N_:"from DHCP")+"")&&C(ia,so),_e[0]&16&&In.value!==G[4].n.n1&&be(In,G[4].n.n1),(!Xe||_e[0]&2)&&fo!==(fo=((E_=(P_=(T_=G[1].conf)==null?void 0:T_.mqtt)==null?void 0:P_.title)!=null?E_:"MQTT")+"")&&C(sa,fo),(!Xe||_e[0]&2)&&uo!==(uo=((q_=(D_=(A_=G[1].conf)==null?void 0:A_.mqtt)==null?void 0:D_.server)!=null?q_:"Server")+"")&&C(oa,uo),G[0].chip!="esp8266"?Ul?Ul.p(G,_e):(Ul=N2(G),Ul.c(),Ul.m(fn,aa)):Ul&&(Ul.d(1),Ul=null),_e[0]&16&&Ln.value!==G[4].q.h&&be(Ln,G[4].q.h),_e[0]&16&&Ze(un.value)!==G[4].q.p&&be(un,G[4].q.p),G[4].q.s.e?sl?(sl.p(G,_e),_e[0]&16&&Q(sl,1)):(sl=T2(G),sl.c(),Q(sl,1),sl.m($t,fa)):sl&&(pt(),ee(sl,1,1,()=>{sl=null}),dt()),(!Xe||_e[0]&2)&&ro!==(ro=((L_=(I_=(O_=G[1].conf)==null?void 0:O_.mqtt)==null?void 0:I_.user)!=null?L_:"Username")+"")&&C(ua,ro),_e[0]&16&&Rn.value!==G[4].q.u&&be(Rn,G[4].q.u),(!Xe||_e[0]&2)&&co!==(co=((B_=(F_=(R_=G[1].conf)==null?void 0:R_.mqtt)==null?void 0:F_.pass)!=null?B_:"Password")+"")&&C(ra,co),_e[0]&16&&Fn.value!==G[4].q.a&&be(Fn,G[4].q.a),(!Xe||_e[0]&2)&&_o!==(_o=((H_=(j_=(U_=G[1].conf)==null?void 0:U_.mqtt)==null?void 0:j_.id)!=null?H_:"Client ID")+"")&&C(ca,_o),_e[0]&16&&Bn.value!==G[4].q.c&&be(Bn,G[4].q.c),(!Xe||_e[0]&2)&&mo!==(mo=((W_=(z_=(y_=G[1].conf)==null?void 0:y_.mqtt)==null?void 0:z_.payload)!=null?W_:"Payload")+"")&&C(_a,mo),(!Xe||_e[0]&2)&&po!==(po=((Y_=(K_=(V_=(G_=G[1].conf)==null?void 0:G_.mqtt)==null?void 0:V_.domoticz)==null?void 0:K_.title)!=null?Y_:"Domoticz")+"")&&C(ma,po),(!Xe||_e[0]&2)&&vo!==(vo=((J_=(Z_=(X_=(Q_=G[1].conf)==null?void 0:Q_.mqtt)==null?void 0:X_.ha)==null?void 0:Z_.title)!=null?J_:"Home-Assistant")+"")&&C(pa,vo),_e[0]&16&&Je(pl,G[4].q.m),(!Xe||_e[0]&2)&&ho!==(ho=((em=(x_=($_=G[1].conf)==null?void 0:$_.mqtt)==null?void 0:x_.publish)!=null?em:"Publish topic")+"")&&C(da,ho),_e[0]&16&&Un.value!==G[4].q.b&&be(Un,G[4].q.b),G[4].q.m==3?jl?jl.p(G,_e):(jl=P2(G),jl.c(),jl.m(l,va)):jl&&(jl.d(1),jl=null),G[4].q.m==4?Hl?Hl.p(G,_e):(Hl=E2(G),Hl.c(),Hl.m(l,ha)):Hl&&(Hl.d(1),Hl=null),G[4].c.es!=null?ol?(ol.p(G,_e),_e[0]&16&&Q(ol,1)):(ol=A2(G),ol.c(),Q(ol,1),ol.m(l,ba)):ol&&(pt(),ee(ol,1,1,()=>{ol=null}),dt()),_e[0]&16&&(ga=G[4].p.r.startsWith("NO")||G[4].p.r.startsWith("10YNO")||G[4].p.r.startsWith("10Y1001A1001A4")),ga?yl?yl.p(G,_e):(yl=O2(G),yl.c(),yl.m(l,ka)):yl&&(yl.d(1),yl=null),(!Xe||_e[0]&2)&&go!==(go=((nm=(lm=(tm=G[1].conf)==null?void 0:tm.ui)==null?void 0:lm.title)!=null?nm:"User interface")+"")&&C(wa,go),_e[0]&530){Zi=G[9];let Wt;for(Wt=0;Wt20||G[0].chip=="esp8266"||G[4].i.d.d>0?al?(al.p(G,_e),_e[0]&17&&Q(al,1)):(al=F2(G),al.c(),Q(al,1),al.m(l,Ca)):al&&(pt(),ee(al,1,1,()=>{al=null}),dt()),(!Xe||_e[0]&2)&&Mo!==(Mo=((um=(fm=(am=G[1].conf)==null?void 0:am.debug)==null?void 0:fm.title)!=null?um:"Debugging")+"")&&C(Na,Mo),_e[0]&16&&(cn.checked=G[4].d.s),(!Xe||_e[0]&2)&&Co!==(Co=((_m=(cm=(rm=G[1].conf)==null?void 0:rm.debug)==null?void 0:cm.enable)!=null?_m:"Enable debugging")+"")&&C(Ta,Co),G[4].d.s?zl?zl.p(G,_e):(zl=W2(G),zl.c(),zl.m(Xl,null)):zl&&(zl.d(1),zl=null),(!Xe||_e[0]&2)&&No!==(No=((pm=(mm=G[1].conf)==null?void 0:mm.btn_reset)!=null?pm:"Factory reset")+"")&&C(Ea,No),(!Xe||_e[0]&2)&&Po!==(Po=((vm=(dm=G[1].btn)==null?void 0:dm.reboot)!=null?vm:"Reboot")+"")&&C(Aa,Po),(!Xe||_e[0]&2)&&Ao!==(Ao=((bm=(hm=G[1].btn)==null?void 0:hm.save)!=null?bm:"Save")+"")&&C(Da,Ao);const bl={};_e[0]&4&&(bl.active=G[2]),_e[0]&2&&(bl.message=(wm=(km=(gm=G[1].conf)==null?void 0:gm.mask)==null?void 0:km.loading)!=null?wm:"Loading"),fi.$set(bl);const Fa={};_e[0]&8&&(Fa.active=G[3]),_e[0]&2&&(Fa.message=(Cm=(Sm=(Mm=G[1].conf)==null?void 0:Mm.mask)==null?void 0:Sm.saving)!=null?Cm:"Saving"),ui.$set(Fa);const Ba={};_e[0]&64&&(Ba.active=G[6]),_e[0]&2&&(Ba.message=(Pm=(Tm=(Nm=G[1].conf)==null?void 0:Nm.mask)==null?void 0:Tm.reset)!=null?Pm:"Factory reset"),ri.$set(Ba);const Ua={};_e[0]&128&&(Ua.active=G[7]),_e[0]&2&&(Ua.message=(Dm=(Am=(Em=G[1].conf)==null?void 0:Em.mask)==null?void 0:Am.reset_done)!=null?Dm:"Done"),ci.$set(Ua)},i(G){Xe||(Q(R.$$.fragment,G),Q(lt.$$.fragment,G),Q(Di.$$.fragment,G),Q(sl),Q(ol),Q(al),Q(fi.$$.fragment,G),Q(ui.$$.fragment,G),Q(ri.$$.fragment,G),Q(ci.$$.fragment,G),Xe=!0)},o(G){ee(R.$$.fragment,G),ee(lt.$$.fragment,G),ee(Di.$$.fragment,G),ee(sl),ee(ol),ee(al),ee(fi.$$.fragment,G),ee(ui.$$.fragment,G),ee(ri.$$.fragment,G),ee(ci.$$.fragment,G),Xe=!1},d(G){G&&T(t),Ce(R),Zl&&Zl.d(),Xt(Cs,G),Ce(lt),Dl&&Dl.d(),ql&&ql.d(),Mn.d(),Ol&&Ol.d(),Il&&Il.d(),Ll&&Ll.d(),Rl&&Rl.d(),Fl&&Fl.d(),Ce(Di),Bl&&Bl.d(),Ul&&Ul.d(),sl&&sl.d(),jl&&jl.d(),Hl&&Hl.d(),ol&&ol.d(),yl&&yl.d(),Xt(vl,G),Xt(hl,G),al&&al.d(),zl&&zl.d(),G&&T(qa),Ce(fi,G),G&&T(Oa),Ce(ui,G),G&&T(Ia),Ce(ri,G),G&&T(La),Ce(ci,G),Ra=!1,Et(Uu)}}}async function og(){await(await fetch("reboot",{method:"POST"})).json()}function ag(e,t,l){let{basepath:n="/"}=t,{sysinfo:i={}}=t,o={};Ml.subscribe(Ke=>{l(1,o=Ke)});let f=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],r=!0,c=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1,x:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0,lang:"en"},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,es:null}},_=[];Es.subscribe(Ke=>{var ne,Ue;Ke.version&&(l(4,a=Ke),l(2,r=!1),l(5,_=[{code:"en",name:"English"}]),a.u.lang&&a.u.lang!="en"&&_.push({code:a.u.lang,name:(Ue=(ne=o.language)==null?void 0:ne.name)!=null?Ue:"Unknown"}),_.push({code:"hub",name:"Load from server"}))}),S4();let p=!1,v=!1;async function d(){if(confirm("Factory reset?")){l(6,p=!0);const Ke=new URLSearchParams;Ke.append("perform","true");let Ue=await(await fetch("reset",{method:"POST",body:Ke})).json();l(6,p=!1),l(7,v=Ue.success)}}async function h(Ke){l(3,c=!0);const ne=new FormData(Ke.target),Ue=new URLSearchParams;for(let ut of ne){const[Yt,ll]=ut;Ue.append(Yt,ll)}let St=await(await fetch("save",{method:"POST",body:Ue})).json();wl.update(ut=>(ut.hostname=ne.get("gh"),ut.usrcfg=St.success,ut.booting=St.reboot,ne.get("nm")=="static"&&(ut.net.ip=ne.get("ni"),ut.net.mask=ne.get("nu"),ut.net.gw=ne.get("ng"),ut.net.dns1=ne.get("nd")),ut.ui=a.u,ut)),l(3,c=!1),hi(n)}const g=function(){confirm("Reboot?")&&(wl.update(Ke=>(Ke.booting=!0,Ke)),og())};async function M(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Es.update(ne=>(ne.q.s.c=!1,ne)))}async function A(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Es.update(ne=>(ne.q.s.r=!1,ne)))}async function I(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Es.update(ne=>(ne.q.s.k=!1,ne)))}const q=function(){a.q.s.e?a.q.p==1883&&l(4,a.q.p=8883,a):a.q.p==8883&&l(4,a.q.p=1883,a)};async function L(){if(a.u.lang=="hub"){const Ke=await pn("http://hub.amsleser.no/hub/language/list.json");l(5,_=await Ke.json()),l(4,a.u.lang=o.language.code,a)}}let O=44;function U(){a.g.h=this.value,l(4,a)}function E(){a.g.t=Ft(this),l(4,a)}function B(){a.p.r=Ft(this),l(4,a)}function z(){a.p.c=Ft(this),l(4,a)}function W(){a.p.e=this.checked,l(4,a)}function F(){a.p.t=this.value,l(4,a)}function R(){a.g.s=Ft(this),l(4,a)}function K(){a.g.u=this.value,l(4,a)}function y(){a.g.p=this.value,l(4,a)}function H(){a.g.c=this.value,l(4,a)}function Y(){a.m.a=Ft(this),l(4,a)}function X(){a.m.b=Ze(this.value),l(4,a)}function J(){a.m.i=this.checked,l(4,a)}function $(){a.m.b=Ft(this),l(4,a)}function ce(){a.m.p=Ft(this),l(4,a)}function ie(){a.m.s=Ze(this.value),l(4,a)}function oe(){a.m.d=Ft(this),l(4,a)}function ae(){a.m.f=Ze(this.value),l(4,a)}function se(){a.m.r=Ze(this.value),l(4,a)}function x(){a.m.e.e=this.checked,l(4,a)}function me(){a.m.e.k=this.value,l(4,a)}function pe(){a.m.e.a=this.value,l(4,a)}function V(){a.m.m.e=this.checked,l(4,a)}function Z(){a.m.m.w=Ze(this.value),l(4,a)}function ge(){a.m.m.v=Ze(this.value),l(4,a)}function ve(){a.m.m.a=Ze(this.value),l(4,a)}function S(){a.m.m.c=Ze(this.value),l(4,a)}function w(){a.n.c=Ft(this),l(4,a)}function N(){a.w.s=this.value,l(4,a)}function D(){a.w.p=this.value,l(4,a)}function j(){a.w.z=Ft(this),l(4,a)}function te(){a.w.w=Ze(this.value),l(4,a)}function le(){a.w.b=this.checked,l(4,a)}function fe(){a.n.m=Ft(this),l(4,a)}function de(){a.n.i=this.value,l(4,a)}function qe(){a.n.s=Ft(this),l(4,a)}function Pe(){a.n.g=this.value,l(4,a)}function we(){a.n.d1=this.value,l(4,a)}function Fe(){a.n.d2=this.value,l(4,a)}function Ae(){a.n.x=this.checked,l(4,a)}function ke(){a.n.d=this.checked,l(4,a)}function De(){a.n.h=this.checked,l(4,a)}function He(){a.n.n1=this.value,l(4,a)}function Oe(){a.q.s.e=this.checked,l(4,a)}function je(){a.q.h=this.value,l(4,a)}function Ye(){a.q.p=Ze(this.value),l(4,a)}function We(){a.q.u=this.value,l(4,a)}function $e(){a.q.a=this.value,l(4,a)}function xe(){a.q.c=this.value,l(4,a)}function tt(){a.q.m=Ft(this),l(4,a)}function Te(){a.q.b=this.value,l(4,a)}function ue(){a.o.e=this.value,l(4,a)}function Ie(){a.o.c=this.value,l(4,a)}function kt(){a.o.u1=this.value,l(4,a)}function lt(){a.o.u2=this.value,l(4,a)}function wt(){a.o.u3=this.value,l(4,a)}function st(){a.h.t=this.value,l(4,a)}function ot(){a.h.h=this.value,l(4,a)}function et(){a.h.n=this.value,l(4,a)}function Nt(){a.c.e=this.checked,l(4,a)}function gt(){a.c.es=this.checked,l(4,a)}function At(Ke){a.t.t[Ke]=Ze(this.value),l(4,a)}function Pt(){a.t.h=Ze(this.value),l(4,a)}function Be(Ke){a.u[Ke.key]=Ft(this),l(4,a)}function ye(){a.u.lang=Ft(this),l(4,a)}function It(){a.i.h.p=Ft(this),l(4,a)}function vt(){a.i.h.t=Ft(this),l(4,a)}function nt(){a.i.h.u=this.checked,l(4,a)}function Tt(){a.i.a=Ze(this.value),l(4,a)}function it(){a.i.l.p=Ze(this.value),l(4,a)}function at(){a.i.l.i=this.checked,l(4,a)}function rt(){a.i.r.i=this.checked,l(4,a)}function jt(){a.i.r.r=Ze(this.value),l(4,a)}function Lt(){a.i.r.g=Ze(this.value),l(4,a)}function Ht(){a.i.r.b=Ze(this.value),l(4,a)}function yt(){a.i.d.d=Ze(this.value),l(4,a)}function Me(){a.i.t.d=Ze(this.value),l(4,a)}function Ve(){a.i.t.a=Ze(this.value),l(4,a)}function Rt(){a.i.v.p=Ze(this.value),l(4,a)}function Gt(){a.i.v.d.v=Ze(this.value),l(4,a)}function zt(){a.i.v.d.g=Ze(this.value),l(4,a)}function Dt(){a.i.d.b=Ft(this),l(4,a)}function Kt(){a.i.v.o=Ze(this.value),l(4,a)}function Zt(){a.i.v.m=Ze(this.value),l(4,a)}function tl(){a.i.v.b=Ze(this.value),l(4,a)}function Jt(){a.d.s=this.checked,l(4,a)}function ft(){a.d.t=this.checked,l(4,a)}function Mt(){a.d.l=Ft(this),l(4,a)}return e.$$set=Ke=>{"basepath"in Ke&&l(18,n=Ke.basepath),"sysinfo"in Ke&&l(0,i=Ke.sysinfo)},e.$$.update=()=>{e.$$.dirty[0]&1&&l(8,O=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,o,r,c,a,_,p,v,O,f,d,h,g,M,A,I,q,L,n,U,E,B,z,W,F,R,K,y,H,Y,X,J,$,ce,ie,oe,ae,se,x,me,pe,V,Z,ge,ve,S,w,N,D,j,te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt,Te,ue,Ie,kt,lt,wt,st,ot,et,Nt,gt,At,Pt,Be,ye,It,vt,nt,Tt,it,at,rt,jt,Lt,Ht,yt,Me,Ve,Rt,Gt,zt,Dt,Kt,Zt,tl,Jt,ft,Mt]}class fg extends mt{constructor(t){super(),_t(this,t,ag,sg,ct,{basepath:18,sysinfo:0},null,[-1,-1,-1,-1])}}function V2(e,t,l){const n=e.slice();return n[22]=t[l],n}function ug(e){let t=Ge(e[1].chip,e[1].board)+"",l;return{c(){l=k(t)},m(n,i){P(n,l,i)},p(n,i){i&2&&t!==(t=Ge(n[1].chip,n[1].board)+"")&&C(l,t)},d(n){n&&T(l)}}}function K2(e){var Y,X,J,$,ce,ie,oe,ae,se,x,me,pe;let t,l=((J=(X=(Y=e[3].status)==null?void 0:Y.device)==null?void 0:X.apmac)!=null?J:"AP MAC")+"",n,i,o=e[1].apmac+"",f,r,c,a=((ie=(ce=($=e[3].status)==null?void 0:$.device)==null?void 0:ce.last_boot)!=null?ie:"Last boot")+"",_,p,v,d,h,g,M=((se=(ae=(oe=e[3].status)==null?void 0:oe.device)==null?void 0:ae.reason)!=null?se:"Reason")+"",A,I,q=((pe=(me=(x=e[3][Km(e[1].chip)])==null?void 0:x.reason)==null?void 0:me[e[1].boot_reason])!=null?pe:e[1].boot_reason)+"",L,O,U=e[1].boot_reason+"",E,B,z=e[1].ex_cause+"",W,F,R;const K=[cg,rg],y=[];function H(V,Z){return V[0].u>0?0:1}return v=H(e),d=y[v]=K[v](e),{c(){t=m("div"),n=k(l),i=k(": "),f=k(o),r=b(),c=m("div"),_=k(a),p=k(`: + `),d.c(),h=b(),g=m("div"),A=k(M),I=k(": "),L=k(q),O=k(" ("),E=k(U),B=k("/"),W=k(z),F=k(")"),u(t,"class","my-2"),u(c,"class","my-2"),u(g,"class","my-2")},m(V,Z){P(V,t,Z),s(t,n),s(t,i),s(t,f),P(V,r,Z),P(V,c,Z),s(c,_),s(c,p),y[v].m(c,null),P(V,h,Z),P(V,g,Z),s(g,A),s(g,I),s(g,L),s(g,O),s(g,E),s(g,B),s(g,W),s(g,F),R=!0},p(V,Z){var ve,S,w,N,D,j,te,le,fe,de,qe,Pe;(!R||Z&8)&&l!==(l=((w=(S=(ve=V[3].status)==null?void 0:ve.device)==null?void 0:S.apmac)!=null?w:"AP MAC")+"")&&C(n,l),(!R||Z&2)&&o!==(o=V[1].apmac+"")&&C(f,o),(!R||Z&8)&&a!==(a=((j=(D=(N=V[3].status)==null?void 0:N.device)==null?void 0:D.last_boot)!=null?j:"Last boot")+"")&&C(_,a);let ge=v;v=H(V),v===ge?y[v].p(V,Z):(pt(),ee(y[ge],1,1,()=>{y[ge]=null}),dt(),d=y[v],d?d.p(V,Z):(d=y[v]=K[v](V),d.c()),Q(d,1),d.m(c,null)),(!R||Z&8)&&M!==(M=((fe=(le=(te=V[3].status)==null?void 0:te.device)==null?void 0:le.reason)!=null?fe:"Reason")+"")&&C(A,M),(!R||Z&10)&&q!==(q=((Pe=(qe=(de=V[3][Km(V[1].chip)])==null?void 0:de.reason)==null?void 0:qe[V[1].boot_reason])!=null?Pe:V[1].boot_reason)+"")&&C(L,q),(!R||Z&2)&&U!==(U=V[1].boot_reason+"")&&C(E,U),(!R||Z&2)&&z!==(z=V[1].ex_cause+"")&&C(W,z)},i(V){R||(Q(d),R=!0)},o(V){ee(d),R=!1},d(V){V&&T(t),V&&T(r),V&&T(c),y[v].d(),V&&T(h),V&&T(g)}}}function rg(e){let t;return{c(){t=k("-")},m(l,n){P(l,t,n)},p:ze,i:ze,o:ze,d(l){l&&T(t)}}}function cg(e){let t,l;return t=new Ev({props:{timestamp:new Date(new Date().getTime()-e[0].u*1e3),fullTimeColor:""}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function _g(e){var i,o,f;let t,l=((f=(o=(i=e[3].status)==null?void 0:i.device)==null?void 0:o.btn_consents)!=null?f:"Consents")+"",n;return{c(){t=m("span"),n=k(l),u(t,"class","btn-pri-sm")},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c&8&&l!==(l=((p=(_=(a=r[3].status)==null?void 0:a.device)==null?void 0:_.btn_consents)!=null?p:"Consents")+"")&&C(n,l)},d(r){r&&T(t)}}}function Y2(e){var W,F,R,K,y,H,Y,X,J,$,ce,ie;let t,l,n=((R=(F=(W=e[3].status)==null?void 0:W.meter)==null?void 0:F.title)!=null?R:"Meter")+"",i,o,f,r=((H=(y=(K=e[3].status)==null?void 0:K.meter)==null?void 0:y.manufacturer)!=null?H:"Manufacturer")+"",c,a,_=Go(e[1].meter.mfg)+"",p,v,d,h=((J=(X=(Y=e[3].status)==null?void 0:Y.meter)==null?void 0:X.model)!=null?J:"Model")+"",g,M,A=(e[1].meter.model?e[1].meter.model:"unknown")+"",I,q,L,O=((ie=(ce=($=e[3].status)==null?void 0:$.meter)==null?void 0:ce.id)!=null?ie:"ID")+"",U,E,B=(e[1].meter.id?e[1].meter.id:"unknown")+"",z;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("div"),c=k(r),a=k(": "),p=k(_),v=b(),d=m("div"),g=k(h),M=k(": "),I=k(A),q=b(),L=m("div"),U=k(O),E=k(": "),z=k(B),u(l,"class","text-sm"),u(f,"class","my-2"),u(d,"class","my-2"),u(L,"class","my-2"),u(t,"class","cnt")},m(oe,ae){P(oe,t,ae),s(t,l),s(l,i),s(t,o),s(t,f),s(f,c),s(f,a),s(f,p),s(t,v),s(t,d),s(d,g),s(d,M),s(d,I),s(t,q),s(t,L),s(L,U),s(L,E),s(L,z)},p(oe,ae){var se,x,me,pe,V,Z,ge,ve,S,w,N,D;ae&8&&n!==(n=((me=(x=(se=oe[3].status)==null?void 0:se.meter)==null?void 0:x.title)!=null?me:"Meter")+"")&&C(i,n),ae&8&&r!==(r=((Z=(V=(pe=oe[3].status)==null?void 0:pe.meter)==null?void 0:V.manufacturer)!=null?Z:"Manufacturer")+"")&&C(c,r),ae&2&&_!==(_=Go(oe[1].meter.mfg)+"")&&C(p,_),ae&8&&h!==(h=((S=(ve=(ge=oe[3].status)==null?void 0:ge.meter)==null?void 0:ve.model)!=null?S:"Model")+"")&&C(g,h),ae&2&&A!==(A=(oe[1].meter.model?oe[1].meter.model:"unknown")+"")&&C(I,A),ae&8&&O!==(O=((D=(N=(w=oe[3].status)==null?void 0:w.meter)==null?void 0:N.id)!=null?D:"ID")+"")&&C(U,O),ae&2&&B!==(B=(oe[1].meter.id?oe[1].meter.id:"unknown")+"")&&C(z,B)},d(oe){oe&&T(t)}}}function Q2(e){var X,J,$,ce,ie,oe,ae,se,x,me,pe,V;let t,l,n=(($=(J=(X=e[3].status)==null?void 0:X.network)==null?void 0:J.title)!=null?$:"Network")+"",i,o,f,r=((oe=(ie=(ce=e[3].conf)==null?void 0:ce.network)==null?void 0:ie.ip)!=null?oe:"IP")+"",c,a,_=e[1].net.ip+"",p,v,d,h=((x=(se=(ae=e[3].conf)==null?void 0:ae.network)==null?void 0:se.mask)!=null?x:"Mask")+"",g,M,A=e[1].net.mask+"",I,q,L,O=((V=(pe=(me=e[3].conf)==null?void 0:me.network)==null?void 0:pe.gw)!=null?V:"Gateway")+"",U,E,B=e[1].net.gw+"",z,W,F,R,K,y=e[1].net.dns1&&X2(e),H=e[1].net.dns2&&Z2(e),Y=e[1].net.ipv6&&J2(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("div"),c=k(r),a=k(": "),p=k(_),v=b(),d=m("div"),g=k(h),M=k(": "),I=k(A),q=b(),L=m("div"),U=k(O),E=k(": "),z=k(B),W=b(),F=m("div"),y&&y.c(),R=b(),H&&H.c(),K=b(),Y&&Y.c(),u(l,"class","text-sm"),u(f,"class","my-2"),u(d,"class","my-2"),u(L,"class","my-2"),u(F,"class","my-2"),u(t,"class","cnt")},m(Z,ge){P(Z,t,ge),s(t,l),s(l,i),s(t,o),s(t,f),s(f,c),s(f,a),s(f,p),s(t,v),s(t,d),s(d,g),s(d,M),s(d,I),s(t,q),s(t,L),s(L,U),s(L,E),s(L,z),s(t,W),s(t,F),y&&y.m(F,null),s(F,R),H&&H.m(F,null),s(t,K),Y&&Y.m(t,null)},p(Z,ge){var ve,S,w,N,D,j,te,le,fe,de,qe,Pe;ge&8&&n!==(n=((w=(S=(ve=Z[3].status)==null?void 0:ve.network)==null?void 0:S.title)!=null?w:"Network")+"")&&C(i,n),ge&8&&r!==(r=((j=(D=(N=Z[3].conf)==null?void 0:N.network)==null?void 0:D.ip)!=null?j:"IP")+"")&&C(c,r),ge&2&&_!==(_=Z[1].net.ip+"")&&C(p,_),ge&8&&h!==(h=((fe=(le=(te=Z[3].conf)==null?void 0:te.network)==null?void 0:le.mask)!=null?fe:"Mask")+"")&&C(g,h),ge&2&&A!==(A=Z[1].net.mask+"")&&C(I,A),ge&8&&O!==(O=((Pe=(qe=(de=Z[3].conf)==null?void 0:de.network)==null?void 0:qe.gw)!=null?Pe:"Gateway")+"")&&C(U,O),ge&2&&B!==(B=Z[1].net.gw+"")&&C(z,B),Z[1].net.dns1?y?y.p(Z,ge):(y=X2(Z),y.c(),y.m(F,R)):y&&(y.d(1),y=null),Z[1].net.dns2?H?H.p(Z,ge):(H=Z2(Z),H.c(),H.m(F,null)):H&&(H.d(1),H=null),Z[1].net.ipv6?Y?Y.p(Z,ge):(Y=J2(Z),Y.c(),Y.m(t,null)):Y&&(Y.d(1),Y=null)},d(Z){Z&&T(t),y&&y.d(),H&&H.d(),Y&&Y.d()}}}function X2(e){var f,r,c;let t=((c=(r=(f=e[3].conf)==null?void 0:f.network)==null?void 0:r.dns)!=null?c:"DNS")+"",l,n,i=e[1].net.dns1+"",o;return{c(){l=k(t),n=k(": "),o=k(i)},m(a,_){P(a,l,_),P(a,n,_),P(a,o,_)},p(a,_){var p,v,d;_&8&&t!==(t=((d=(v=(p=a[3].conf)==null?void 0:p.network)==null?void 0:v.dns)!=null?d:"DNS")+"")&&C(l,t),_&2&&i!==(i=a[1].net.dns1+"")&&C(o,i)},d(a){a&&T(l),a&&T(n),a&&T(o)}}}function Z2(e){var f,r,c;let t=((c=(r=(f=e[3].conf)==null?void 0:f.network)==null?void 0:r.dns)!=null?c:"DNS")+"",l,n,i=e[1].net.dns2+"",o;return{c(){l=k(t),n=k(": "),o=k(i)},m(a,_){P(a,l,_),P(a,n,_),P(a,o,_)},p(a,_){var p,v,d;_&8&&t!==(t=((d=(v=(p=a[3].conf)==null?void 0:p.network)==null?void 0:v.dns)!=null?d:"DNS")+"")&&C(l,t),_&2&&i!==(i=a[1].net.dns2+"")&&C(o,i)},d(a){a&&T(l),a&&T(n),a&&T(o)}}}function J2(e){let t,l,n=e[1].net.ipv6+"",i,o,f,r,c=e[1].net.dns1v6&&$2(e),a=e[1].net.dns2v6&&x2(e);return{c(){t=m("div"),l=k("IPv6: "),i=k(n),o=b(),f=m("div"),c&&c.c(),r=b(),a&&a.c(),u(t,"class","my-2"),u(f,"class","my-2")},m(_,p){P(_,t,p),s(t,l),s(t,i),P(_,o,p),P(_,f,p),c&&c.m(f,null),s(f,r),a&&a.m(f,null)},p(_,p){p&2&&n!==(n=_[1].net.ipv6+"")&&C(i,n),_[1].net.dns1v6?c?c.p(_,p):(c=$2(_),c.c(),c.m(f,r)):c&&(c.d(1),c=null),_[1].net.dns2v6?a?a.p(_,p):(a=x2(_),a.c(),a.m(f,null)):a&&(a.d(1),a=null)},d(_){_&&T(t),_&&T(o),_&&T(f),c&&c.d(),a&&a.d()}}}function $2(e){let t,l=e[1].net.dns1v6+"",n;return{c(){t=k("DNSv6: "),n=k(l)},m(i,o){P(i,t,o),P(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns1v6+"")&&C(n,l)},d(i){i&&T(t),i&&T(n)}}}function x2(e){let t,l=e[1].net.dns2v6+"",n;return{c(){t=k("DNSv6: "),n=k(l)},m(i,o){P(i,t,o),P(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2v6+"")&&C(n,l)},d(i){i&&T(t),i&&T(n)}}}function ed(e){var c,a,_,p,v,d;let t,l,n=((_=(a=(c=e[3].status)==null?void 0:c.firmware)==null?void 0:a.failed)!=null?_:"Upgrade from {0} to {1} failed").replace("{0}",e[1].upgrade.f).replace("{1}",e[1].upgrade.t)+"",i,o,f=((d=(v=(p=e[3].errors)==null?void 0:p.http)==null?void 0:v[e[1].upgrade.e])!=null?d:e[1].upgrade.e)+"",r;return{c(){t=m("div"),l=m("div"),i=k(n),o=b(),r=k(f),u(l,"class","bd-yellow"),u(t,"class","my-2")},m(h,g){P(h,t,g),s(t,l),s(l,i),s(l,o),s(l,r)},p(h,g){var M,A,I,q,L,O;g&10&&n!==(n=((I=(A=(M=h[3].status)==null?void 0:M.firmware)==null?void 0:A.failed)!=null?I:"Upgrade from {0} to {1} failed").replace("{0}",h[1].upgrade.f).replace("{1}",h[1].upgrade.t)+"")&&C(i,n),g&10&&f!==(f=((O=(L=(q=h[3].errors)==null?void 0:q.http)==null?void 0:L[h[1].upgrade.e])!=null?O:h[1].upgrade.e)+"")&&C(r,f)},d(h){h&&T(t)}}}function td(e){var h,g,M;let t,l=((M=(g=(h=e[3].status)==null?void 0:h.firmware)==null?void 0:g.latest)!=null?M:"Latest")+"",n,i,o,f=e[4].tag_name+"",r,c,a,_,p,v=(e[1].security==0||e[0].a)&&e[1].fwconsent===1&&e[4]&&e[4].tag_name!=e[1].version&&ld(e),d=e[1].fwconsent===2&&nd(e);return{c(){t=m("div"),n=k(l),i=k(`: + `),o=m("a"),r=k(f),a=b(),v&&v.c(),_=b(),d&&d.c(),p=Ut(),u(o,"href",c=e[4].html_url),u(o,"class","ml-2 text-blue-600 hover:text-blue-800"),u(o,"target","_blank"),u(o,"rel","noreferrer"),u(t,"class","my-2 flex")},m(A,I){P(A,t,I),s(t,n),s(t,i),s(t,o),s(o,r),s(t,a),v&&v.m(t,null),P(A,_,I),d&&d.m(A,I),P(A,p,I)},p(A,I){var q,L,O;I&8&&l!==(l=((O=(L=(q=A[3].status)==null?void 0:q.firmware)==null?void 0:L.latest)!=null?O:"Latest")+"")&&C(n,l),I&16&&f!==(f=A[4].tag_name+"")&&C(r,f),I&16&&c!==(c=A[4].html_url)&&u(o,"href",c),(A[1].security==0||A[0].a)&&A[1].fwconsent===1&&A[4]&&A[4].tag_name!=A[1].version?v?v.p(A,I):(v=ld(A),v.c(),v.m(t,null)):v&&(v.d(1),v=null),A[1].fwconsent===2?d?d.p(A,I):(d=nd(A),d.c(),d.m(p.parentNode,p)):d&&(d.d(1),d=null)},d(A){A&&T(t),v&&v.d(),A&&T(_),d&&d.d(A),A&&T(p)}}}function ld(e){let t,l,n,i,o;return{c(){var f,r,c;t=m("div"),l=m("button"),l.textContent="\u21D3",u(t,"class","flex-none ml-2 text-green-500"),u(t,"title",n=(c=(r=(f=e[3].status)==null?void 0:f.firmware)==null?void 0:r.install)!=null?c:"Install")},m(f,r){P(f,t,r),s(t,l),i||(o=re(l,"click",e[11]),i=!0)},p(f,r){var c,a,_;r&8&&n!==(n=(_=(a=(c=f[3].status)==null?void 0:c.firmware)==null?void 0:a.install)!=null?_:"Install")&&u(t,"title",n)},d(f){f&&T(t),i=!1,o()}}}function nd(e){var o,f,r;let t,l,n=((r=(f=(o=e[3].status)==null?void 0:o.firmware)==null?void 0:f.no_one_click)!=null?r:"One-click upgrade disabled")+"",i;return{c(){t=m("div"),l=m("div"),i=k(n),u(l,"class","bd-yellow"),u(t,"class","my-2")},m(c,a){P(c,t,a),s(t,l),s(l,i)},p(c,a){var _,p,v;a&8&&n!==(n=((v=(p=(_=c[3].status)==null?void 0:_.firmware)==null?void 0:p.no_one_click)!=null?v:"One-click upgrade disabled")+"")&&C(i,n)},d(c){c&&T(t)}}}function id(e){let t,l=Vo(Ge(e[1].chip,e[1].board))+"",n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(i,o){P(i,t,o),s(t,n)},p(i,o){o&2&&l!==(l=Vo(Ge(i[1].chip,i[1].board))+"")&&C(n,l)},d(i){i&&T(t)}}}function sd(e){let t,l,n,i,o,f;function r(_,p){return _[6].length==0?pg:mg}let c=r(e),a=c(e);return{c(){t=m("div"),l=m("form"),n=m("input"),i=b(),a.c(),As(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(t,"class","my-2 flex")},m(_,p){P(_,t,p),s(t,l),s(l,n),e[14](n),s(l,i),a.m(l,null),o||(f=[re(n,"change",e[15]),re(l,"submit",e[17])],o=!0)},p(_,p){c===(c=r(_))&&a?a.p(_,p):(a.d(1),a=c(_),a&&(a.c(),a.m(l,null)))},d(_){_&&T(t),e[14](null),a.d(),o=!1,Et(f)}}}function mg(e){var r,c;let t=e[6][0].name+"",l,n,i,o=((c=(r=e[3].btn)==null?void 0:r.upload)!=null?c:"Upload")+"",f;return{c(){l=k(t),n=b(),i=m("button"),f=k(o),u(i,"type","submit"),u(i,"class","btn-pri-sm float-right ml-2")},m(a,_){P(a,l,_),P(a,n,_),P(a,i,_),s(i,f)},p(a,_){var p,v;_&64&&t!==(t=a[6][0].name+"")&&C(l,t),_&8&&o!==(o=((v=(p=a[3].btn)==null?void 0:p.upload)!=null?v:"Upload")+"")&&C(f,o)},d(a){a&&T(l),a&&T(n),a&&T(i)}}}function pg(e){var f,r,c;let t,l=((c=(r=(f=e[3].status)==null?void 0:f.firmware)==null?void 0:r.btn_select_file)!=null?c:"Select file")+"",n,i,o;return{c(){t=m("button"),n=k(l),u(t,"type","button"),u(t,"class","btn-pri-sm float-right")},m(a,_){P(a,t,_),s(t,n),i||(o=re(t,"click",e[16]),i=!0)},p(a,_){var p,v,d;_&8&&l!==(l=((d=(v=(p=a[3].status)==null?void 0:p.firmware)==null?void 0:v.btn_select_file)!=null?d:"Select file")+"")&&C(n,l)},d(a){a&&T(t),i=!1,o()}}}function od(e){var H,Y,X,J,$,ce,ie,oe,ae;let t,l,n=((X=(Y=(H=e[3].status)==null?void 0:H.backup)==null?void 0:Y.title)!=null?X:"Backup")+"",i,o,f,r,c,a,_,p,v=((ce=($=(J=e[3].status)==null?void 0:J.backup)==null?void 0:$.secrets)!=null?ce:"Include secrets")+"",d,h,g,M=((ae=(oe=(ie=e[3].status)==null?void 0:ie.backup)==null?void 0:oe.secrets_desc)!=null?ae:"")+"",A,I,q,L,O,U,E,B,z=e[10],W=[];for(let se=0;se{Oe=null}),dt());const Gt={};Ve&33554440&&(Gt.$$scope={dirty:Ve,ctx:Me}),X.$set(Gt),(!ke||Ve&8)&&ce!==(ce=((Yt=(ut=Me[3].btn)==null?void 0:ut.reboot)!=null?Yt:"Reboot")+"")&&C(ie,ce),Me[1].meter?je?je.p(Me,Ve):(je=Y2(Me),je.c(),je.m(t,ae)):je&&(je.d(1),je=null),Me[1].net?Ye?Ye.p(Me,Ve):(Ye=Q2(Me),Ye.c(),Ye.m(t,se)):Ye&&(Ye.d(1),Ye=null),(!ke||Ve&8)&&pe!==(pe=((ul=(fl=(ll=Me[3].status)==null?void 0:ll.firmware)==null?void 0:fl.title)!=null?ul:"Firmware")+"")&&C(V,pe),(!ke||Ve&8)&&ve!==(ve=((Cl=(rl=(Sl=Me[3].status)==null?void 0:Sl.firmware)==null?void 0:rl.installed)!=null?Cl:"Installed")+"")&&C(S,ve),(!ke||Ve&2)&&N!==(N=Me[1].version+"")&&C(D,N),Me[1].upgrade.t&&Me[1].upgrade.t!=Me[1].version?We?We.p(Me,Ve):(We=ed(Me),We.c(),We.m(x,te)):We&&(We.d(1),We=null),Me[4]?$e?$e.p(Me,Ve):($e=td(Me),$e.c(),$e.m(x,le)):$e&&($e.d(1),$e=null),Ve&3&&(fe=(Me[1].security==0||Me[0].a)&&ns(Me[1].board)),fe?xe?xe.p(Me,Ve):(xe=id(Me),xe.c(),xe.m(x,de)):xe&&(xe.d(1),xe=null),Me[1].security==0||Me[0].a?tt?tt.p(Me,Ve):(tt=sd(Me),tt.c(),tt.m(x,null)):tt&&(tt.d(1),tt=null),Me[1].security==0||Me[0].a?Te?Te.p(Me,Ve):(Te=od(Me),Te.c(),Te.m(t,null)):Te&&(Te.d(1),Te=null);const zt={};Ve&128&&(zt.active=Me[7]),Ve&8&&(zt.message=(dl=(_l=(nl=Me[3].status)==null?void 0:nl.mask)==null?void 0:_l.firmware)!=null?dl:"Uploading"),we.$set(zt);const Dt={};Ve&512&&(Dt.active=Me[9]),Ve&8&&(Dt.message=(Qt=(Tl=(Nl=Me[3].status)==null?void 0:Nl.mask)==null?void 0:Tl.config)!=null?Qt:"Uploading"),Ae.$set(Dt)},i(Me){ke||(Q(U.$$.fragment,Me),Q(Oe),Q(X.$$.fragment,Me),Q(we.$$.fragment,Me),Q(Ae.$$.fragment,Me),ke=!0)},o(Me){ee(U.$$.fragment,Me),ee(Oe),ee(X.$$.fragment,Me),ee(we.$$.fragment,Me),ee(Ae.$$.fragment,Me),ke=!1},d(Me){Me&&T(t),Ce(U),Oe&&Oe.d(),Ce(X),je&&je.d(),Ye&&Ye.d(),We&&We.d(),$e&&$e.d(),xe&&xe.d(),tt&&tt.d(),Te&&Te.d(),Me&&T(Pe),Ce(we,Me),Me&&T(Fe),Ce(Ae,Me),De=!1,He()}}}async function bg(){await(await fetch("reboot",{method:"POST"})).json()}function gg(e,t,l){let{data:n}=t,{sysinfo:i}=t,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price",key:"is"}],f={};Ml.subscribe(z=>{l(3,f=z)});let r={};Cf.subscribe(z=>{l(4,r=Pv(i.version,z)),r||l(4,r=z[0])});function c(){var z,W;confirm(((W=(z=f.header)==null?void 0:z.upgrade)!=null?W:"Upgrade to {0}?").replace("{0}",r.tag_name))&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Vo(Ge(i.chip,i.board))))&&(wl.update(F=>(F.upgrading=!0,F)),Tv(r.tag_name))}const a=function(){var z,W;confirm((W=(z=f.device)==null?void 0:z.reboot_confirm)!=null?W:"Reboot?")&&(wl.update(F=>(F.booting=!0,F)),bg())};let _,p=[],v=!1,d,h=[],g=!1;kf();let M={hostname:"",ip:""};function A(z){l(9,g=!0);const W=new FormData;W.append("file",h[0]),fetch("/configfile",{method:"POST",body:W}).then(F=>F.json()).then(F=>{wl.update(R=>(M&&M.hostname&&(R.hostname=M.hostname),R.booting=F.reboot,M&&M.ip&&(R.net.ip=M.ip),setTimeout(Ls,5e3,i),R))}).catch(F=>{console.error("Error:",F),setTimeout(Ls,5e3,i)})}function I(z){zo[z?"unshift":"push"](()=>{_=z,l(5,_)})}function q(){p=this.files,l(6,p)}const L=()=>{_.click()},O=()=>l(7,v=!0);function U(z){zo[z?"unshift":"push"](()=>{d=z,l(8,d)})}function E(){h=this.files,l(2,h)}const B=()=>{d.click()};return e.$$set=z=>{"data"in z&&l(0,n=z.data),"sysinfo"in z&&l(1,i=z.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&4&&h.length==1){let z=h[0],W=new FileReader,F=R=>{let K=R.target.result.split(` +`);for(let y in K){let H=K[y];H.startsWith("hostname ")?M.hostname=H.split(" ")[1]:H.startsWith("ip ")&&(M.ip=H.split(" ")[1])}};W.onload=F,W.readAsText(z)}},[n,i,h,f,r,_,p,v,d,g,o,c,a,A,I,q,L,O,U,E,B]}class kg extends mt{constructor(t){super(),_t(this,t,gg,hg,ct,{data:0,sysinfo:1})}}function ud(e){let t,l,n=Ge(e[0],7)+"",i,o,f=Ge(e[0],5)+"",r,c,a=Ge(e[0],4)+"",_,p,v=Ge(e[0],3)+"",d,h,g,M,A=Ge(e[0],2)+"",I,q,L=Ge(e[0],1)+"",O,U,E=Ge(e[0],0)+"",B,z,W,F,R=Ge(e[0],101)+"",K,y,H=Ge(e[0],100)+"",Y;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=m("option"),r=k(f),c=m("option"),_=k(a),p=m("option"),d=k(v),h=b(),g=m("optgroup"),M=m("option"),I=k(A),q=m("option"),O=k(L),U=m("option"),B=k(E),z=b(),W=m("optgroup"),F=m("option"),K=k(R),y=m("option"),Y=k(H),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,u(t,"label","amsleser.no"),M.__value=2,M.value=M.__value,q.__value=1,q.value=q.__value,U.__value=0,U.value=U.__value,u(g,"label","Custom hardware"),F.__value=101,F.value=F.__value,y.__value=100,y.value=y.__value,u(W,"label","Generic hardware")},m(X,J){P(X,t,J),s(t,l),s(l,i),s(t,o),s(o,r),s(t,c),s(c,_),s(t,p),s(p,d),P(X,h,J),P(X,g,J),s(g,M),s(M,I),s(g,q),s(q,O),s(g,U),s(U,B),P(X,z,J),P(X,W,J),s(W,F),s(F,K),s(W,y),s(y,Y)},p(X,J){J&1&&n!==(n=Ge(X[0],7)+"")&&C(i,n),J&1&&f!==(f=Ge(X[0],5)+"")&&C(r,f),J&1&&a!==(a=Ge(X[0],4)+"")&&C(_,a),J&1&&v!==(v=Ge(X[0],3)+"")&&C(d,v),J&1&&A!==(A=Ge(X[0],2)+"")&&C(I,A),J&1&&L!==(L=Ge(X[0],1)+"")&&C(O,L),J&1&&E!==(E=Ge(X[0],0)+"")&&C(B,E),J&1&&R!==(R=Ge(X[0],101)+"")&&C(K,R),J&1&&H!==(H=Ge(X[0],100)+"")&&C(Y,H)},d(X){X&&T(t),X&&T(h),X&&T(g),X&&T(z),X&&T(W)}}}function rd(e){let t,l,n=Ge(e[0],201)+"",i,o,f=Ge(e[0],202)+"",r,c,a=Ge(e[0],203)+"",_,p,v=Ge(e[0],241)+"",d,h,g=Ge(e[0],242)+"",M,A,I=Ge(e[0],243)+"",q,L,O=Ge(e[0],200)+"",U;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=m("option"),r=k(f),c=m("option"),_=k(a),p=m("option"),d=k(v),h=m("option"),M=k(g),A=m("option"),q=k(I),L=m("option"),U=k(O),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,p.__value=241,p.value=p.__value,h.__value=242,h.value=h.__value,A.__value=243,A.value=A.__value,L.__value=200,L.value=L.__value,u(t,"label","Generic hardware")},m(E,B){P(E,t,B),s(t,l),s(l,i),s(t,o),s(o,r),s(t,c),s(c,_),s(t,p),s(p,d),s(t,h),s(h,M),s(t,A),s(A,q),s(t,L),s(L,U)},p(E,B){B&1&&n!==(n=Ge(E[0],201)+"")&&C(i,n),B&1&&f!==(f=Ge(E[0],202)+"")&&C(r,f),B&1&&a!==(a=Ge(E[0],203)+"")&&C(_,a),B&1&&v!==(v=Ge(E[0],241)+"")&&C(d,v),B&1&&g!==(g=Ge(E[0],242)+"")&&C(M,g),B&1&&I!==(I=Ge(E[0],243)+"")&&C(q,I),B&1&&O!==(O=Ge(E[0],200)+"")&&C(U,O)},d(E){E&&T(t)}}}function cd(e){let t,l,n=Ge(e[0],7)+"",i,o,f=Ge(e[0],6)+"",r,c,a=Ge(e[0],5)+"",_,p,v,d,h=Ge(e[0],51)+"",g,M,A=Ge(e[0],50)+"",I;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=m("option"),r=k(f),c=m("option"),_=k(a),p=b(),v=m("optgroup"),d=m("option"),g=k(h),M=m("option"),I=k(A),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,u(t,"label","amsleser.no"),d.__value=51,d.value=d.__value,M.__value=50,M.value=M.__value,u(v,"label","Generic hardware")},m(q,L){P(q,t,L),s(t,l),s(l,i),s(t,o),s(o,r),s(t,c),s(c,_),P(q,p,L),P(q,v,L),s(v,d),s(d,g),s(v,M),s(M,I)},p(q,L){L&1&&n!==(n=Ge(q[0],7)+"")&&C(i,n),L&1&&f!==(f=Ge(q[0],6)+"")&&C(r,f),L&1&&a!==(a=Ge(q[0],5)+"")&&C(_,a),L&1&&h!==(h=Ge(q[0],51)+"")&&C(g,h),L&1&&A!==(A=Ge(q[0],50)+"")&&C(I,A)},d(q){q&&T(t),q&&T(p),q&&T(v)}}}function _d(e){let t,l,n=Ge(e[0],8)+"",i,o,f,r,c=Ge(e[0],71)+"",a,_,p=Ge(e[0],70)+"",v;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=b(),f=m("optgroup"),r=m("option"),a=k(c),_=m("option"),v=k(p),l.__value=8,l.value=l.__value,u(t,"label","Custom hardware"),r.__value=71,r.value=r.__value,_.__value=70,_.value=_.__value,u(f,"label","Generic hardware")},m(d,h){P(d,t,h),s(t,l),s(l,i),P(d,o,h),P(d,f,h),s(f,r),s(r,a),s(f,_),s(_,v)},p(d,h){h&1&&n!==(n=Ge(d[0],8)+"")&&C(i,n),h&1&&c!==(c=Ge(d[0],71)+"")&&C(a,c),h&1&&p!==(p=Ge(d[0],70)+"")&&C(v,p)},d(d){d&&T(t),d&&T(o),d&&T(f)}}}function md(e){let t,l,n=Ge(e[0],200)+"",i;return{c(){t=m("optgroup"),l=m("option"),i=k(n),l.__value=200,l.value=l.__value,u(t,"label","Generic hardware")},m(o,f){P(o,t,f),s(t,l),s(l,i)},p(o,f){f&1&&n!==(n=Ge(o[0],200)+"")&&C(i,n)},d(o){o&&T(t)}}}function pd(e){let t,l,n=Ge(e[0],80)+"",i;return{c(){t=m("optgroup"),l=m("option"),i=k(n),l.__value=80,l.value=l.__value,u(t,"label","Generic hardware")},m(o,f){P(o,t,f),s(t,l),s(l,i)},p(o,f){f&1&&n!==(n=Ge(o[0],80)+"")&&C(i,n)},d(o){o&&T(t)}}}function wg(e){let t,l,n,i,o,f,r,c,a=e[0]=="esp8266"&&ud(e),_=e[0]=="esp32"&&rd(e),p=e[0]=="esp32s2"&&cd(e),v=e[0]=="esp32c3"&&_d(e),d=e[0]=="esp32solo"&&md(e),h=e[0]=="esp32s3"&&pd(e);return{c(){t=m("option"),l=b(),a&&a.c(),n=b(),_&&_.c(),i=b(),p&&p.c(),o=b(),v&&v.c(),f=b(),d&&d.c(),r=b(),h&&h.c(),c=Ut(),t.__value=-1,t.value=t.__value},m(g,M){P(g,t,M),P(g,l,M),a&&a.m(g,M),P(g,n,M),_&&_.m(g,M),P(g,i,M),p&&p.m(g,M),P(g,o,M),v&&v.m(g,M),P(g,f,M),d&&d.m(g,M),P(g,r,M),h&&h.m(g,M),P(g,c,M)},p(g,[M]){g[0]=="esp8266"?a?a.p(g,M):(a=ud(g),a.c(),a.m(n.parentNode,n)):a&&(a.d(1),a=null),g[0]=="esp32"?_?_.p(g,M):(_=rd(g),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null),g[0]=="esp32s2"?p?p.p(g,M):(p=cd(g),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),g[0]=="esp32c3"?v?v.p(g,M):(v=_d(g),v.c(),v.m(f.parentNode,f)):v&&(v.d(1),v=null),g[0]=="esp32solo"?d?d.p(g,M):(d=md(g),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null),g[0]=="esp32s3"?h?h.p(g,M):(h=pd(g),h.c(),h.m(c.parentNode,c)):h&&(h.d(1),h=null)},i:ze,o:ze,d(g){g&&T(t),g&&T(l),a&&a.d(g),g&&T(n),_&&_.d(g),g&&T(i),p&&p.d(g),g&&T(o),v&&v.d(g),g&&T(f),d&&d.d(g),g&&T(r),h&&h.d(g),g&&T(c)}}}function Mg(e,t,l){let{chip:n}=t;return e.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Sg extends mt{constructor(t){super(),_t(this,t,Mg,wg,ct,{chip:0})}}function dd(e){let t;return{c(){t=m("div"),t.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(t,"class","bd-red")},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function vd(e){let t,l,n,i,o,f,r;return f=new af({props:{chip:e[0].chip}}),{c(){t=m("div"),l=k("HAN GPIO"),n=m("br"),i=b(),o=m("select"),Ne(f.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(t,"class","my-3")},m(c,a){P(c,t,a),s(t,l),s(t,n),s(t,i),s(t,o),Se(f,o,null),r=!0},p(c,a){const _={};a&1&&(_.chip=c[0].chip),f.$set(_)},i(c){r||(Q(f.$$.fragment,c),r=!0)},o(c){ee(f.$$.fragment,c),r=!1},d(c){c&&T(t),Ce(f)}}}function Cg(e){let t,l,n,i,o,f,r,c,a,_,p,v,d,h,g,M,A,I,q,L,O,U,E,B,z,W,F,R,K,y=e[0].usrcfg&&dd();h=new Sg({props:{chip:e[0].chip}});let H=e[0].board&&e[0].board>20&&vd(e);return W=new kl({props:{active:e[1],message:"Saving"}}),{c(){t=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),f=m("strong"),f.textContent="Initial configuration",r=b(),y&&y.c(),c=b(),a=m("div"),_=k("Board type"),p=m("br"),v=b(),d=m("select"),Ne(h.$$.fragment),g=b(),H&&H.c(),M=b(),A=m("div"),I=m("label"),q=m("input"),L=k(" Clear all other configuration"),O=b(),U=m("div"),U.innerHTML='',E=b(),B=m("span"),B.textContent="\xA0",z=b(),Ne(W.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(f,"class","text-sm"),u(d,"name","vb"),u(d,"class","in-s"),e[0].board===void 0&&Ct(()=>e[5].call(d)),u(a,"class","my-3"),u(q,"type","checkbox"),u(q,"name","vr"),q.__value="true",q.value=q.__value,u(q,"class","rounded mb-1"),u(A,"class","my-3"),u(U,"class","my-3"),u(B,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Y,X){P(Y,t,X),s(t,l),s(l,n),s(n,i),s(n,o),s(n,f),s(n,r),y&&y.m(n,null),s(n,c),s(n,a),s(a,_),s(a,p),s(a,v),s(a,d),Se(h,d,null),Je(d,e[0].board,!0),s(n,g),H&&H.m(n,null),s(n,M),s(n,A),s(A,I),s(I,q),q.checked=e[2],s(I,L),s(n,O),s(n,U),s(n,E),s(n,B),P(Y,z,X),Se(W,Y,X),F=!0,R||(K=[re(d,"change",e[5]),re(q,"change",e[6]),re(n,"submit",as(e[3]))],R=!0)},p(Y,[X]){Y[0].usrcfg?y||(y=dd(),y.c(),y.m(n,c)):y&&(y.d(1),y=null);const J={};X&1&&(J.chip=Y[0].chip),h.$set(J),X&1&&Je(d,Y[0].board),Y[0].board&&Y[0].board>20?H?(H.p(Y,X),X&1&&Q(H,1)):(H=vd(Y),H.c(),Q(H,1),H.m(n,M)):H&&(pt(),ee(H,1,1,()=>{H=null}),dt()),X&4&&(q.checked=Y[2]);const $={};X&2&&($.active=Y[1]),W.$set($)},i(Y){F||(Q(h.$$.fragment,Y),Q(H),Q(W.$$.fragment,Y),F=!0)},o(Y){ee(h.$$.fragment,Y),ee(H),ee(W.$$.fragment,Y),F=!1},d(Y){Y&&T(t),y&&y.d(),Ce(h),H&&H.d(),Y&&T(z),Ce(W,Y),R=!1,Et(K)}}}function Ng(e,t,l){let{basepath:n="/"}=t,{sysinfo:i={}}=t,o=!1;async function f(_){l(1,o=!0);const p=new FormData(_.target),v=new URLSearchParams;for(let g of p){const[M,A]=g;v.append(M,A)}let h=await(await fetch("save",{method:"POST",body:v})).json();l(1,o=!1),wl.update(g=>(g.vndcfg=h.success,g.booting=h.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),hi(n+(i.usrcfg?"/":"/setup"))}let r=!1;wl.subscribe(_=>{l(0,i=_),_.fwconsent===1&&l(2,r=!i.usrcfg)});function c(){i.board=Ft(this),l(0,i)}function a(){r=this.checked,l(2,r)}return e.$$set=_=>{"basepath"in _&&l(4,n=_.basepath),"sysinfo"in _&&l(0,i=_.sysinfo)},[i,o,r,f,n,c,a]}class Tg extends mt{constructor(t){super(),_t(this,t,Ng,Cg,ct,{basepath:4,sysinfo:0})}}function hd(e){var i,o,f;let t,l=((f=(o=(i=e[1].conf)==null?void 0:i.connection)==null?void 0:o.eth)!=null?f:"Ethernet")+"",n;return{c(){t=m("option"),n=k(l),t.__value=3,t.value=t.__value},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c&2&&l!==(l=((p=(_=(a=r[1].conf)==null?void 0:a.connection)==null?void 0:_.eth)!=null?p:"Ethernet")+"")&&C(n,l)},d(r){r&&T(t)}}}function bd(e){var M,A,I,q,L,O;let t,l=((I=(A=(M=e[1].conf)==null?void 0:M.connection)==null?void 0:A.ssid)!=null?I:"SSID")+"",n,i,o,f,r,c,a,_=((O=(L=(q=e[1].conf)==null?void 0:q.connection)==null?void 0:L.psk)!=null?O:"Password")+"",p,v,d,h,g;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),c=b(),a=m("div"),p=k(_),v=m("br"),d=b(),h=m("input"),u(f,"name","ss"),u(f,"type","text"),u(f,"class","in-s"),f.required=r=e[3]==1||e[3]==2,u(t,"class","my-3"),u(h,"name","sp"),u(h,"type","password"),u(h,"class","in-s"),u(h,"autocomplete","off"),h.required=g=e[3]==2,u(a,"class","my-3")},m(U,E){P(U,t,E),s(t,n),s(t,i),s(t,o),s(t,f),P(U,c,E),P(U,a,E),s(a,p),s(a,v),s(a,d),s(a,h)},p(U,E){var B,z,W,F,R,K;E&2&&l!==(l=((W=(z=(B=U[1].conf)==null?void 0:B.connection)==null?void 0:z.ssid)!=null?W:"SSID")+"")&&C(n,l),E&8&&r!==(r=U[3]==1||U[3]==2)&&(f.required=r),E&2&&_!==(_=((K=(R=(F=U[1].conf)==null?void 0:F.connection)==null?void 0:R.psk)!=null?K:"Password")+"")&&C(p,_),E&8&&g!==(g=U[3]==2)&&(h.required=g)},d(U){U&&T(t),U&&T(c),U&&T(a)}}}function gd(e){let t,l,n,i,o,f,r,c;return r=new qv({}),{c(){t=m("br"),l=b(),n=m("div"),i=m("input"),o=b(),f=m("select"),Ne(r.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=e[2],u(f,"name","su"),u(f,"class","in-l"),f.required=e[2],u(n,"class","flex")},m(a,_){P(a,t,_),P(a,l,_),P(a,n,_),s(n,i),s(n,o),s(n,f),Se(r,f,null),c=!0},p(a,_){(!c||_&4)&&(i.required=a[2]),(!c||_&4)&&(f.required=a[2])},i(a){c||(Q(r.$$.fragment,a),c=!0)},o(a){ee(r.$$.fragment,a),c=!1},d(a){a&&T(t),a&&T(l),a&&T(n),Ce(r)}}}function kd(e){var g,M,A,I,q,L;let t,l,n=((A=(M=(g=e[1].conf)==null?void 0:g.network)==null?void 0:M.gw)!=null?A:"Gateway")+"",i,o,f,r,c,a,_=((L=(q=(I=e[1].conf)==null?void 0:I.network)==null?void 0:q.dns)!=null?L:"DNS")+"",p,v,d,h;return{c(){t=m("div"),l=m("div"),i=k(n),o=m("br"),f=b(),r=m("input"),c=b(),a=m("div"),p=k(_),v=m("br"),d=b(),h=m("input"),u(r,"name","sg"),u(r,"type","text"),u(r,"class","in-f w-full"),u(h,"name","sd"),u(h,"type","text"),u(h,"class","in-l w-full"),u(t,"class","my-3 flex")},m(O,U){P(O,t,U),s(t,l),s(l,i),s(l,o),s(l,f),s(l,r),s(t,c),s(t,a),s(a,p),s(a,v),s(a,d),s(a,h)},p(O,U){var E,B,z,W,F,R;U&2&&n!==(n=((z=(B=(E=O[1].conf)==null?void 0:E.network)==null?void 0:B.gw)!=null?z:"Gateway")+"")&&C(i,n),U&2&&_!==(_=((R=(F=(W=O[1].conf)==null?void 0:W.network)==null?void 0:F.dns)!=null?R:"DNS")+"")&&C(p,_)},d(O){O&&T(t)}}}function Pg(e){var j,te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt;let t,l,n,i,o,f,r=((te=(j=e[1].setup)==null?void 0:j.title)!=null?te:"Setup")+"",c,a,_,p=((de=(fe=(le=e[1].conf)==null?void 0:le.connection)==null?void 0:fe.title)!=null?de:"Connection")+"",v,d,h,g,M,A=((we=(Pe=(qe=e[1].conf)==null?void 0:qe.connection)==null?void 0:Pe.wifi)!=null?we:"Connect to WiFi")+"",I,q,L=((ke=(Ae=(Fe=e[1].conf)==null?void 0:Fe.connection)==null?void 0:Ae.ap)!=null?ke:"Standalone access point")+"",O,U,E,B,z=((Oe=(He=(De=e[1].conf)==null?void 0:De.general)==null?void 0:He.hostname)!=null?Oe:"Hostname")+"",W,F,R,K,y,H,Y,X,J=((Ye=(je=e[1].setup)==null?void 0:je.static)!=null?Ye:"Static IP")+"",$,ce,ie,oe,ae,se,x=(($e=(We=e[1].btn)==null?void 0:We.save)!=null?$e:"Save")+"",me,pe,V,Z,ge,ve,S=e[0].if&&e[0].if.eth&&hd(e),w=(e[3]==1||e[3]==2)&&bd(e),N=e[2]&&gd(e),D=e[2]&&kd(e);return V=new kl({props:{active:e[4],message:(tt=(xe=e[1].setup)==null?void 0:xe.mask)!=null?tt:"Saving"}}),{c(){t=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),f=m("strong"),c=k(r),a=b(),_=m("div"),v=k(p),d=m("br"),h=b(),g=m("select"),M=m("option"),I=k(A),q=m("option"),O=k(L),S&&S.c(),U=b(),w&&w.c(),E=b(),B=m("div"),W=k(z),F=b(),R=m("input"),K=b(),y=m("div"),H=m("label"),Y=m("input"),X=b(),$=k(J),ce=b(),N&&N.c(),ie=b(),D&&D.c(),oe=b(),ae=m("div"),se=m("button"),me=k(x),pe=b(),Ne(V.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(f,"class","text-sm"),M.__value=1,M.value=M.__value,q.__value=2,q.value=q.__value,u(g,"name","sc"),u(g,"class","in-s"),e[3]===void 0&&Ct(()=>e[6].call(g)),u(_,"class","my-3"),u(R,"name","sh"),u(R,"type","text"),u(R,"class","in-s"),u(R,"maxlength","32"),u(R,"pattern","[a-z0-9_-]+"),u(R,"placeholder","Optional, ex.: ams-reader"),u(R,"autocomplete","off"),u(Y,"type","checkbox"),u(Y,"name","sm"),Y.__value="static",Y.value=Y.__value,u(Y,"class","rounded mb-1"),u(y,"class","my-3"),u(se,"type","submit"),u(se,"class","btn-pri"),u(ae,"class","my-3"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Te,ue){P(Te,t,ue),s(t,l),s(l,n),s(n,i),s(n,o),s(n,f),s(f,c),s(n,a),s(n,_),s(_,v),s(_,d),s(_,h),s(_,g),s(g,M),s(M,I),s(g,q),s(q,O),S&&S.m(g,null),Je(g,e[3],!0),s(n,U),w&&w.m(n,null),s(n,E),s(n,B),s(B,W),s(B,F),s(B,R),be(R,e[0].hostname),s(n,K),s(n,y),s(y,H),s(H,Y),Y.checked=e[2],s(H,X),s(H,$),s(y,ce),N&&N.m(y,null),s(n,ie),D&&D.m(n,null),s(n,oe),s(n,ae),s(ae,se),s(se,me),P(Te,pe,ue),Se(V,Te,ue),Z=!0,ge||(ve=[re(g,"change",e[6]),re(R,"input",e[7]),re(Y,"change",e[8]),re(n,"submit",as(e[5]))],ge=!0)},p(Te,[ue]){var kt,lt,wt,st,ot,et,Nt,gt,At,Pt,Be,ye,It,vt,nt,Tt,it,at,rt,jt;(!Z||ue&2)&&r!==(r=((lt=(kt=Te[1].setup)==null?void 0:kt.title)!=null?lt:"Setup")+"")&&C(c,r),(!Z||ue&2)&&p!==(p=((ot=(st=(wt=Te[1].conf)==null?void 0:wt.connection)==null?void 0:st.title)!=null?ot:"Connection")+"")&&C(v,p),(!Z||ue&2)&&A!==(A=((gt=(Nt=(et=Te[1].conf)==null?void 0:et.connection)==null?void 0:Nt.wifi)!=null?gt:"Connect to WiFi")+"")&&C(I,A),(!Z||ue&2)&&L!==(L=((Be=(Pt=(At=Te[1].conf)==null?void 0:At.connection)==null?void 0:Pt.ap)!=null?Be:"Standalone access point")+"")&&C(O,L),Te[0].if&&Te[0].if.eth?S?S.p(Te,ue):(S=hd(Te),S.c(),S.m(g,null)):S&&(S.d(1),S=null),ue&8&&Je(g,Te[3]),Te[3]==1||Te[3]==2?w?w.p(Te,ue):(w=bd(Te),w.c(),w.m(n,E)):w&&(w.d(1),w=null),(!Z||ue&2)&&z!==(z=((vt=(It=(ye=Te[1].conf)==null?void 0:ye.general)==null?void 0:It.hostname)!=null?vt:"Hostname")+"")&&C(W,z),ue&1&&R.value!==Te[0].hostname&&be(R,Te[0].hostname),ue&4&&(Y.checked=Te[2]),(!Z||ue&2)&&J!==(J=((Tt=(nt=Te[1].setup)==null?void 0:nt.static)!=null?Tt:"Static IP")+"")&&C($,J),Te[2]?N?(N.p(Te,ue),ue&4&&Q(N,1)):(N=gd(Te),N.c(),Q(N,1),N.m(y,null)):N&&(pt(),ee(N,1,1,()=>{N=null}),dt()),Te[2]?D?D.p(Te,ue):(D=kd(Te),D.c(),D.m(n,oe)):D&&(D.d(1),D=null),(!Z||ue&2)&&x!==(x=((at=(it=Te[1].btn)==null?void 0:it.save)!=null?at:"Save")+"")&&C(me,x);const Ie={};ue&16&&(Ie.active=Te[4]),ue&2&&(Ie.message=(jt=(rt=Te[1].setup)==null?void 0:rt.mask)!=null?jt:"Saving"),V.$set(Ie)},i(Te){Z||(Q(N),Q(V.$$.fragment,Te),Z=!0)},o(Te){ee(N),ee(V.$$.fragment,Te),Z=!1},d(Te){Te&&T(t),S&&S.d(),w&&w.d(),N&&N.d(),D&&D.d(),Te&&T(pe),Ce(V,Te),ge=!1,Et(ve)}}}function Eg(e,t,l){let n={};Ml.subscribe(d=>{l(1,n=d)});let{sysinfo:i={}}=t,o=!1,f=1,r=!1;function c(d){wl.update(h=>(h.trying=d,h))}async function a(d){l(4,r=!0);const h=new FormData(d.target),g=new URLSearchParams;for(let I of h){const[q,L]=I;g.append(q,L)}let A=await(await fetch("save",{method:"POST",body:g})).json();l(4,r=!1),wl.update(I=>(I.hostname=h.get("sh"),I.usrcfg=A.success,I.booting=A.reboot,o&&(I.net.ip=h.get("si"),I.net.mask=h.get("su"),I.net.gw=h.get("sg"),I.net.dns1=h.get("sd")),A.reboot&&setTimeout(Ls,5e3,i,c),I))}function _(){f=Ft(this),l(3,f)}function p(){i.hostname=this.value,l(0,i)}function v(){o=this.checked,l(2,o)}return e.$$set=d=>{"sysinfo"in d&&l(0,i=d.sysinfo)},[i,n,o,f,r,a,_,p,v]}class Ag extends mt{constructor(t){super(),_t(this,t,Eg,Pg,ct,{sysinfo:0})}}function Dg(e){var W,F,R,K,y,H,Y,X;let t,l,n,i=((F=(W=e[2].upload)==null?void 0:W.title)!=null?F:"Upload")+"",o,f,r,c,a,_=((K=(R=e[2].upload)==null?void 0:R.desc)!=null?K:"")+"",p,v,d,h,g,M,A,I,q=((H=(y=e[2].btn)==null?void 0:y.upload)!=null?H:"Upload")+"",L,O,U,E,B,z;return U=new kl({props:{active:e[3],message:(X=(Y=e[2].upload)==null?void 0:Y.mask)!=null?X:"Uploading"}}),{c(){t=m("div"),l=m("div"),n=m("strong"),o=k(i),f=b(),r=k(e[1]),c=b(),a=m("p"),p=k(_),v=b(),d=m("form"),h=m("input"),g=b(),M=m("div"),A=m("button"),I=m("p"),L=k(q),O=b(),Ne(U.$$.fragment),u(a,"class","mb-4"),u(h,"name","file"),u(h,"type","file"),u(I,"class","mb-4"),u(A,"type","submit"),u(A,"class","btn-pri"),u(M,"class","w-full text-right mt-4"),u(d,"action",e[0]),u(d,"enctype","multipart/form-data"),u(d,"method","post"),u(d,"autocomplete","off"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(J,$){P(J,t,$),s(t,l),s(l,n),s(n,o),s(n,f),s(n,r),s(l,c),s(l,a),s(a,p),s(l,v),s(l,d),s(d,h),s(d,g),s(d,M),s(M,A),s(A,I),s(I,L),P(J,O,$),Se(U,J,$),E=!0,B||(z=re(d,"submit",e[4]),B=!0)},p(J,[$]){var ie,oe,ae,se,x,me,pe,V;(!E||$&4)&&i!==(i=((oe=(ie=J[2].upload)==null?void 0:ie.title)!=null?oe:"Upload")+"")&&C(o,i),(!E||$&2)&&C(r,J[1]),(!E||$&4)&&_!==(_=((se=(ae=J[2].upload)==null?void 0:ae.desc)!=null?se:"")+"")&&C(p,_),(!E||$&4)&&q!==(q=((me=(x=J[2].btn)==null?void 0:x.upload)!=null?me:"Upload")+"")&&C(L,q),(!E||$&1)&&u(d,"action",J[0]);const ce={};$&8&&(ce.active=J[3]),$&4&&(ce.message=(V=(pe=J[2].upload)==null?void 0:pe.mask)!=null?V:"Uploading"),U.$set(ce)},i(J){E||(Q(U.$$.fragment,J),E=!0)},o(J){ee(U.$$.fragment,J),E=!1},d(J){J&&T(t),J&&T(O),Ce(U,J),B=!1,z()}}}function qg(e,t,l){let{action:n}=t,{title:i}=t,o={};Ml.subscribe(c=>{l(2,o=c)});let f=!1;const r=()=>l(3,f=!0);return e.$$set=c=>{"action"in c&&l(0,n=c.action),"title"in c&&l(1,i=c.title)},[n,i,o,f,r]}class Tf extends mt{constructor(t){super(),_t(this,t,qg,Dg,ct,{action:0,title:1})}}function Og(e){var V,Z,ge,ve,S,w,N,D,j,te,le,fe,de,qe;let t,l,n,i,o=((Z=(V=e[1].consent)==null?void 0:V.title)!=null?Z:"Consents")+"",f,r,c,a,_,p=((ve=(ge=e[1].consent)==null?void 0:ge.one_click)!=null?ve:"One-click")+"",v,d,h,g,M=((w=(S=e[1].consent)==null?void 0:S.read_more)!=null?w:"Read more")+"",A,I,q,L,O,U,E,B=((D=(N=e[1].consent)==null?void 0:N.yes)!=null?D:"Yes")+"",z,W,F,R,K,y,H=((te=(j=e[1].consent)==null?void 0:j.no)!=null?te:"No")+"",Y,X,J,$,ce,ie=((fe=(le=e[1].btn)==null?void 0:le.save)!=null?fe:"Save")+"",oe,ae,se,x,me,pe;return se=new kl({props:{active:e[2],message:(qe=(de=e[1].consent)==null?void 0:de.mask_saving)!=null?qe:"Saving"}}),{c(){t=m("div"),l=m("div"),n=m("form"),i=m("div"),f=k(o),r=b(),c=m("hr"),a=b(),_=m("div"),v=k(p),d=m("br"),h=b(),g=m("a"),A=k(M),I=m("br"),q=b(),L=m("label"),O=m("input"),E=b(),z=k(B),W=b(),F=m("label"),R=m("input"),y=b(),Y=k(H),X=m("br"),J=b(),$=m("div"),ce=m("button"),oe=k(ie),ae=b(),Ne(se.$$.fragment),u(g,"href",Wl("Data-collection-on-one-click-firmware-upgrade")),u(g,"target","_blank"),u(g,"class","text-blue-600 hover:text-blue-800"),u(O,"type","radio"),u(O,"name","sf"),O.value=1,O.checked=U=e[0].fwconsent===1,u(O,"class","rounded m-2"),O.required=!0,u(R,"type","radio"),u(R,"name","sf"),R.value=2,R.checked=K=e[0].fwconsent===2,u(R,"class","rounded m-2"),R.required=!0,u(_,"class","my-3"),u(ce,"type","submit"),u(ce,"class","btn-pri"),u($,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(Pe,we){P(Pe,t,we),s(t,l),s(l,n),s(n,i),s(i,f),s(n,r),s(n,c),s(n,a),s(n,_),s(_,v),s(_,d),s(_,h),s(_,g),s(g,A),s(_,I),s(_,q),s(_,L),s(L,O),s(L,E),s(L,z),s(_,W),s(_,F),s(F,R),s(F,y),s(F,Y),s(_,X),s(n,J),s(n,$),s($,ce),s(ce,oe),P(Pe,ae,we),Se(se,Pe,we),x=!0,me||(pe=re(n,"submit",as(e[3])),me=!0)},p(Pe,[we]){var Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt,Te,ue,Ie;(!x||we&2)&&o!==(o=((ke=(Ae=Pe[1].consent)==null?void 0:Ae.title)!=null?ke:"Consents")+"")&&C(f,o),(!x||we&2)&&p!==(p=((He=(De=Pe[1].consent)==null?void 0:De.one_click)!=null?He:"One-click")+"")&&C(v,p),(!x||we&2)&&M!==(M=((je=(Oe=Pe[1].consent)==null?void 0:Oe.read_more)!=null?je:"Read more")+"")&&C(A,M),(!x||we&1&&U!==(U=Pe[0].fwconsent===1))&&(O.checked=U),(!x||we&2)&&B!==(B=((We=(Ye=Pe[1].consent)==null?void 0:Ye.yes)!=null?We:"Yes")+"")&&C(z,B),(!x||we&1&&K!==(K=Pe[0].fwconsent===2))&&(R.checked=K),(!x||we&2)&&H!==(H=((xe=($e=Pe[1].consent)==null?void 0:$e.no)!=null?xe:"No")+"")&&C(Y,H),(!x||we&2)&&ie!==(ie=((Te=(tt=Pe[1].btn)==null?void 0:tt.save)!=null?Te:"Save")+"")&&C(oe,ie);const Fe={};we&4&&(Fe.active=Pe[2]),we&2&&(Fe.message=(Ie=(ue=Pe[1].consent)==null?void 0:ue.mask_saving)!=null?Ie:"Saving"),se.$set(Fe)},i(Pe){x||(Q(se.$$.fragment,Pe),x=!0)},o(Pe){ee(se.$$.fragment,Pe),x=!1},d(Pe){Pe&&T(t),Pe&&T(ae),Ce(se,Pe),me=!1,pe()}}}function Ig(e,t,l){let{basepath:n="/"}=t,{sysinfo:i={}}=t,o={};Ml.subscribe(c=>{l(1,o=c)});let f=!1;async function r(c){l(2,f=!0);const a=new FormData(c.target),_=new URLSearchParams;for(let d of a){const[h,g]=d;_.append(h,g)}let v=await(await fetch("save",{method:"POST",body:_})).json();l(2,f=!1),wl.update(d=>(d.fwconsent=a.sf===!0?1:a.sf===!1?2:0,d.booting=v.reboot,d)),hi(n)}return e.$$set=c=>{"basepath"in c&&l(4,n=c.basepath),"sysinfo"in c&&l(0,i=c.sysinfo)},[i,o,f,r,n]}class Lg extends mt{constructor(t){super(),_t(this,t,Ig,Og,ct,{basepath:4,sysinfo:0})}}function wd(e,t,l){const n=e.slice();return n[24]=t[l],n[25]=t,n[26]=l,n}function Md(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Rg(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Sd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Fg(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Cd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Nd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Td(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Pd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Ed(e){let t,l=e[1].o,n=[];for(let i=0;i{l(0,i=F)});let o=["mo","tu","we","th","fr","sa","su"],f={},r=!0,c=!1;Dv.subscribe(F=>{F.o&&(l(1,f=F),l(2,r=!1))}),C4();async function a(F){l(3,c=!0);const R=new URLSearchParams;R.append("r","true"),R.append("rc",f.o.length),f.o.forEach(function(y,H){R.append("rt"+H,y.t),R.append("rn"+H,y.n),R.append("rd"+H,y.d),R.append("ra"+H,y.a),R.append("rh"+H,y.h),R.append("rv"+H,y.v),R.append("rsm"+H,y.s.m),R.append("rsd"+H,y.s.d),R.append("rem"+H,y.e.m),R.append("red"+H,y.e.d)}),await(await fetch("save",{method:"POST",body:R})).json(),l(3,c=!1),hi(n+"configuration")}let _=function(F,R){return F.includes(R)?F=F.filter(function(K){return K!==R}):F.push(R),F},p=function(){let F=f.o;F.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,f.o=F,f)},v=function(F){let R=f.o;R.splice(F,1),l(1,f.o=R,f)};function d(F,R){F[R].n=this.value,l(1,f)}function h(F,R){F[R].d=Ft(this),l(1,f)}function g(F,R){F[R].t=Ft(this),l(1,f)}function M(F,R){F[R].v=Ze(this.value),l(1,f)}const A=(F,R,K,y)=>l(1,K[y].a=_(F.a,R),f),I=(F,R,K,y)=>l(1,K[y].h=_(F.h,R),f),q=(F,R,K,y)=>l(1,K[y].h=_(F.h,R+8),f),L=(F,R,K,y)=>l(1,K[y].h=_(F.h,R+16),f);function O(F,R){F[R].s.m=Ft(this),l(1,f)}function U(F,R){F[R].s.d=Ft(this),l(1,f)}function E(F,R){F[R].e.m=Ft(this),l(1,f)}function B(F,R){F[R].e.d=Ft(this),l(1,f)}const z=F=>v(F),W=F=>v(F);return e.$$set=F=>{"basepath"in F&&l(9,n=F.basepath)},[i,f,r,c,o,a,_,p,v,n,d,h,g,M,A,I,q,L,O,U,E,B,z,W]}class yg extends mt{constructor(t){super(),_t(this,t,Hg,jg,ct,{basepath:9},null,[-1,-1])}}function zg(e){let t,l;return t=new M4({props:{data:e[2],sysinfo:e[1]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&4&&(o.data=n[2]),i&2&&(o.sysinfo=n[1]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Wg(e){let t,l;return t=new fg({props:{sysinfo:e[1],basepath:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Gg(e){let t,l;return t=new yg({props:{basepath:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Vg(e){let t,l;return t=new kg({props:{sysinfo:e[1],data:e[2]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&4&&(o.data=n[2]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Kg(e){let t,l;return t=new Tf({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p:ze,i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Yg(e){let t,l;return t=new Tf({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p:ze,i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Qg(e){let t,l;return t=new Tf({props:{title:"private key",action:"/mqtt-key"}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p:ze,i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Xg(e){let t,l;return t=new Lg({props:{sysinfo:e[1],basepath:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Zg(e){let t,l;return t=new Ag({props:{sysinfo:e[1]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Jg(e){let t,l;return t=new Tg({props:{sysinfo:e[1],basepath:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function $g(e){let t,l,n,i,o,f,r,c,a,_,p,v,d,h,g,M,A,I,q,L,O,U;return t=new Lb({props:{data:e[2],basepath:e[0]}}),n=new Sn({props:{path:"/",$$slots:{default:[zg]},$$scope:{ctx:e}}}),o=new Sn({props:{path:"/configuration",$$slots:{default:[Wg]},$$scope:{ctx:e}}}),r=new Sn({props:{path:"/priceconfig",$$slots:{default:[Gg]},$$scope:{ctx:e}}}),a=new Sn({props:{path:"/status",$$slots:{default:[Vg]},$$scope:{ctx:e}}}),p=new Sn({props:{path:"/mqtt-ca",$$slots:{default:[Kg]},$$scope:{ctx:e}}}),d=new Sn({props:{path:"/mqtt-cert",$$slots:{default:[Yg]},$$scope:{ctx:e}}}),g=new Sn({props:{path:"/mqtt-key",$$slots:{default:[Qg]},$$scope:{ctx:e}}}),A=new Sn({props:{path:"/consent",$$slots:{default:[Xg]},$$scope:{ctx:e}}}),q=new Sn({props:{path:"/setup",$$slots:{default:[Zg]},$$scope:{ctx:e}}}),O=new Sn({props:{path:"/vendor",$$slots:{default:[Jg]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment),l=b(),Ne(n.$$.fragment),i=b(),Ne(o.$$.fragment),f=b(),Ne(r.$$.fragment),c=b(),Ne(a.$$.fragment),_=b(),Ne(p.$$.fragment),v=b(),Ne(d.$$.fragment),h=b(),Ne(g.$$.fragment),M=b(),Ne(A.$$.fragment),I=b(),Ne(q.$$.fragment),L=b(),Ne(O.$$.fragment)},m(E,B){Se(t,E,B),P(E,l,B),Se(n,E,B),P(E,i,B),Se(o,E,B),P(E,f,B),Se(r,E,B),P(E,c,B),Se(a,E,B),P(E,_,B),Se(p,E,B),P(E,v,B),Se(d,E,B),P(E,h,B),Se(g,E,B),P(E,M,B),Se(A,E,B),P(E,I,B),Se(q,E,B),P(E,L,B),Se(O,E,B),U=!0},p(E,B){const z={};B&4&&(z.data=E[2]),B&1&&(z.basepath=E[0]),t.$set(z);const W={};B&22&&(W.$$scope={dirty:B,ctx:E}),n.$set(W);const F={};B&19&&(F.$$scope={dirty:B,ctx:E}),o.$set(F);const R={};B&17&&(R.$$scope={dirty:B,ctx:E}),r.$set(R);const K={};B&22&&(K.$$scope={dirty:B,ctx:E}),a.$set(K);const y={};B&16&&(y.$$scope={dirty:B,ctx:E}),p.$set(y);const H={};B&16&&(H.$$scope={dirty:B,ctx:E}),d.$set(H);const Y={};B&16&&(Y.$$scope={dirty:B,ctx:E}),g.$set(Y);const X={};B&19&&(X.$$scope={dirty:B,ctx:E}),A.$set(X);const J={};B&18&&(J.$$scope={dirty:B,ctx:E}),q.$set(J);const $={};B&19&&($.$$scope={dirty:B,ctx:E}),O.$set($)},i(E){U||(Q(t.$$.fragment,E),Q(n.$$.fragment,E),Q(o.$$.fragment,E),Q(r.$$.fragment,E),Q(a.$$.fragment,E),Q(p.$$.fragment,E),Q(d.$$.fragment,E),Q(g.$$.fragment,E),Q(A.$$.fragment,E),Q(q.$$.fragment,E),Q(O.$$.fragment,E),U=!0)},o(E){ee(t.$$.fragment,E),ee(n.$$.fragment,E),ee(o.$$.fragment,E),ee(r.$$.fragment,E),ee(a.$$.fragment,E),ee(p.$$.fragment,E),ee(d.$$.fragment,E),ee(g.$$.fragment,E),ee(A.$$.fragment,E),ee(q.$$.fragment,E),ee(O.$$.fragment,E),U=!1},d(E){Ce(t,E),E&&T(l),Ce(n,E),E&&T(i),Ce(o,E),E&&T(f),Ce(r,E),E&&T(c),Ce(a,E),E&&T(_),Ce(p,E),E&&T(v),Ce(d,E),E&&T(h),Ce(g,E),E&&T(M),Ce(A,E),E&&T(I),Ce(q,E),E&&T(L),Ce(O,E)}}}function xg(e){let t,l,n,i;const o=[l3,t3],f=[];function r(c,a){return c[1].trying?0:1}return t=r(e),l=f[t]=o[t](e),{c(){l.c(),n=Ut()},m(c,a){f[t].m(c,a),P(c,n,a),i=!0},p(c,a){let _=t;t=r(c),t===_?f[t].p(c,a):(pt(),ee(f[_],1,1,()=>{f[_]=null}),dt(),l=f[t],l?l.p(c,a):(l=f[t]=o[t](c),l.c()),Q(l,1),l.m(n.parentNode,n))},i(c){i||(Q(l),i=!0)},o(c){ee(l),i=!1},d(c){f[t].d(c),c&&T(n)}}}function e3(e){let t,l;return t=new kl({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p:ze,i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function t3(e){let t,l;return t=new kl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p:ze,i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function l3(e){let t,l;return t=new kl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+e[1].trying}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.message="Device is booting, please wait. Trying to reach it on "+n[1].trying),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function n3(e){let t,l,n,i,o,f;l=new uv({props:{basepath:e[0],$$slots:{default:[$g]},$$scope:{ctx:e}}});const r=[e3,xg],c=[];function a(_,p){return _[1].upgrading?0:_[1].booting?1:-1}return~(i=a(e))&&(o=c[i]=r[i](e)),{c(){t=m("div"),Ne(l.$$.fragment),n=b(),o&&o.c(),u(t,"class","container mx-auto m-3")},m(_,p){P(_,t,p),Se(l,t,null),s(t,n),~i&&c[i].m(t,null),f=!0},p(_,[p]){const v={};p&1&&(v.basepath=_[0]),p&23&&(v.$$scope={dirty:p,ctx:_}),l.$set(v);let d=i;i=a(_),i===d?~i&&c[i].p(_,p):(o&&(pt(),ee(c[d],1,1,()=>{c[d]=null}),dt()),~i?(o=c[i],o?o.p(_,p):(o=c[i]=r[i](_),o.c()),Q(o,1),o.m(t,null)):o=null)},i(_){f||(Q(l.$$.fragment,_),Q(o),f=!0)},o(_){ee(l.$$.fragment,_),ee(o),f=!1},d(_){_&&T(t),Ce(l),~i&&c[i].d()}}}function i3(e,t,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i={};Ml.subscribe(r=>{i=r});let o={};wl.subscribe(r=>{var c;l(1,o=r),o.vndcfg===!1?hi(n+"vendor"):o.usrcfg===!1?hi(n+"setup"):o.fwconsent===0&&hi(n+"consent"),o.ui.k===1?document.documentElement.classList.add("dark"):o.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),o.ui.lang&&o.ui.lang!=((c=i==null?void 0:i.language)==null?void 0:c.code)&&Nv(o.ui.lang)}),kf();let f={};return dv.subscribe(r=>{l(2,f=r)}),[n,o,f]}class s3 extends mt{constructor(t){super(),_t(this,t,i3,n3,ct,{})}}new s3({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/index.html b/lib/SvelteUi/app/index.html index b1a58959..8afe6152 100644 --- a/lib/SvelteUi/app/index.html +++ b/lib/SvelteUi/app/index.html @@ -2,12 +2,13 @@ + AMS reader - +
diff --git a/lib/SvelteUi/app/package-lock.json b/lib/SvelteUi/app/package-lock.json index e1c88e4d..095de595 100644 --- a/lib/SvelteUi/app/package-lock.json +++ b/lib/SvelteUi/app/package-lock.json @@ -8,21 +8,21 @@ "name": "svelte-gui", "version": "0.0.0", "dependencies": { - "cssnano": "^5.1.14" + "cssnano": "^5.1.15" }, "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^1.0.1", - "@tailwindcss/forms": "^0.5.2", - "autoprefixer": "^10.4.7", - "http-proxy-middleware": "^2.0.1", + "@sveltejs/vite-plugin-svelte": "^2.1.0", + "@tailwindcss/forms": "^0.5.3", + "autoprefixer": "^10.4.14", + "http-proxy-middleware": "^2.0.6", "postcss": "^8.4.31", "postcss-load-config": "^4.0.1", - "svelte": "^3.49.0", + "svelte": "^3.58.0", "svelte-navigator": "^3.2.2", - "svelte-preprocess": "^4.10.7", + "svelte-preprocess": "^5.0.3", "svelte-qrcode": "^1.0.0", - "tailwindcss": "^3.1.5", - "vite": "^3.2.10" + "tailwindcss": "^3.3.1", + "vite": "^4.3.1" } }, "node_modules/@alloc/quick-lru": { @@ -38,9 +38,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.18.tgz", - "integrity": "sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", "cpu": [ "arm" ], @@ -53,10 +53,154 @@ "node": ">=12" } }, + "node_modules/@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/linux-loong64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.18.tgz", - "integrity": "sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", "cpu": [ "loong64" ], @@ -69,6 +213,182 @@ "node": ">=12" } }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -84,9 +404,9 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", "dev": true, "engines": { "node": ">=6.0.0" @@ -108,21 +428,15 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", - "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -159,30 +473,48 @@ } }, "node_modules/@sveltejs/vite-plugin-svelte": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.4.0.tgz", - "integrity": "sha512-6QupI/jemMfK+yI2pMtJcu5iO2gtgTfcBdGwMZZt+lgbFELhszbDl6Qjh000HgAV8+XUA+8EY8DusOFk8WhOIg==", + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.4.6.tgz", + "integrity": "sha512-zO79p0+DZnXPnF0ltIigWDx/ux7Ni+HRaFOw720Qeivc1azFUrJxTl0OryXVibYNx1hCboGia1NRV3x8RNv4cA==", "dev": true, "dependencies": { + "@sveltejs/vite-plugin-svelte-inspector": "^1.0.4", "debug": "^4.3.4", - "deepmerge": "^4.2.2", + "deepmerge": "^4.3.1", "kleur": "^4.1.5", - "magic-string": "^0.26.7", - "svelte-hmr": "^0.15.1", - "vitefu": "^0.2.2" + "magic-string": "^0.30.3", + "svelte-hmr": "^0.15.3", + "vitefu": "^0.2.4" + }, + "engines": { + "node": "^14.18.0 || >= 16" + }, + "peerDependencies": { + "svelte": "^3.54.0 || ^4.0.0", + "vite": "^4.0.0" + } + }, + "node_modules/@sveltejs/vite-plugin-svelte-inspector": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-1.0.4.tgz", + "integrity": "sha512-zjiuZ3yydBtwpF3bj0kQNV0YXe+iKE545QGZVTaylW3eAzFr+pJ/cwK8lZEaRp4JtaJXhD5DyWAV4AxLh6DgaQ==", + "dev": true, + "dependencies": { + "debug": "^4.3.4" }, "engines": { "node": "^14.18.0 || >= 16" }, "peerDependencies": { - "svelte": "^3.44.0", - "vite": "^3.0.0" + "@sveltejs/vite-plugin-svelte": "^2.2.0", + "svelte": "^3.54.0 || ^4.0.0", + "vite": "^4.0.0" } }, "node_modules/@tailwindcss/forms": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.3.tgz", - "integrity": "sha512-y5mb86JUoiUgBjY/o6FJSFZSEttfb3Q5gllE4xoKjAAD+vBrnIhE4dViwUuow3va8mpH4s9jyUbUbrRGoRdc2Q==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.6.tgz", + "integrity": "sha512-Fw+2BJ0tmAwK/w01tEFL5TiaJBX1NLT1/YbWgvm7ws3Qcn11kiXxzNTEQDMs5V3mQemhB56l3u0i9dwdzSQldA==", "dev": true, "dependencies": { "mini-svg-data-uri": "^1.2.3" @@ -200,36 +532,29 @@ } }, "node_modules/@types/http-proxy": { - "version": "1.17.11", - "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.11.tgz", - "integrity": "sha512-HC8G7c1WmaF2ekqpnFq626xd3Zz0uvaqFmBJNRZCGEZCXkvSdJoNFn/8Ygbd9fKNQj8UzLdCETaI0UWPAjK7IA==", + "version": "1.17.13", + "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.13.tgz", + "integrity": "sha512-GkhdWcMNiR5QSQRYnJ+/oXzu0+7JJEPC8vkWXK351BkhjraZF+1W13CUYARUvX9+NqIU2n6YHA4iwywsc/M6Sw==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@types/node": { - "version": "20.3.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.3.tgz", - "integrity": "sha512-wheIYdr4NYML61AjC8MKj/2jrR/kDQri/CIpVoZwldwhnIrD/j9jIU5bJ8yBKuB2VhpFV7Ab6G2XkBjv9r9Zzw==", - "dev": true - }, - "node_modules/@types/pug": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.6.tgz", - "integrity": "sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==", - "dev": true - }, - "node_modules/@types/sass": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/@types/sass/-/sass-1.45.0.tgz", - "integrity": "sha512-jn7qwGFmJHwUSphV8zZneO3GmtlgLsmhs/LQyVvQbIIa+fzGMUiHI4HXJZL3FT8MJmgXWbLGiVVY7ElvHq6vDA==", - "deprecated": "This is a stub types definition. sass provides its own type definitions, so you do not need this installed.", + "version": "20.8.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", + "integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", "dev": true, "dependencies": { - "sass": "*" + "undici-types": "~5.26.4" } }, + "node_modules/@types/pug": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.8.tgz", + "integrity": "sha512-QzhsZ1dMGyJbn/D9V80zp4GIA4J4rfAjCCxc3MP+new0E8dyVdSkR735Lx+n3LIaHNFcjHL5+TbziccuT+fdoQ==", + "dev": true + }, "node_modules/any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", @@ -256,9 +581,9 @@ "dev": true }, "node_modules/autoprefixer": { - "version": "10.4.14", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.14.tgz", - "integrity": "sha512-FQzyfOsTlwVzjHxKEqRIAdJx9niO6VCBCoEwax/VLSoQF29ggECcPuBqUMZ+u8jCZOPSy8b8/8KnuFbp0SaFZQ==", + "version": "10.4.16", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz", + "integrity": "sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==", "dev": true, "funding": [ { @@ -268,12 +593,16 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/autoprefixer" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], "dependencies": { - "browserslist": "^4.21.5", - "caniuse-lite": "^1.0.30001464", - "fraction.js": "^4.2.0", + "browserslist": "^4.21.10", + "caniuse-lite": "^1.0.30001538", + "fraction.js": "^4.3.6", "normalize-range": "^0.1.2", "picocolors": "^1.0.0", "postcss-value-parser": "^4.2.0" @@ -331,9 +660,9 @@ } }, "node_modules/browserslist": { - "version": "4.21.9", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz", - "integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==", + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", + "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", "funding": [ { "type": "opencollective", @@ -349,10 +678,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001503", - "electron-to-chromium": "^1.4.431", - "node-releases": "^2.0.12", - "update-browserslist-db": "^1.0.11" + "caniuse-lite": "^1.0.30001541", + "electron-to-chromium": "^1.4.535", + "node-releases": "^2.0.13", + "update-browserslist-db": "^1.0.13" }, "bin": { "browserslist": "cli.js" @@ -391,9 +720,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001509", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001509.tgz", - "integrity": "sha512-2uDDk+TRiTX5hMcUYT/7CSyzMZxjfGu0vAUjS2g0LSD8UoXOv0LtpH4LxGMemsiPq6LCVIUjNwVM0erkOkGCDA==", + "version": "1.0.30001555", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001555.tgz", + "integrity": "sha512-NzbUFKUnJ3DTcq6YyZB6+qqhfD112uR3uoEnkmfzm2wVzUNsFkU7AwBjKQ654Sp5cau0JxhFyRSn/tQZ+XfygA==", "funding": [ { "type": "opencollective", @@ -436,6 +765,18 @@ "fsevents": "~2.3.2" } }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/colord": { "version": "2.9.3", "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", @@ -456,9 +797,9 @@ "dev": true }, "node_modules/css-declaration-sorter": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.0.tgz", - "integrity": "sha512-jDfsatwWMWN0MODAFuHszfjphEXfNw9JUAhmY4pLu3TyTU+ohUpsbVtbU+1MZn4a47D9kqh03i4eyOm+74+zew==", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz", + "integrity": "sha512-rtdthzxKuyq6IzqX6jEcIzQF/YqccluefyCYheovBOLhFT/drQA9zj/UbRAa9J7C0o6EG6u3E6g+vKkay7/k3g==", "engines": { "node": "^10 || ^12 || >=14" }, @@ -704,9 +1045,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.447", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.447.tgz", - "integrity": "sha512-sxX0LXh+uL41hSJsujAN86PjhrV/6c79XmpY0TvjZStV6VxIgarf8SRkUoUTuYmFcZQTemsoqo8qXOGw5npWfw==" + "version": "1.4.569", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.569.tgz", + "integrity": "sha512-LsrJjZ0IbVy12ApW3gpYpcmHS3iRxH4bkKOW98y1/D+3cvDUWGcbzbsFinfUS8knpcZk/PG/2p/RnkMCYN7PVg==" }, "node_modules/entities": { "version": "2.2.0", @@ -723,9 +1064,9 @@ "dev": true }, "node_modules/esbuild": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.18.tgz", - "integrity": "sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", "dev": true, "hasInstallScript": true, "bin": { @@ -735,348 +1076,28 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.15.18", - "@esbuild/linux-loong64": "0.15.18", - "esbuild-android-64": "0.15.18", - "esbuild-android-arm64": "0.15.18", - "esbuild-darwin-64": "0.15.18", - "esbuild-darwin-arm64": "0.15.18", - "esbuild-freebsd-64": "0.15.18", - "esbuild-freebsd-arm64": "0.15.18", - "esbuild-linux-32": "0.15.18", - "esbuild-linux-64": "0.15.18", - "esbuild-linux-arm": "0.15.18", - "esbuild-linux-arm64": "0.15.18", - "esbuild-linux-mips64le": "0.15.18", - "esbuild-linux-ppc64le": "0.15.18", - "esbuild-linux-riscv64": "0.15.18", - "esbuild-linux-s390x": "0.15.18", - "esbuild-netbsd-64": "0.15.18", - "esbuild-openbsd-64": "0.15.18", - "esbuild-sunos-64": "0.15.18", - "esbuild-windows-32": "0.15.18", - "esbuild-windows-64": "0.15.18", - "esbuild-windows-arm64": "0.15.18" - } - }, - "node_modules/esbuild-android-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz", - "integrity": "sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-android-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.18.tgz", - "integrity": "sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-darwin-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.18.tgz", - "integrity": "sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-darwin-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.18.tgz", - "integrity": "sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-freebsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.18.tgz", - "integrity": "sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-freebsd-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.18.tgz", - "integrity": "sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-32": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.18.tgz", - "integrity": "sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.18.tgz", - "integrity": "sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-arm": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.18.tgz", - "integrity": "sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.18.tgz", - "integrity": "sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-mips64le": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.18.tgz", - "integrity": "sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-ppc64le": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.18.tgz", - "integrity": "sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-riscv64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.18.tgz", - "integrity": "sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-linux-s390x": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.18.tgz", - "integrity": "sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-netbsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.18.tgz", - "integrity": "sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-openbsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.18.tgz", - "integrity": "sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-sunos-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.18.tgz", - "integrity": "sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-windows-32": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.18.tgz", - "integrity": "sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-windows-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.18.tgz", - "integrity": "sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/esbuild-windows-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.18.tgz", - "integrity": "sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" } }, "node_modules/escalade": { @@ -1094,9 +1115,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", - "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -1109,6 +1130,18 @@ "node": ">=8.6.0" } }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", @@ -1131,9 +1164,21 @@ } }, "node_modules/follow-redirects": { +<<<<<<< HEAD +<<<<<<< HEAD + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", +======= + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", +>>>>>>> main +======= "version": "1.15.6", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", +>>>>>>> main "dev": true, "funding": [ { @@ -1151,16 +1196,16 @@ } }, "node_modules/fraction.js": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", - "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", + "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", "dev": true, "engines": { "node": "*" }, "funding": { "type": "patreon", - "url": "https://www.patreon.com/infusion" + "url": "https://github.com/sponsors/rawify" } }, "node_modules/fs.realpath": { @@ -1170,9 +1215,9 @@ "dev": true }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "optional": true, @@ -1184,10 +1229,13 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/glob": { "version": "7.2.3", @@ -1210,15 +1258,15 @@ } }, "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "dependencies": { - "is-glob": "^4.0.1" + "is-glob": "^4.0.3" }, "engines": { - "node": ">= 6" + "node": ">=10.13.0" } }, "node_modules/graceful-fs": { @@ -1227,16 +1275,16 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", "dev": true, "dependencies": { - "function-bind": "^1.1.1" + "function-bind": "^1.1.2" }, "engines": { - "node": ">= 0.4.0" + "node": ">= 0.4" } }, "node_modules/http-proxy": { @@ -1277,12 +1325,6 @@ } } }, - "node_modules/immutable": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.0.tgz", - "integrity": "sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==", - "dev": true - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1312,12 +1354,12 @@ } }, "node_modules/is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1366,9 +1408,9 @@ } }, "node_modules/jiti": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.18.2.tgz", - "integrity": "sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.20.0.tgz", + "integrity": "sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==", "dev": true, "bin": { "jiti": "bin/jiti.js" @@ -1417,12 +1459,12 @@ } }, "node_modules/magic-string": { - "version": "0.26.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.7.tgz", - "integrity": "sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow==", + "version": "0.30.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", + "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", "dev": true, "dependencies": { - "sourcemap-codec": "^1.4.8" + "@jridgewell/sourcemap-codec": "^1.4.15" }, "engines": { "node": ">=12" @@ -1551,9 +1593,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.12.tgz", - "integrity": "sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==" + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==" }, "node_modules/normalize-path": { "version": "3.0.0", @@ -1863,9 +1905,9 @@ } }, "node_modules/postcss-load-config/node_modules/yaml": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", - "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz", + "integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==", "dev": true, "engines": { "node": ">= 14" @@ -2245,12 +2287,12 @@ "dev": true }, "node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -2284,15 +2326,16 @@ } }, "node_modules/rollup": { - "version": "2.79.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", - "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", "dev": true, "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=10.0.0" + "node": ">=14.18.0", + "npm": ">=8.0.0" }, "optionalDependencies": { "fsevents": "~2.3.2" @@ -2333,36 +2376,19 @@ "rimraf": "^2.5.2" } }, - "node_modules/sass": { - "version": "1.63.6", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.63.6.tgz", - "integrity": "sha512-MJuxGMHzaOW7ipp+1KdELtqKbfAWbH7OLIdoSMnVe3EXPMTmxTmlaZDCTsgIpPCs3w99lLo9/zDKkOrJuT5byw==", - "dev": true, - "dependencies": { - "chokidar": ">=3.0.0 <4.0.0", - "immutable": "^4.0.0", - "source-map-js": ">=0.6.2 <2.0.0" - }, - "bin": { - "sass": "sass.js" - }, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/sorcery": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.10.0.tgz", - "integrity": "sha512-R5ocFmKZQFfSTstfOtHjJuAwbpGyf9qjQa1egyhvXSbM7emjrtLXtGdZsDJDABC85YBfVvrOiGWKSYXPKdvP1g==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.11.0.tgz", + "integrity": "sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==", "dev": true, "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.14", "buffer-crc32": "^0.2.5", "minimist": "^1.2.0", - "sander": "^0.5.0", - "sourcemap-codec": "^1.3.0" + "sander": "^0.5.0" }, "bin": { - "sorcery": "bin/index.js" + "sorcery": "bin/sorcery" } }, "node_modules/source-map": { @@ -2381,13 +2407,6 @@ "node": ">=0.10.0" } }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "deprecated": "Please use @jridgewell/sourcemap-codec instead", - "dev": true - }, "node_modules/stable": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", @@ -2422,9 +2441,9 @@ } }, "node_modules/sucrase": { - "version": "3.32.0", - "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.32.0.tgz", - "integrity": "sha512-ydQOU34rpSyj2TGyz4D2p8rbktIOZ8QY9s+DGLvFU1i5pWJE8vkpruCjGCMHsdXwnD7JDcS+noSwM/a7zyNFDQ==", + "version": "3.34.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.34.0.tgz", + "integrity": "sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw==", "dev": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", @@ -2494,15 +2513,15 @@ } }, "node_modules/svelte-hmr": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.2.tgz", - "integrity": "sha512-q/bAruCvFLwvNbeE1x3n37TYFb3mTBJ6TrCq6p2CoFbSTNhDE9oAtEfpy+wmc9So8AG0Tja+X0/mJzX9tSfvIg==", + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.3.tgz", + "integrity": "sha512-41snaPswvSf8TJUhlkoJBekRrABDXDMdpNpT2tfHIv4JuhgvHqLMhEPGtaQn0BmbNSTkuz2Ed20DF2eHw0SmBQ==", "dev": true, "engines": { "node": "^12.20 || ^14.13.1 || >= 16" }, "peerDependencies": { - "svelte": "^3.19.0 || ^4.0.0-next.0" + "svelte": "^3.19.0 || ^4.0.0" } }, "node_modules/svelte-navigator": { @@ -2519,21 +2538,20 @@ } }, "node_modules/svelte-preprocess": { - "version": "4.10.7", - "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-4.10.7.tgz", - "integrity": "sha512-sNPBnqYD6FnmdBrUmBCaqS00RyCsCpj2BG58A1JBswNF7b0OKviwxqVrOL/CKyJrLSClrSeqQv5BXNg2RUbPOw==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.0.4.tgz", + "integrity": "sha512-ABia2QegosxOGsVlsSBJvoWeXy1wUKSfF7SWJdTjLAbx/Y3SrVevvvbFNQqrSJw89+lNSsM58SipmZJ5SRi5iw==", "dev": true, "hasInstallScript": true, "dependencies": { - "@types/pug": "^2.0.4", - "@types/sass": "^1.16.0", - "detect-indent": "^6.0.0", - "magic-string": "^0.25.7", - "sorcery": "^0.10.0", + "@types/pug": "^2.0.6", + "detect-indent": "^6.1.0", + "magic-string": "^0.27.0", + "sorcery": "^0.11.0", "strip-indent": "^3.0.0" }, "engines": { - "node": ">= 9.11.2" + "node": ">= 14.10.0" }, "peerDependencies": { "@babel/core": "^7.10.2", @@ -2544,9 +2562,9 @@ "pug": "^3.0.0", "sass": "^1.26.8", "stylus": "^0.55.0", - "sugarss": "^2.0.0", - "svelte": "^3.23.0", - "typescript": "^3.9.5 || ^4.0.0" + "sugarss": "^2.0.0 || ^3.0.0 || ^4.0.0", + "svelte": "^3.23.0 || ^4.0.0-next.0 || ^4.0.0", + "typescript": ">=3.9.5 || ^4.0.0 || ^5.0.0" }, "peerDependenciesMeta": { "@babel/core": { @@ -2558,9 +2576,6 @@ "less": { "optional": true }, - "node-sass": { - "optional": true - }, "postcss": { "optional": true }, @@ -2585,12 +2600,15 @@ } }, "node_modules/svelte-preprocess/node_modules/magic-string": { - "version": "0.25.9", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", + "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==", "dev": true, "dependencies": { - "sourcemap-codec": "^1.4.8" + "@jridgewell/sourcemap-codec": "^1.4.13" + }, + "engines": { + "node": ">=12" } }, "node_modules/svelte-qrcode": { @@ -2634,9 +2652,9 @@ } }, "node_modules/tailwindcss": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.2.tgz", - "integrity": "sha512-9jPkMiIBXvPc2KywkraqsUfbfj+dHDb+JPWtSJa9MLFdrPyazI7q6WX2sUrm7R9eVR7qqv3Pas7EvQFzxKnI6w==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", + "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", "dev": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", @@ -2644,10 +2662,10 @@ "chokidar": "^3.5.3", "didyoumean": "^1.2.2", "dlv": "^1.1.3", - "fast-glob": "^3.2.12", + "fast-glob": "^3.3.0", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.18.2", + "jiti": "^1.19.1", "lilconfig": "^2.1.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", @@ -2659,7 +2677,6 @@ "postcss-load-config": "^4.0.1", "postcss-nested": "^6.0.1", "postcss-selector-parser": "^6.0.11", - "postcss-value-parser": "^4.2.0", "resolve": "^1.22.2", "sucrase": "^3.32.0" }, @@ -2671,18 +2688,6 @@ "node": ">=14.0.0" } }, - "node_modules/tailwindcss/node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, "node_modules/thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", @@ -2723,9 +2728,9 @@ "dev": true }, "node_modules/tslib": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", - "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "dev": true }, "node_modules/typescript": { @@ -2742,10 +2747,16 @@ "node": ">=4.2.0" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "funding": [ { "type": "opencollective", @@ -2777,15 +2788,26 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { +<<<<<<< HEAD +<<<<<<< HEAD + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.0.tgz", + "integrity": "sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==", +======= + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.8.tgz", + "integrity": "sha512-EtQU16PLIJpAZol2cTLttNP1mX6L0SyI0pgQB1VOoWeQnMSvtiwovV3D6NcjN8CZQWWyESD2v5NGnpz5RvgOZA==", +>>>>>>> main +======= "version": "3.2.10", "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.10.tgz", "integrity": "sha512-Dx3olBo/ODNiMVk/cA5Yft9Ws+snLOXrhLtrI3F4XLt4syz2Yg8fayZMWScPKoz12v5BUv7VEmQHnsfpY80fYw==", +>>>>>>> main "dev": true, "dependencies": { - "esbuild": "^0.15.9", - "postcss": "^8.4.18", - "resolve": "^1.22.1", - "rollup": "^2.79.1" + "esbuild": "^0.18.10", + "postcss": "^8.4.27", + "rollup": "^3.27.1" }, "bin": { "vite": "bin/vite.js" @@ -2793,12 +2815,16 @@ "engines": { "node": "^14.18.0 || >=16.0.0" }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, "optionalDependencies": { "fsevents": "~2.3.2" }, "peerDependencies": { "@types/node": ">= 14", "less": "*", + "lightningcss": "^1.21.0", "sass": "*", "stylus": "*", "sugarss": "*", @@ -2811,6 +2837,9 @@ "less": { "optional": true }, + "lightningcss": { + "optional": true + }, "sass": { "optional": true }, @@ -2826,12 +2855,12 @@ } }, "node_modules/vitefu": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.4.tgz", - "integrity": "sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.5.tgz", + "integrity": "sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==", "dev": true, "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0" + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0" }, "peerDependenciesMeta": { "vite": { @@ -2862,16 +2891,156 @@ "dev": true }, "@esbuild/android-arm": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.18.tgz", - "integrity": "sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", + "dev": true, + "optional": true + }, + "@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", + "dev": true, + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", "dev": true, "optional": true }, "@esbuild/linux-loong64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.18.tgz", - "integrity": "sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", + "dev": true, + "optional": true + }, + "@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", + "dev": true, + "optional": true + }, + "@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "dev": true, + "optional": true + }, + "@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", + "dev": true, + "optional": true + }, + "@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", + "dev": true, + "optional": true + }, + "@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", + "dev": true, + "optional": true + }, + "@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", + "dev": true, + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", + "dev": true, + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", "dev": true, "optional": true }, @@ -2887,9 +3056,9 @@ } }, "@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", "dev": true }, "@jridgewell/set-array": { @@ -2905,21 +3074,13 @@ "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", - "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "dev": true, "requires": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - }, - "dependencies": { - "@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true - } + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "@nodelib/fs.scandir": { @@ -2949,23 +3110,33 @@ } }, "@sveltejs/vite-plugin-svelte": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.4.0.tgz", - "integrity": "sha512-6QupI/jemMfK+yI2pMtJcu5iO2gtgTfcBdGwMZZt+lgbFELhszbDl6Qjh000HgAV8+XUA+8EY8DusOFk8WhOIg==", + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.4.6.tgz", + "integrity": "sha512-zO79p0+DZnXPnF0ltIigWDx/ux7Ni+HRaFOw720Qeivc1azFUrJxTl0OryXVibYNx1hCboGia1NRV3x8RNv4cA==", "dev": true, "requires": { + "@sveltejs/vite-plugin-svelte-inspector": "^1.0.4", "debug": "^4.3.4", - "deepmerge": "^4.2.2", + "deepmerge": "^4.3.1", "kleur": "^4.1.5", - "magic-string": "^0.26.7", - "svelte-hmr": "^0.15.1", - "vitefu": "^0.2.2" + "magic-string": "^0.30.3", + "svelte-hmr": "^0.15.3", + "vitefu": "^0.2.4" + } + }, + "@sveltejs/vite-plugin-svelte-inspector": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-1.0.4.tgz", + "integrity": "sha512-zjiuZ3yydBtwpF3bj0kQNV0YXe+iKE545QGZVTaylW3eAzFr+pJ/cwK8lZEaRp4JtaJXhD5DyWAV4AxLh6DgaQ==", + "dev": true, + "requires": { + "debug": "^4.3.4" } }, "@tailwindcss/forms": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.3.tgz", - "integrity": "sha512-y5mb86JUoiUgBjY/o6FJSFZSEttfb3Q5gllE4xoKjAAD+vBrnIhE4dViwUuow3va8mpH4s9jyUbUbrRGoRdc2Q==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.6.tgz", + "integrity": "sha512-Fw+2BJ0tmAwK/w01tEFL5TiaJBX1NLT1/YbWgvm7ws3Qcn11kiXxzNTEQDMs5V3mQemhB56l3u0i9dwdzSQldA==", "dev": true, "requires": { "mini-svg-data-uri": "^1.2.3" @@ -2977,35 +3148,29 @@ "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==" }, "@types/http-proxy": { - "version": "1.17.11", - "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.11.tgz", - "integrity": "sha512-HC8G7c1WmaF2ekqpnFq626xd3Zz0uvaqFmBJNRZCGEZCXkvSdJoNFn/8Ygbd9fKNQj8UzLdCETaI0UWPAjK7IA==", + "version": "1.17.13", + "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.13.tgz", + "integrity": "sha512-GkhdWcMNiR5QSQRYnJ+/oXzu0+7JJEPC8vkWXK351BkhjraZF+1W13CUYARUvX9+NqIU2n6YHA4iwywsc/M6Sw==", "dev": true, "requires": { "@types/node": "*" } }, "@types/node": { - "version": "20.3.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.3.tgz", - "integrity": "sha512-wheIYdr4NYML61AjC8MKj/2jrR/kDQri/CIpVoZwldwhnIrD/j9jIU5bJ8yBKuB2VhpFV7Ab6G2XkBjv9r9Zzw==", - "dev": true - }, - "@types/pug": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.6.tgz", - "integrity": "sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==", - "dev": true - }, - "@types/sass": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/@types/sass/-/sass-1.45.0.tgz", - "integrity": "sha512-jn7qwGFmJHwUSphV8zZneO3GmtlgLsmhs/LQyVvQbIIa+fzGMUiHI4HXJZL3FT8MJmgXWbLGiVVY7ElvHq6vDA==", + "version": "20.8.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", + "integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", "dev": true, "requires": { - "sass": "*" + "undici-types": "~5.26.4" } }, + "@types/pug": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.8.tgz", + "integrity": "sha512-QzhsZ1dMGyJbn/D9V80zp4GIA4J4rfAjCCxc3MP+new0E8dyVdSkR735Lx+n3LIaHNFcjHL5+TbziccuT+fdoQ==", + "dev": true + }, "any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", @@ -3029,14 +3194,14 @@ "dev": true }, "autoprefixer": { - "version": "10.4.14", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.14.tgz", - "integrity": "sha512-FQzyfOsTlwVzjHxKEqRIAdJx9niO6VCBCoEwax/VLSoQF29ggECcPuBqUMZ+u8jCZOPSy8b8/8KnuFbp0SaFZQ==", + "version": "10.4.16", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz", + "integrity": "sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==", "dev": true, "requires": { - "browserslist": "^4.21.5", - "caniuse-lite": "^1.0.30001464", - "fraction.js": "^4.2.0", + "browserslist": "^4.21.10", + "caniuse-lite": "^1.0.30001538", + "fraction.js": "^4.3.6", "normalize-range": "^0.1.2", "picocolors": "^1.0.0", "postcss-value-parser": "^4.2.0" @@ -3079,14 +3244,14 @@ } }, "browserslist": { - "version": "4.21.9", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz", - "integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==", + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", + "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", "requires": { - "caniuse-lite": "^1.0.30001503", - "electron-to-chromium": "^1.4.431", - "node-releases": "^2.0.12", - "update-browserslist-db": "^1.0.11" + "caniuse-lite": "^1.0.30001541", + "electron-to-chromium": "^1.4.535", + "node-releases": "^2.0.13", + "update-browserslist-db": "^1.0.13" } }, "buffer-crc32": { @@ -3113,9 +3278,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001509", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001509.tgz", - "integrity": "sha512-2uDDk+TRiTX5hMcUYT/7CSyzMZxjfGu0vAUjS2g0LSD8UoXOv0LtpH4LxGMemsiPq6LCVIUjNwVM0erkOkGCDA==" + "version": "1.0.30001555", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001555.tgz", + "integrity": "sha512-NzbUFKUnJ3DTcq6YyZB6+qqhfD112uR3uoEnkmfzm2wVzUNsFkU7AwBjKQ654Sp5cau0JxhFyRSn/tQZ+XfygA==" }, "chokidar": { "version": "3.5.3", @@ -3131,6 +3296,17 @@ "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } } }, "colord": { @@ -3150,9 +3326,9 @@ "dev": true }, "css-declaration-sorter": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.0.tgz", - "integrity": "sha512-jDfsatwWMWN0MODAFuHszfjphEXfNw9JUAhmY4pLu3TyTU+ohUpsbVtbU+1MZn4a47D9kqh03i4eyOm+74+zew==", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz", + "integrity": "sha512-rtdthzxKuyq6IzqX6jEcIzQF/YqccluefyCYheovBOLhFT/drQA9zj/UbRAa9J7C0o6EG6u3E6g+vKkay7/k3g==", "requires": {} }, "css-select": { @@ -3319,9 +3495,9 @@ } }, "electron-to-chromium": { - "version": "1.4.447", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.447.tgz", - "integrity": "sha512-sxX0LXh+uL41hSJsujAN86PjhrV/6c79XmpY0TvjZStV6VxIgarf8SRkUoUTuYmFcZQTemsoqo8qXOGw5npWfw==" + "version": "1.4.569", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.569.tgz", + "integrity": "sha512-LsrJjZ0IbVy12ApW3gpYpcmHS3iRxH4bkKOW98y1/D+3cvDUWGcbzbsFinfUS8knpcZk/PG/2p/RnkMCYN7PVg==" }, "entities": { "version": "2.2.0", @@ -3335,174 +3511,34 @@ "dev": true }, "esbuild": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.18.tgz", - "integrity": "sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", "dev": true, "requires": { - "@esbuild/android-arm": "0.15.18", - "@esbuild/linux-loong64": "0.15.18", - "esbuild-android-64": "0.15.18", - "esbuild-android-arm64": "0.15.18", - "esbuild-darwin-64": "0.15.18", - "esbuild-darwin-arm64": "0.15.18", - "esbuild-freebsd-64": "0.15.18", - "esbuild-freebsd-arm64": "0.15.18", - "esbuild-linux-32": "0.15.18", - "esbuild-linux-64": "0.15.18", - "esbuild-linux-arm": "0.15.18", - "esbuild-linux-arm64": "0.15.18", - "esbuild-linux-mips64le": "0.15.18", - "esbuild-linux-ppc64le": "0.15.18", - "esbuild-linux-riscv64": "0.15.18", - "esbuild-linux-s390x": "0.15.18", - "esbuild-netbsd-64": "0.15.18", - "esbuild-openbsd-64": "0.15.18", - "esbuild-sunos-64": "0.15.18", - "esbuild-windows-32": "0.15.18", - "esbuild-windows-64": "0.15.18", - "esbuild-windows-arm64": "0.15.18" - } - }, - "esbuild-android-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz", - "integrity": "sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==", - "dev": true, - "optional": true - }, - "esbuild-android-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.18.tgz", - "integrity": "sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==", - "dev": true, - "optional": true - }, - "esbuild-darwin-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.18.tgz", - "integrity": "sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==", - "dev": true, - "optional": true - }, - "esbuild-darwin-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.18.tgz", - "integrity": "sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==", - "dev": true, - "optional": true - }, - "esbuild-freebsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.18.tgz", - "integrity": "sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==", - "dev": true, - "optional": true - }, - "esbuild-freebsd-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.18.tgz", - "integrity": "sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==", - "dev": true, - "optional": true - }, - "esbuild-linux-32": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.18.tgz", - "integrity": "sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==", - "dev": true, - "optional": true - }, - "esbuild-linux-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.18.tgz", - "integrity": "sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==", - "dev": true, - "optional": true - }, - "esbuild-linux-arm": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.18.tgz", - "integrity": "sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==", - "dev": true, - "optional": true - }, - "esbuild-linux-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.18.tgz", - "integrity": "sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==", - "dev": true, - "optional": true - }, - "esbuild-linux-mips64le": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.18.tgz", - "integrity": "sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==", - "dev": true, - "optional": true - }, - "esbuild-linux-ppc64le": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.18.tgz", - "integrity": "sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==", - "dev": true, - "optional": true - }, - "esbuild-linux-riscv64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.18.tgz", - "integrity": "sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==", - "dev": true, - "optional": true - }, - "esbuild-linux-s390x": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.18.tgz", - "integrity": "sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==", - "dev": true, - "optional": true - }, - "esbuild-netbsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.18.tgz", - "integrity": "sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==", - "dev": true, - "optional": true - }, - "esbuild-openbsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.18.tgz", - "integrity": "sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==", - "dev": true, - "optional": true - }, - "esbuild-sunos-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.18.tgz", - "integrity": "sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==", - "dev": true, - "optional": true - }, - "esbuild-windows-32": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.18.tgz", - "integrity": "sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==", - "dev": true, - "optional": true - }, - "esbuild-windows-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.18.tgz", - "integrity": "sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==", - "dev": true, - "optional": true - }, - "esbuild-windows-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.18.tgz", - "integrity": "sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==", - "dev": true, - "optional": true + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" + } }, "escalade": { "version": "3.1.1", @@ -3516,9 +3552,9 @@ "dev": true }, "fast-glob": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", - "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -3526,6 +3562,17 @@ "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.4" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } } }, "fastq": { @@ -3547,15 +3594,27 @@ } }, "follow-redirects": { +<<<<<<< HEAD +<<<<<<< HEAD + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", +======= + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", +>>>>>>> main +======= "version": "1.15.6", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", +>>>>>>> main "dev": true }, "fraction.js": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", - "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", + "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", "dev": true }, "fs.realpath": { @@ -3565,16 +3624,16 @@ "dev": true }, "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "optional": true }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true }, "glob": { @@ -3592,12 +3651,12 @@ } }, "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "requires": { - "is-glob": "^4.0.1" + "is-glob": "^4.0.3" } }, "graceful-fs": { @@ -3606,13 +3665,13 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", "dev": true, "requires": { - "function-bind": "^1.1.1" + "function-bind": "^1.1.2" } }, "http-proxy": { @@ -3639,12 +3698,6 @@ "micromatch": "^4.0.2" } }, - "immutable": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.0.tgz", - "integrity": "sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==", - "dev": true - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -3671,12 +3724,12 @@ } }, "is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "requires": { - "has": "^1.0.3" + "hasown": "^2.0.0" } }, "is-extglob": { @@ -3707,9 +3760,9 @@ "dev": true }, "jiti": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.18.2.tgz", - "integrity": "sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.20.0.tgz", + "integrity": "sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==", "dev": true }, "kleur": { @@ -3749,12 +3802,12 @@ } }, "magic-string": { - "version": "0.26.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.7.tgz", - "integrity": "sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow==", + "version": "0.30.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", + "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", "dev": true, "requires": { - "sourcemap-codec": "^1.4.8" + "@jridgewell/sourcemap-codec": "^1.4.15" } }, "mdn-data": { @@ -3847,9 +3900,9 @@ } }, "node-releases": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.12.tgz", - "integrity": "sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==" + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==" }, "normalize-path": { "version": "3.0.0", @@ -4036,9 +4089,9 @@ }, "dependencies": { "yaml": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", - "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz", + "integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==", "dev": true } } @@ -4268,12 +4321,12 @@ "dev": true }, "resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "requires": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } @@ -4294,9 +4347,9 @@ } }, "rollup": { - "version": "2.79.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", - "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", "dev": true, "requires": { "fsevents": "~2.3.2" @@ -4323,27 +4376,16 @@ "rimraf": "^2.5.2" } }, - "sass": { - "version": "1.63.6", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.63.6.tgz", - "integrity": "sha512-MJuxGMHzaOW7ipp+1KdELtqKbfAWbH7OLIdoSMnVe3EXPMTmxTmlaZDCTsgIpPCs3w99lLo9/zDKkOrJuT5byw==", - "dev": true, - "requires": { - "chokidar": ">=3.0.0 <4.0.0", - "immutable": "^4.0.0", - "source-map-js": ">=0.6.2 <2.0.0" - } - }, "sorcery": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.10.0.tgz", - "integrity": "sha512-R5ocFmKZQFfSTstfOtHjJuAwbpGyf9qjQa1egyhvXSbM7emjrtLXtGdZsDJDABC85YBfVvrOiGWKSYXPKdvP1g==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.11.0.tgz", + "integrity": "sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==", "dev": true, "requires": { + "@jridgewell/sourcemap-codec": "^1.4.14", "buffer-crc32": "^0.2.5", "minimist": "^1.2.0", - "sander": "^0.5.0", - "sourcemap-codec": "^1.3.0" + "sander": "^0.5.0" } }, "source-map": { @@ -4356,12 +4398,6 @@ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==" }, - "sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "dev": true - }, "stable": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", @@ -4386,9 +4422,9 @@ } }, "sucrase": { - "version": "3.32.0", - "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.32.0.tgz", - "integrity": "sha512-ydQOU34rpSyj2TGyz4D2p8rbktIOZ8QY9s+DGLvFU1i5pWJE8vkpruCjGCMHsdXwnD7JDcS+noSwM/a7zyNFDQ==", + "version": "3.34.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.34.0.tgz", + "integrity": "sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw==", "dev": true, "requires": { "@jridgewell/gen-mapping": "^0.3.2", @@ -4435,9 +4471,9 @@ "dev": true }, "svelte-hmr": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.2.tgz", - "integrity": "sha512-q/bAruCvFLwvNbeE1x3n37TYFb3mTBJ6TrCq6p2CoFbSTNhDE9oAtEfpy+wmc9So8AG0Tja+X0/mJzX9tSfvIg==", + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.3.tgz", + "integrity": "sha512-41snaPswvSf8TJUhlkoJBekRrABDXDMdpNpT2tfHIv4JuhgvHqLMhEPGtaQn0BmbNSTkuz2Ed20DF2eHw0SmBQ==", "dev": true, "requires": {} }, @@ -4451,26 +4487,25 @@ } }, "svelte-preprocess": { - "version": "4.10.7", - "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-4.10.7.tgz", - "integrity": "sha512-sNPBnqYD6FnmdBrUmBCaqS00RyCsCpj2BG58A1JBswNF7b0OKviwxqVrOL/CKyJrLSClrSeqQv5BXNg2RUbPOw==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.0.4.tgz", + "integrity": "sha512-ABia2QegosxOGsVlsSBJvoWeXy1wUKSfF7SWJdTjLAbx/Y3SrVevvvbFNQqrSJw89+lNSsM58SipmZJ5SRi5iw==", "dev": true, "requires": { - "@types/pug": "^2.0.4", - "@types/sass": "^1.16.0", - "detect-indent": "^6.0.0", - "magic-string": "^0.25.7", - "sorcery": "^0.10.0", + "@types/pug": "^2.0.6", + "detect-indent": "^6.1.0", + "magic-string": "^0.27.0", + "sorcery": "^0.11.0", "strip-indent": "^3.0.0" }, "dependencies": { "magic-string": { - "version": "0.25.9", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", + "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==", "dev": true, "requires": { - "sourcemap-codec": "^1.4.8" + "@jridgewell/sourcemap-codec": "^1.4.13" } } } @@ -4506,9 +4541,9 @@ } }, "tailwindcss": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.2.tgz", - "integrity": "sha512-9jPkMiIBXvPc2KywkraqsUfbfj+dHDb+JPWtSJa9MLFdrPyazI7q6WX2sUrm7R9eVR7qqv3Pas7EvQFzxKnI6w==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", + "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", "dev": true, "requires": { "@alloc/quick-lru": "^5.2.0", @@ -4516,10 +4551,10 @@ "chokidar": "^3.5.3", "didyoumean": "^1.2.2", "dlv": "^1.1.3", - "fast-glob": "^3.2.12", + "fast-glob": "^3.3.0", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.18.2", + "jiti": "^1.19.1", "lilconfig": "^2.1.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", @@ -4531,20 +4566,8 @@ "postcss-load-config": "^4.0.1", "postcss-nested": "^6.0.1", "postcss-selector-parser": "^6.0.11", - "postcss-value-parser": "^4.2.0", "resolve": "^1.22.2", "sucrase": "^3.32.0" - }, - "dependencies": { - "glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "requires": { - "is-glob": "^4.0.3" - } - } } }, "thenify": { @@ -4581,9 +4604,9 @@ "dev": true }, "tslib": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", - "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "dev": true }, "typescript": { @@ -4593,10 +4616,16 @@ "dev": true, "peer": true }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "requires": { "escalade": "^3.1.1", "picocolors": "^1.0.0" @@ -4608,22 +4637,33 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "vite": { +<<<<<<< HEAD +<<<<<<< HEAD + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.0.tgz", + "integrity": "sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==", +======= + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.8.tgz", + "integrity": "sha512-EtQU16PLIJpAZol2cTLttNP1mX6L0SyI0pgQB1VOoWeQnMSvtiwovV3D6NcjN8CZQWWyESD2v5NGnpz5RvgOZA==", +>>>>>>> main +======= "version": "3.2.10", "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.10.tgz", "integrity": "sha512-Dx3olBo/ODNiMVk/cA5Yft9Ws+snLOXrhLtrI3F4XLt4syz2Yg8fayZMWScPKoz12v5BUv7VEmQHnsfpY80fYw==", +>>>>>>> main "dev": true, "requires": { - "esbuild": "^0.15.9", + "esbuild": "^0.18.10", "fsevents": "~2.3.2", - "postcss": "^8.4.18", - "resolve": "^1.22.1", - "rollup": "^2.79.1" + "postcss": "^8.4.27", + "rollup": "^3.27.1" } }, "vitefu": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.4.tgz", - "integrity": "sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.5.tgz", + "integrity": "sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==", "dev": true, "requires": {} }, diff --git a/lib/SvelteUi/app/package.json b/lib/SvelteUi/app/package.json index 2fd90711..74235a64 100644 --- a/lib/SvelteUi/app/package.json +++ b/lib/SvelteUi/app/package.json @@ -5,24 +5,25 @@ "type": "module", "scripts": { "dev": "vite", + "local": "vite --config vite.config.local.js", "build": "vite build", "preview": "vite preview" }, "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^1.0.1", - "@tailwindcss/forms": "^0.5.2", - "autoprefixer": "^10.4.7", - "http-proxy-middleware": "^2.0.1", + "@sveltejs/vite-plugin-svelte": "^2.1.0", + "@tailwindcss/forms": "^0.5.3", + "autoprefixer": "^10.4.14", + "http-proxy-middleware": "^2.0.6", "postcss": "^8.4.31", "postcss-load-config": "^4.0.1", - "svelte": "^3.49.0", + "svelte": "^3.58.0", "svelte-navigator": "^3.2.2", - "svelte-preprocess": "^4.10.7", + "svelte-preprocess": "^5.0.3", "svelte-qrcode": "^1.0.0", - "tailwindcss": "^3.1.5", - "vite": "^3.2.10" + "tailwindcss": "^3.3.1", + "vite": "^4.3.1" }, "dependencies": { - "cssnano": "^5.1.14" + "cssnano": "^5.1.15" } } diff --git a/lib/SvelteUi/app/src/App.svelte b/lib/SvelteUi/app/src/App.svelte index 96e7a160..c2f417cc 100644 --- a/lib/SvelteUi/app/src/App.svelte +++ b/lib/SvelteUi/app/src/App.svelte @@ -1,6 +1,8 @@ + +
- -
+ +
- + + + + @@ -51,13 +82,13 @@ - + - + diff --git a/lib/SvelteUi/app/src/app.postcss b/lib/SvelteUi/app/src/app.postcss index 0a8b8d21..d512fbf3 100644 --- a/lib/SvelteUi/app/src/app.postcss +++ b/lib/SvelteUi/app/src/app.postcss @@ -2,13 +2,17 @@ @tailwind components; @tailwind utilities; -.gh-logo { +.hdr { + @apply bg-violet-600 p-1 rounded-md mx-2 dark:bg-violet-900 +} + +.logo { width: 2rem; height: 2rem; } .cnt { - @apply bg-white m-2 p-2 rounded shadow-lg; + @apply m-2 p-2 rounded dark:bg-gray-800 bg-white dark:text-white shadow-lg dark:shadow-gray-900 dark:drop-shadow-md; min-height: 268px; } @@ -17,53 +21,70 @@ } .in-pre { - @apply flex items-center bg-gray-100 rounded-l-md border border-r-0 border-gray-300 px-3 whitespace-nowrap text-sm + @apply flex items-center bg-gray-100 dark:bg-gray-600 rounded-l-md border border-r-0 dark:border-gray-800 border-gray-300 px-3 whitespace-nowrap text-sm } .in-post { - @apply flex items-center bg-gray-100 rounded-r-md border border-l-0 border-gray-300 px-3 whitespace-nowrap text-sm + @apply flex items-center bg-gray-100 dark:bg-gray-600 rounded-r-md border border-l-0 dark:border-gray-800 border-gray-300 px-3 whitespace-nowrap text-sm } .in-txt { - @apply h-10 shadow-sm border-gray-300 disabled:bg-gray-200 + @apply h-10 shadow-sm border-gray-300 dark:border-gray-800 disabled:bg-gray-200 dark:disabled:bg-gray-700 disabled:text-white + disabled:cursor-not-allowed dark:text-white dark:bg-gray-700 dark:shadow-lg dark:border dark:focus:ring-4 dark:drop-shadow-lg } .in-f { - @apply in-txt rounded-l-md + @apply in-txt rounded-l-md dark:placeholder:text-gray-400 dark:default:text-white disabled:text-white default:text-white } .in-m { @apply in-txt border-l-0 } .in-l { - @apply in-txt border-l-0 rounded-r-md + @apply in-txt border-l-0 rounded-r-md dark:placeholder-white } .in-s { - @apply in-txt rounded-md w-full + @apply in-txt rounded-md w-full dark:text-white placeholder:text-gray-400 } .tr { @apply text-right } .bd-green { - @apply my-auto bg-green-500 text-green-100 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded + @apply my-auto bg-green-600 text-green-100 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded } .bd-yellow { - @apply my-auto bg-yellow-500 text-yellow-100 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded + @apply my-auto bg-yellow-600 text-yellow-100 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded } .bd-red { - @apply my-auto bg-red-500 text-red-100 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded + @apply my-auto bg-red-600 text-red-100 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded } .bd-blue { - @apply my-auto bg-blue-500 text-blue-100 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded + @apply my-auto bg-blue-600 text-blue-100 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded } .bd-gray { - @apply my-auto bg-gray-500 text-gray-100 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded + @apply my-auto bg-gray-600 text-gray-100 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded +} + +.bd-on { + @apply my-auto bg-green-600 text-green-100 text-xs font-semibold mr-1 px-1 py-0.5 rounded +} +.bd-off { + @apply my-auto bg-gray-600 text-gray-100 text-xs font-semibold mr-1 px-1 py-0.5 rounded } .btn-pri { - @apply py-2 px-4 rounded bg-blue-500 text-white mr-3 + @apply py-2 px-4 rounded bg-blue-600 text-white mr-3 +} +.btn-red { + @apply py-2 px-4 rounded bg-red-600 text-white ml-2 +} +.btn-yellow { + @apply py-2 px-4 rounded bg-yellow-600 text-white ml-2 } .btn-pri-sm { - @apply text-xs py-1 px-2 rounded bg-blue-500 text-white mr-3 + @apply text-xs py-1 px-2 rounded bg-blue-600 text-white mr-3 +} +.btn-yellow-sm { + @apply text-xs py-1 px-2 rounded bg-yellow-600 text-white mr-3 } .pl-root { @@ -82,6 +103,7 @@ .pl-unt { font-size: 1.0rem; color: grey; + @apply dark:text-gray-200 } .pl-sub { padding-top: 10px; @@ -90,6 +112,7 @@ .pl-snt { font-size: 0.7rem; color: grey; + @apply dark:text-gray-200 } .pl-lab { font-size: 1.0rem; @@ -110,6 +133,7 @@ svg { font-family: Helvetica, Arial; font-size: 0.85em; font-weight: 200; + @apply dark:fill-white text-white } .tick line { @@ -120,6 +144,7 @@ svg { .tick text { fill: #999; text-anchor: start; + @apply dark:fill-white } .tick.tick-0 line { @@ -127,19 +152,19 @@ svg { } .tick.tick-green line { - stroke: #32d900 !important; + stroke: #23ac05 !important; } .tick.tick-green text { - fill: #32d900 !important; + fill: #23ac05 !important; } .tick.tick-orange line { - stroke: #d95600 !important; + stroke: #b19601 !important; } .tick.tick-orange text { - fill: #d95600 !important; + fill: #b19601 !important; } .x-axis .tick text { diff --git a/lib/SvelteUi/app/src/lib/AccountingData.svelte b/lib/SvelteUi/app/src/lib/AccountingData.svelte index c775c8f5..139c9dec 100644 --- a/lib/SvelteUi/app/src/lib/AccountingData.svelte +++ b/lib/SvelteUi/app/src/lib/AccountingData.svelte @@ -1,77 +1,94 @@
- Real time calculation + {translations.realtime?.title ?? "Real time calculations"}

{#if data} {#if hasExport} - Import + {translations.common?.import ?? "Import"}
-
Hour
-
{fmtnum(data.h.u,2)} kWh
+
{capitalize(translations.common?.hour ?? "Hour")}
+
{rih[0]} {rih[1]}
{#if hasCost}
{fmtnum(data.h.c,2)} {currency}
{/if} -
Day
-
{fmtnum(data.d.u,1)} kWh
+
{capitalize(translations.common?.day ?? "Day")}
+
{rid[0]} {rid[1]}
{#if hasCost}
{fmtnum(data.d.c,1)} {currency}
{/if} -
Month
-
{fmtnum(data.m.u)} kWh
+
{capitalize(translations.common?.month ?? "Month")}
+
{rim[0]} {rim[1]}
{#if hasCost}
{fmtnum(data.m.c)} {currency}
{/if} -
Last mo.
-
{fmtnum(sysinfo.last_month.u)} kWh
+
{translations.realtime?.last_mo ?? "Last mo."}
+
{ril[0]} {ril[1]}
{#if hasCost}
{fmtnum(sysinfo.last_month.c)} {currency}
{/if}
- Export + {translations.common?.export ?? "Export"}
-
Hour
-
{fmtnum(data.h.p,2)} kWh
+
{capitalize(translations.common?.hour ?? "Hour")}
+
{reh[0]} {reh[1]}
{#if hasCost}
{fmtnum(data.h.i,2)} {currency}
{/if} -
Day
-
{fmtnum(data.d.p,1)} kWh
+
{capitalize(translations.common?.day ?? "Day")}
+
{red[0]} {red[1]}
{#if hasCost}
{fmtnum(data.d.i,1)} {currency}
{/if} -
Month
-
{fmtnum(data.m.p)} kWh
+
{capitalize(translations.common?.month ?? "Month")}
+
{rem[0]} {rem[1]}
{#if hasCost}
{fmtnum(data.m.i)} {currency}
{/if} -
Last mo.
-
{fmtnum(sysinfo.last_month.p)} kWh
+
{translations.realtime?.last_mo ?? "Last mo."}
+
{rel[0]} {rel[1]}
{#if hasCost}
{fmtnum(sysinfo.last_month.i)} {currency}
{/if}
{:else} - Consumption + {translations.realtime?.consumption ?? "Consumption"}
-
Hour
-
{fmtnum(data.h.u,2)} kWh
-
Day
-
{fmtnum(data.d.u,1)} kWh
-
Month
-
{fmtnum(data.m.u)} kWh
-
Last month
-
{fmtnum(sysinfo.last_month.u)} kWh
+
{capitalize(translations.common?.hour ?? "Hour")}
+
{rih[0]} {rih[1]}
+
{capitalize(translations.common?.day ?? "Day")}
+
{rid[0]} {rid[1]}
+
{capitalize(translations.common?.month ?? "Month")}
+
{rim[0]} {rim[1]}
+
{translations.realtime?.last_month ?? "Last month"}
+
{ril[0]} {ril[1]}
{#if hasCost} - Cost + {translations.realtime?.cost ?? "Cost"}
-
Hour
+
{capitalize(translations.common?.hour ?? "Hour")}
{fmtnum(data.h.c,2)} {currency}
-
Day
+
{capitalize(translations.common?.day ?? "Day")}
{fmtnum(data.d.c,1)} {currency}
-
Month
+
{capitalize(translations.common?.month ?? "Month")}
{fmtnum(data.m.c)} {currency}
-
Last month
+
{translations.realtime?.last_month ?? "Last month"}
{fmtnum(sysinfo.last_month.c)} {currency}
{/if} diff --git a/lib/SvelteUi/app/src/lib/AmpPlot.svelte b/lib/SvelteUi/app/src/lib/AmpPlot.svelte deleted file mode 100644 index 1aea5b19..00000000 --- a/lib/SvelteUi/app/src/lib/AmpPlot.svelte +++ /dev/null @@ -1,72 +0,0 @@ - - diff --git a/lib/SvelteUi/app/src/lib/BoardTypeSelectOptions.svelte b/lib/SvelteUi/app/src/lib/BoardTypeSelectOptions.svelte index ca77d508..9bd87d3c 100644 --- a/lib/SvelteUi/app/src/lib/BoardTypeSelectOptions.svelte +++ b/lib/SvelteUi/app/src/lib/BoardTypeSelectOptions.svelte @@ -27,6 +27,9 @@ + + + {/if} @@ -55,3 +58,8 @@ {/if} +{#if chip == 'esp32s3'} + + + +{/if} diff --git a/lib/SvelteUi/app/src/lib/Clock.svelte b/lib/SvelteUi/app/src/lib/Clock.svelte index ddc23062..4b0cd68e 100644 --- a/lib/SvelteUi/app/src/lib/Clock.svelte +++ b/lib/SvelteUi/app/src/lib/Clock.svelte @@ -1,20 +1,26 @@ -{#if showFull } -{`${zeropad(timestamp.getDate())}. ${monthnames[timestamp.getMonth()]} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`} +{#if clockOk } +{`${zeropad(timestamp.getDate())}. ${translations.months ? translations.months?.[timestamp.getMonth()] : zeropad(timestamp.getMonth())} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`} {:else} {`${zeropad(timestamp.getDate())}.${zeropad(timestamp.getMonth()+1)}.${timestamp.getFullYear()} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`} {/if} diff --git a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte index 76404490..6f0376f9 100644 --- a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte +++ b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte @@ -1,19 +1,23 @@ @@ -37,19 +44,20 @@
- Various permissions we need to do stuff: + {translations.consent?.title ?? "Consents"}

- Enable one-click upgrade? (implies data collection)
- Read more
-
+ {translations.consent?.one_click ?? "One-click"}
+ {translations.consent?.read_more ?? "Read more"}
+ +
- +
- + diff --git a/lib/SvelteUi/app/src/lib/Dashboard.svelte b/lib/SvelteUi/app/src/lib/Dashboard.svelte index a81bdbbf..df25cf90 100644 --- a/lib/SvelteUi/app/src/lib/Dashboard.svelte +++ b/lib/SvelteUi/app/src/lib/Dashboard.svelte @@ -1,9 +1,9 @@
@@ -37,10 +51,10 @@
- +
{data.mt ? metertype(data.mt) : '-'}
-
{data.ic ? data.ic.toFixed(1) : '-'} kWh
+
{it[0]} {it[1]}
{/if} @@ -48,23 +62,74 @@
- +
-
{data.ec ? data.ec.toFixed(1) : '-'} kWh
+
{et[0]} {et[1]}
{/if} - {#if uiVisibility(sysinfo.ui.v, data.u1 > 100 || data.u2 > 100 || data.u3 > 100)} + {#if uiVisibility(sysinfo.ui.v, data.l1 && (data.l1.u > 100 || data.l2.u > 100 || data.l3.u > 100))}
- + {#if data.l1} + + {/if}
{/if} - {#if uiVisibility(sysinfo.ui.a, data.i1 > 0.01 || data.i2 > 0.01 || data.i3 > 0.01)} + {#if uiVisibility(sysinfo.ui.a, data.l1 && (data.l1.i > 0.01 || data.l2.i > 0.01 || data.l3.i > 0.01))}
- + {#if data.l1} + 100} + l2={data.l2 && data.l2.u > 100} + l3={data.l3 && data.l3.u > 100} + l2x={data.i2e} + l1i={Math.max(data.l1.i,0)} + l2i={Math.max(data.l2.i,0)} + l3i={Math.max(data.l3.i,0)} + l1e={Math.max(data.l1.e,0)} + l2e={Math.max(data.l2.e,0)} + l3e={Math.max(data.l3.e,0)} + /> + {/if}
{/if} + {#if uiVisibility(sysinfo.ui.h, data.l1 && (data.l1.p > 0.01 || data.l2.p > 0.01 || data.l3.p > 0.01 || data.l1.q > 0.01 || data.l2.q > 0.01 || data.l3.q > 0.01))} +
+ {#if data.l1} + 100} + l2={data.l2 && data.l2.u > 100} + l3={data.l3 && data.l3.u > 100} + l1i={data.l1.p} + l2i={data.l2.p} + l3i={data.l3.p} + l1e={data.l1.q} + l2e={data.l2.q} + l3e={data.l3.q} + /> + {/if} +
+ {/if} + {#if uiVisibility(sysinfo.ui.f, data.l1 && (data.l1.f > 0.01 || data.l2.f > 0.01 || data.l3.f > 0.01))} +
+ {#if data.l1} + 100} + l2={data.l2 && data.l2.u > 100} + l3={data.l3 && data.l3.u > 100} + l1i={data.l1.f} + l2i={data.l2.f} + l3i={data.l3.f} + /> + {/if} +
+ {/if} {#if uiVisibility(sysinfo.ui.r, data.ri > 0 || data.re > 0 || data.ric > 0 || data.rec > 0)}
@@ -75,29 +140,34 @@ 0 || data.e > 0}/>
{/if} - {#if uiVisibility(sysinfo.ui.t, data.pr && (data.pr.startsWith("10YNO") || data.pr.startsWith('10Y1001A1001A4')))} + {#if uiVisibility(sysinfo.ui.t, data.pr && (data.pr.startsWith("NO") || data.pr.startsWith("10YNO") || data.pr.startsWith('10Y1001A1001A4')))}
- + +
+ {/if} + {#if uiVisibility(sysinfo.ui.l)} +
+
{/if} {#if uiVisibility(sysinfo.ui.p, data.pe && !Number.isNaN(data.p))}
- +
{/if} {#if uiVisibility(sysinfo.ui.d, dayPlot)}
- +
{/if} {#if uiVisibility(sysinfo.ui.m, monthPlot)}
- +
{/if} {#if uiVisibility(sysinfo.ui.s, data.t && data.t != -127 && temperatures.c > 1)}
- +
{/if}
\ No newline at end of file diff --git a/lib/SvelteUi/app/src/lib/DataStores.js b/lib/SvelteUi/app/src/lib/DataStores.js index eb13955c..bb259500 100644 --- a/lib/SvelteUi/app/src/lib/DataStores.js +++ b/lib/SvelteUi/app/src/lib/DataStores.js @@ -1,7 +1,10 @@ import { readable, writable } from 'svelte/store'; -import { isBusPowered, zeropad } from './Helpers'; +import { isBusPowered, zeropad, scanForDevice } from './Helpers'; -async function fetchWithTimeout(resource, options = {}) { +let queueMap = {} +let queue = []; + +async function fetchWithTimeoutReal(resource, options = {}) { const { timeout = 8000 } = options; const controller = new AbortController(); @@ -12,7 +15,46 @@ async function fetchWithTimeout(resource, options = {}) { }); clearTimeout(id); return response; - } +} + +let eatTimeout; +async function eatQueue() { + if(queue.length) { + let item = queue.shift(); + delete queueMap[item.resource]; + try { + let response = await fetchWithTimeoutReal(item.resource, item.options); + for(let i in item.callbacks) { + item.callbacks[i](response); + } + } catch(e) { + console.error("Error calling " + item.resource, e); + for(let i in item.callbacks) { + item.callbacks[i](); + } + } + } + if(eatTimeout) clearTimeout(eatTimeout); + eatTimeout = setTimeout(eatQueue, 100); +}; +eatQueue(); + +export async function fetchWithTimeout(resource, options = {}) { + let item; + if(queueMap[resource]) { + item = queueMap[resource]; + } else { + item = { + resource: resource, + options: options, + callbacks: [] + }; + queueMap[resource] = item; + queue.push(item); + } + let promise = new Promise((cb) => item.callbacks.push(cb)); + return promise; +} let sysinfo = { version: '', @@ -33,23 +75,34 @@ let sysinfo = { f: null, t: null }, - trying: null + trying: null, + if: { + eth: false + } }; export const sysinfoStore = writable(sysinfo); export async function getSysinfo() { - const response = await fetchWithTimeout("/sysinfo.json?t=" + Math.floor(Date.now() / 1000)); + const response = await fetchWithTimeout("sysinfo.json?t=" + Math.floor(Date.now() / 1000)); sysinfo = (await response.json()) sysinfoStore.set(sysinfo); }; +function updateSysinfo(url) { + sysinfoStore.update(s => { + s.trying = url; + return s; + }); +} + let tries = 0; let lastTemp = -127; let lastPrice = null; let data = {}; export const dataStore = readable(data, (set) => { let timeout; + let scanTimeout; async function getData() { - fetchWithTimeout("/data.json") + fetchWithTimeout("data.json") .then((res) => res.json()) .then((data) => { set(data); @@ -77,7 +130,7 @@ export const dataStore = readable(data, (set) => { to = Math.max(diff, 0.1) * 10 * 5000; } } - if(to > 5000) console.log("Scheduling next data fetch in " + to + "ms"); + if(to > 5000) console.log("Next in " + to + "ms"); if(timeout) clearTimeout(timeout); timeout = setTimeout(getData, to); tries = 0; @@ -92,6 +145,7 @@ export const dataStore = readable(data, (set) => { mm: 0 }); timeout = setTimeout(getData, 15000); + if(!scanTimeout) scanTimeout = setTimeout(scanForDevice, 5000, sysinfo, updateSysinfo); } else { timeout = setTimeout(getData, isBusPowered(sysinfo.board) ? 10000 : 5000); } @@ -132,7 +186,7 @@ export async function getPrices() { clearTimeout(priceShiftTimeout); priceShiftTimeout = 0; } - const response = await fetchWithTimeout("/energyprice.json"); + const response = await fetchWithTimeout("energyprice.json"); prices = (await response.json()) pricesStore.set(prices); @@ -147,7 +201,7 @@ export async function getDayPlot() { clearTimeout(dayPlotTimeout); dayPlotTimeout = 0; } - const response = await fetchWithTimeout("/dayplot.json"); + const response = await fetchWithTimeout("dayplot.json"); dayPlot = (await response.json()) dayPlotStore.set(dayPlot); @@ -167,7 +221,7 @@ export async function getMonthPlot() { clearTimeout(monthPlotTimeout); monthPlotTimeout = 0; } - const response = await fetchWithTimeout("/monthplot.json"); + const response = await fetchWithTimeout("monthplot.json"); monthPlot = (await response.json()) monthPlotStore.set(monthPlot); @@ -182,7 +236,7 @@ export const monthPlotStore = writable(monthPlot, (set) => { let temperatures = {}; export async function getTemperatures() { - const response = await fetchWithTimeout("/temperature.json"); + const response = await fetchWithTimeout("temperature.json"); temperatures = (await response.json()) temperaturesStore.set(temperatures); } @@ -199,7 +253,7 @@ export async function getTariff() { clearTimeout(tariffTimeout); tariffTimeout = 0; } - const response = await fetchWithTimeout("/tariff.json"); + const response = await fetchWithTimeout("tariff.json"); tariff = (await response.json()) tariffStore.set(tariff); let date = new Date(); @@ -218,3 +272,27 @@ export async function getGitHubReleases() { releases = (await response.json()) gitHubReleaseStore.set(releases); }; + +let realtimeOffset = 0; +let realtime = { data: [] }; +export async function getRealtime() { + const response = await fetchWithTimeout(realtimeOffset < 0 ? "realtime.json" : "realtime.json?offset="+realtimeOffset); + let res = (await response.json()) + realtimeStore.update(current => { + for(let i = 0; i < res.size; i++) { + current.data[res.offset+i] = res.data[i]; + } + current.size = current.data.length; + return current; + }); + if(realtimeOffset >= 0) { + realtimeOffset += res.size; + if(realtimeOffset < res.total) { + setTimeout(getRealtime, 2000); + } else { + realtimeOffset = -1; + } + } +} + +export const realtimeStore = writable(realtime); diff --git a/lib/SvelteUi/app/src/lib/DayPlot.svelte b/lib/SvelteUi/app/src/lib/DayPlot.svelte index 95a1ef09..7908a7ee 100644 --- a/lib/SvelteUi/app/src/lib/DayPlot.svelte +++ b/lib/SvelteUi/app/src/lib/DayPlot.svelte @@ -2,6 +2,7 @@ import { zeropad, addHours, exportcol } from './Helpers.js'; import BarChart from './BarChart.svelte'; + export let title; export let json; export let sysinfo; @@ -9,6 +10,8 @@ let max; let min; + let dark = document.documentElement.classList.contains('dark'); + $: { let i = 0; let yTicks = []; @@ -34,8 +37,8 @@ label2: exp.toFixed(1), title2: exp.toFixed(2) + ' kWh', value2: exp*10, - color: '#7c3aed', - color2: '#37829E' + color: dark ? '#5c2da5' : '#7c3aed', + color2: dark ? '#27728e' : '#37829e', }); min = Math.max(min, exp*10); max = Math.max(max, imp*10); @@ -57,8 +60,8 @@ label2: exp.toFixed(1), title2: exp.toFixed(2) + ' kWh', value2: exp*10, - color: '#7c3aed', - color2: '#37829E' + color: dark ? '#5c2da5' : '#7c3aed', + color2: dark ? '#27728e' : '#37829e', }); min = Math.max(min, exp*10); max = Math.max(max, imp*10); @@ -93,7 +96,7 @@ } config = { - title: "Energy use last 24 hours (kWh)", + title: title, height: 226, width: 1520, padding: { top: 20, right: 15, bottom: 20, left: 35 }, diff --git a/lib/SvelteUi/app/src/lib/DownloadIcon.svelte b/lib/SvelteUi/app/src/lib/DownloadIcon.svelte deleted file mode 100644 index ea9993ba..00000000 --- a/lib/SvelteUi/app/src/lib/DownloadIcon.svelte +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/lib/SvelteUi/app/src/lib/FileUploadComponent.svelte b/lib/SvelteUi/app/src/lib/FileUploadComponent.svelte index a47fbf24..23aab030 100644 --- a/lib/SvelteUi/app/src/lib/FileUploadComponent.svelte +++ b/lib/SvelteUi/app/src/lib/FileUploadComponent.svelte @@ -1,22 +1,28 @@
- Upload {title} -

Select a suitable file and click upload

+ {translations.upload?.title ?? "Upload"} {title} +

{translations.upload?.desc ?? ""}

uploading=true} autocomplete="off">
- +
- + diff --git a/lib/SvelteUi/app/src/lib/Header.svelte b/lib/SvelteUi/app/src/lib/Header.svelte index 24f9eacb..130dcc86 100644 --- a/lib/SvelteUi/app/src/lib/Header.svelte +++ b/lib/SvelteUi/app/src/lib/Header.svelte @@ -2,24 +2,24 @@ import { Link } from "svelte-navigator"; import { sysinfoStore, getGitHubReleases, gitHubReleaseStore } from './DataStores.js'; import { upgrade, getNextVersion, upgradeWarningText } from './UpgradeHelper'; - import { boardtype, hanError, mqttError, priceError, isBusPowered, wiki, bcol } from './Helpers.js'; - import AmsleserSvg from "./../assets/favicon.svg"; - import GitHubLogo from './../assets/github.svg'; + import { boardtype, isBusPowered, wiki, bcol } from './Helpers.js'; + import { translationsStore } from "./TranslationService.js"; + import FavIco from './../assets/favicon.svg'; import Uptime from "./Uptime.svelte"; import Badge from './Badge.svelte'; import Clock from './Clock.svelte'; import GearIcon from './GearIcon.svelte'; import InfoIcon from "./InfoIcon.svelte"; import HelpIcon from "./HelpIcon.svelte"; - import DownloadIcon from "./DownloadIcon.svelte"; - export let data = {} - let sysinfo = {} + export let basepath = "/"; + export let data = {}; + let sysinfo = {}; let nextVersion = {}; - + function askUpgrade() { - if(confirm('Do you want to upgrade this device to ' + nextVersion.tag_name + '?')) { + if(confirm((translations.header?.upgrade ?? "Upgrade to {0}?").replace('{0}',nextVersion.tag_name))) { if(!isBusPowered(sysinfo.board) || confirm(upgradeWarningText(boardtype(sysinfo.chip, sysinfo.board)))) { sysinfoStore.update(s => { s.upgrading = true; @@ -39,9 +39,14 @@ gitHubReleaseStore.subscribe(releases => { nextVersion = getNextVersion(sysinfo.version, releases); }); + + let translations = {}; + translationsStore.subscribe(update => { + translations = update; + }); -